Skip to content

Commit

Permalink
Merge pull request #96 from Team-Sopetit/feature/#95-daily-routine-bo…
Browse files Browse the repository at this point in the history
…ttom-icon

#95 [feat] 달성 완료 후 바텀시트에 해당 아이콘 띄우기
  • Loading branch information
minemi00 authored Jan 18, 2024
2 parents 0bbf46b + f50b0d8 commit a50d86a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -38,7 +39,6 @@ class DailyRoutineFragment :
initSetDeleteView()
initSetRoutineDelete()
addDailyRoutineMsg()
achieveRoutine()
}

private fun initSetDailyRoutineContent() {
Expand Down Expand Up @@ -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,
Expand All @@ -143,6 +138,7 @@ class DailyRoutineFragment :
doBtnAction = {
startDailyRoutineCompleteActivity()
viewModel.patchAchieveDaily(routineId)
viewModel.getDailyRoutine()
}
).show(parentFragmentManager, BOTTOM_SHEET_TAG)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
}
}

Expand Down

0 comments on commit a50d86a

Please sign in to comment.