From 983d3b14de385f1e4604a2d685a3756d0b2dcc7d Mon Sep 17 00:00:00 2001 From: heominhoe Date: Thu, 18 Jan 2024 12:58:03 +0900 Subject: [PATCH] =?UTF-8?q?#95=20[feat]=20=EB=8B=AC=EC=84=B1=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=ED=9B=84=20=EB=B0=94=ED=85=80=EC=8B=9C=ED=8A=B8?= =?UTF-8?q?=EC=97=90=20=ED=95=B4=EB=8B=B9=20=EC=95=84=EC=9D=B4=EC=BD=98=20?= =?UTF-8?q?=EB=9D=84=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/dailyroutine/DailyRoutineFragment.kt | 26 ++++++++----------- .../softie/util/OriginalBottomSheet.kt | 4 +-- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/sopetit/softie/ui/dailyroutine/DailyRoutineFragment.kt b/app/src/main/java/com/sopetit/softie/ui/dailyroutine/DailyRoutineFragment.kt index 2249600f..6ac844eb 100644 --- a/app/src/main/java/com/sopetit/softie/ui/dailyroutine/DailyRoutineFragment.kt +++ b/app/src/main/java/com/sopetit/softie/ui/dailyroutine/DailyRoutineFragment.kt @@ -10,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.viewModels import com.sopetit.softie.R import com.sopetit.softie.databinding.FragmentDailyRoutineBinding +import com.sopetit.softie.domain.entity.DailyRoutine import com.sopetit.softie.ui.dailyroutine.complete.DailyRoutineCompleteActivity import com.sopetit.softie.ui.dailyroutine.dailyroutineadd.DailyRoutineAddActivity import com.sopetit.softie.util.OriginalBottomSheet.Companion.BOTTOM_SHEET_TAG @@ -38,7 +39,6 @@ class DailyRoutineFragment : initSetDeleteView() initSetRoutineDelete() addDailyRoutineMsg() - achieveRoutine() } private fun initSetDailyRoutineContent() { @@ -114,24 +114,19 @@ class DailyRoutineFragment : dailyIcon.setCoilImage(dailyRoutine?.get(index)?.iconImageUrl) viewModel.setRoutineAchieve(dailyRoutine?.get(index)?.isAchieve ?: false, index) - initSetDailyRoutineAchieve(btn, dailyRoutine?.get(index)?.routineId ?: 0) + initSetDailyRoutineAchieve( + btn, + (dailyRoutine?.get(index) ?: 0) as DailyRoutine, + dailyRoutine?.get(index)?.routineId ?: 0 + ) } - private fun achieveRoutine() { - viewModel.isRoutineAchieveFirst.observe(viewLifecycleOwner) { - } - viewModel.isRoutineAchieveSecond.observe(viewLifecycleOwner) { - } - viewModel.isRoutineAchieveThird.observe(viewLifecycleOwner) { - } - } - - private fun initSetDailyRoutineAchieve(btn: View, routineId: Int) { + private fun initSetDailyRoutineAchieve(btn: View, dailyRoutine: DailyRoutine, routineId: Int) { btn.setOnClickListener { BindingBottomSheet.Builder().build( - isDrawable = true, - imageDrawable = R.drawable.ic_bear_face_crying, - imageUri = "", + isDrawable = false, + imageDrawable = 0, + imageUri = dailyRoutine.iconImageUrl, title = "데일리 루틴을 완료했나요?", content = "한 번 완료하면 이전으로 되돌릴 수 없어요", isContentVisible = true, @@ -143,6 +138,7 @@ class DailyRoutineFragment : doBtnAction = { startDailyRoutineCompleteActivity() viewModel.patchAchieveDaily(routineId) + viewModel.getDailyRoutine() } ).show(parentFragmentManager, BOTTOM_SHEET_TAG) } diff --git a/app/src/main/java/com/sopetit/softie/util/OriginalBottomSheet.kt b/app/src/main/java/com/sopetit/softie/util/OriginalBottomSheet.kt index e64fe856..87814bcc 100644 --- a/app/src/main/java/com/sopetit/softie/util/OriginalBottomSheet.kt +++ b/app/src/main/java/com/sopetit/softie/util/OriginalBottomSheet.kt @@ -7,7 +7,7 @@ import android.view.ViewGroup import androidx.core.content.ContextCompat import com.sopetit.softie.R import com.sopetit.softie.databinding.FragmentBottomsheetBinding -import com.sopetit.softie.util.binding.BindingAdapter.setImage +import com.sopetit.softie.util.binding.BindingAdapter.setCoilImage import com.sopetit.softie.util.binding.BindingBottomSheet class OriginalBottomSheet : BindingBottomSheet() { @@ -28,7 +28,7 @@ class OriginalBottomSheet : BindingBottomSheet() { if (isDrawable == true) { imageDrawable?.let { binding.ivBottomSheet.setImageResource(it) } } else { - binding.ivBottomSheet.setImage(imageUri) + binding.ivBottomSheet.setCoilImage(imageUri) } }