diff --git a/core/designsystem/src/main/java/com/dpm/designsystem/SpotSnackBar.kt b/core/designsystem/src/main/java/com/dpm/designsystem/SpotSnackBar.kt index 45aaea22..84a5feda 100644 --- a/core/designsystem/src/main/java/com/dpm/designsystem/SpotSnackBar.kt +++ b/core/designsystem/src/main/java/com/dpm/designsystem/SpotSnackBar.kt @@ -2,22 +2,26 @@ package com.dpm.designsystem import android.graphics.Paint import android.view.LayoutInflater +import android.view.MotionEvent import android.view.View import androidx.core.content.ContextCompat import com.depromeet.designsystem.R import com.depromeet.designsystem.databinding.SpotSnackbarBinding +import com.dpm.designsystem.extension.dpToPx import com.google.android.material.snackbar.Snackbar + class SpotSnackBar( view: View, private val snackBarBackground: Int, private val message: String, + private val marginBottom: Int, private val endMessage: String, private val onClick: () -> Unit ) { companion object { - fun make(view: View, background: Int = R.drawable.rect_transfer_black_03_fill_60, message: String = "", endMessage: String = "", onClick: () -> Unit) = - SpotSnackBar(view = view, snackBarBackground = background, message= message, endMessage = endMessage, onClick = onClick) + fun make(view: View, background: Int = R.drawable.rect_transfer_black_03_fill_60, marginBottom: Int = 0, message: String = "", endMessage: String = "", onClick: () -> Unit) = + SpotSnackBar(view = view, snackBarBackground = background, marginBottom = marginBottom, message= message, endMessage = endMessage, onClick = onClick) } private val context = view.context @@ -34,14 +38,24 @@ class SpotSnackBar( private fun initView() { with(snackbarLayout) { removeAllViews() - setPadding(0, 0, 0, 0) - setBackgroundResource(snackBarBackground) + setPadding(0, 0, 0, marginBottom.dpToPx(context)) + setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)) addView(snackbarBinding.root, 0) + + setOnTouchListener { v, event -> + if (event.action == MotionEvent.ACTION_UP) { + v.performClick() + true + } else { + false + } + } } with(snackbarBinding) { tvDescription.text = message tvTrigger.paintFlags = Paint.UNDERLINE_TEXT_FLAG tvTrigger.text = endMessage + clContainer.setBackgroundResource(snackBarBackground) } } diff --git a/core/designsystem/src/main/res/layout/spot_snackbar.xml b/core/designsystem/src/main/res/layout/spot_snackbar.xml index 54b742c4..a0011f5b 100644 --- a/core/designsystem/src/main/res/layout/spot_snackbar.xml +++ b/core/designsystem/src/main/res/layout/spot_snackbar.xml @@ -4,34 +4,44 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - tools:background="@drawable/rect_transfer_black_03_fill_60"> + android:background="@android:color/transparent"> - + tools:background="@drawable/rect_transfer_black_03_fill_60"> - + + + + \ No newline at end of file diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/StadiumDetailPictureFragment.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/StadiumDetailPictureFragment.kt index ccf91b6e..9cf51f90 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/StadiumDetailPictureFragment.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/StadiumDetailPictureFragment.kt @@ -91,6 +91,9 @@ class StadiumDetailPictureFragment : BindingFragment