Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

카페 상세 정보(이미지) 연동 #177

Merged
merged 15 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ buildscript {
repositories {
google()
mavenCentral()
maven("https://www.jitpack.io")
}

dependencies {
Expand All @@ -40,6 +41,7 @@ allprojects {
google()
mavenCentral()
maven("https://naver.jfrog.io/artifactory/maven/")
maven("https://www.jitpack.io")
}

apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.common.extension

import android.content.res.Resources

fun Float.fromDpToPx(): Int =
(this * Resources.getSystem().displayMetrics.density).toInt()
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.common.extension

import android.content.res.Resources
import kotlin.math.roundToInt

val Int.dp: Int
get() = (this * Resources.getSystem().displayMetrics.density).roundToInt()
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.common.ui

import android.content.Context
import android.graphics.Color
import android.graphics.Point
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import androidx.viewbinding.ViewBinding
import us.wedemy.eggeum.android.common.extension.dp

abstract class BaseDialogFragment<VB : ViewBinding> : DialogFragment() {
private var _binding: VB? = null
protected val binding
get() = _binding!!

abstract fun getViewBinding(): VB

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View = getViewBinding().also { _binding = it }.root

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setSizeDialog()
}

override fun getTheme(): Int = us.wedemy.eggeum.android.design.R.style.EggeumDialog

@Suppress("NestedBlockDepth")
private fun setSizeDialog() {
context?.let {
dialog?.let { dialog ->
dialog.window?.let { window ->
val windowManager: WindowManager =
activity?.getSystemService(Context.WINDOW_SERVICE) as WindowManager
val size = Point()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val displayMetrics = windowManager.currentWindowMetrics
size.x = displayMetrics.bounds.width()
size.y = displayMetrics.bounds.height()
} else {
@Suppress("DEPRECATION")
val display = windowManager.defaultDisplay
display.getRealSize(size)
}

val params: ViewGroup.LayoutParams = window.attributes
params.width = size.x - 64.dp
params.height = ViewGroup.LayoutParams.WRAP_CONTENT
window.setGravity(Gravity.CENTER)
window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
}
}
}
}

override fun onDestroyView() {
_binding = null
super.onDestroyView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.common.util

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class GridSpacingItemDecoration(
private val spanCount: Int, // Grid의 column 수
private val spacing: Int, // 간격
) : RecyclerView.ItemDecoration() {

override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State,
) {
val position: Int = parent.getChildAdapterPosition(view)

if (position >= 0) {
val column = position % spanCount // item column
outRect.apply {
// spacing - column * ((1f / spanCount) * spacing)
left = spacing - column * spacing / spanCount
// (column + 1) * ((1f / spanCount) * spacing)
right = (column + 1) * spacing / spanCount
if (position < spanCount) top = spacing
bottom = spacing
}
} else {
outRect.apply {
left = 0
right = 0
top = 0
bottom = 0
}
}
}
}
12 changes: 12 additions & 0 deletions design-resource/src/main/res/drawable/bg_eggeum_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Designed and developed by Wedemy 2023.
~
~ Licensed under the MIT.
~ Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white" />
<corners android:radius="16dp" />
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,12m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#14B8A6"/>
<path
android:pathData="M12,12m-7,0a7,7 0,1 1,14 0a7,7 0,1 1,-14 0"
android:fillColor="#14B8A6"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,12m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#CDD0D6"/>
</group>
</vector>
15 changes: 15 additions & 0 deletions design-resource/src/main/res/drawable/ic_menu_white_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,4m-0,-2a2,2 0,1 1,-0 4a2,2 0,1 1,-0 -4"
android:fillColor="#ffffff"/>
<path
android:pathData="M12,12m-0,-2a2,2 0,1 1,-0 4a2,2 0,1 1,-0 -4"
android:fillColor="#ffffff"/>
<path
android:pathData="M12,20m-0,-2a2,2 0,1 1,-0 4a2,2 0,1 1,-0 -4"
android:fillColor="#ffffff"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Designed and developed by Wedemy 2023.
~
~ Licensed under the MIT.
~ Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_circle_checkbox_filled_24" android:state_checked="true" />
<item android:drawable="@drawable/ic_circle_checkbox_outlined_24" android:state_checked="false" />
</selector>
2 changes: 2 additions & 0 deletions design-resource/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@

<color name="error_500">#ef4444</color>

<color name="muted_900">#171717</color>

</resources>
9 changes: 8 additions & 1 deletion design-resource/src/main/res/values/fonts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@
</style>

<style name="H5">
<item name="android:fontFamily">@font/pretendard_semibold</item>
<item name="android:fontFamily">@font/pretendard_bold</item>
<item name="android:textStyle">normal</item>
<item name="android:textSize">24sp</item>
<item name="android:lineSpacingExtra">12sp</item>
</style>

<style name="H6">
<item name="android:fontFamily">@font/pretendard_bold</item>
<item name="android:textStyle">normal</item>
<item name="android:textSize">20sp</item>
<item name="android:lineSpacingExtra">10sp</item>
</style>

<style name="Title">
<item name="android:gravity">center_horizontal</item>
<item name="android:fontFamily">@font/pretendard_semibold</item>
Expand Down
4 changes: 4 additions & 0 deletions design-resource/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
<item name="android:textSize">0sp</item>
</style>

<style name="EggeumDialog" parent="@style/Theme.MaterialComponents.Dialog">
<item name="android:background">@drawable/bg_eggeum_dialog</item>
</style>

<style name="EggeumBottomSheetDialog" parent="@style/ThemeOverlay.MaterialComponents.BottomSheetDialog">
<item name="bottomSheetStyle">@style/EggeumBottomSheet</item>
</style>
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ insetter = "0.6.1"
timber = "5.0.1"
naver-map = "3.17.0"
ksp = "1.9.21-1.0.16"
photo-view = "2.0.0"

javax-inject = "1"

Expand Down Expand Up @@ -138,6 +139,7 @@ lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" }
insetter = { module = "dev.chrisbanes.insetter:insetter", version.ref = "insetter" }
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
naver-map = { module = "com.naver.maps:map-sdk", version.ref = "naver-map" }
photo-view = { module = "com.github.chrisbanes:PhotoView", version.ref = "photo-view"}

javax-inject = { module = "javax.inject:javax.inject", version.ref = "javax-inject" }

Expand Down
1 change: 1 addition & 0 deletions main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {
libs.coil,
libs.timber,
libs.naver.map,
libs.photo.view,
projects.common,
projects.designResource,
projects.domain,
Expand Down
Loading