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

#95 [feat] 달성 완료 후 바텀시트에 해당 아이콘 띄우기 #96

Merged
merged 2 commits into from
Jan 18, 2024
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
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