Skip to content

Commit

Permalink
feat: 영양제 홈 화면 강아지 이름 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
iiolo committed Jan 23, 2024
1 parent fb25e03 commit 1ce9400
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class SupplementFragment : Fragment() {
navController = findNavController()

fragmentSupplementBinding.run {
textViewSupplementDogName.text = supplementViewModel.dogName.value

textViewSupplementAdd.setOnClickListener {
navController.navigate(R.id.action_supplement_to_supplementAdd)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class SupplementViewModel
var supplementCode = MutableLiveData<Int?>()
var supplementDeleteCode = MutableLiveData<Int?>()
var routineIsClicked = MutableLiveData<Boolean>()
var dogName = MutableLiveData<String>()

init {
intakeTimeList.value = mutableListOf()
Expand All @@ -67,6 +68,7 @@ class SupplementViewModel
supplementPercentage.value = 0.0
supplementIdListAllCheck.value = false
supplementAddImg.value = null
getDogName()
}

fun getSupplements(date: Date) {
Expand Down Expand Up @@ -314,4 +316,10 @@ class SupplementViewModel

supplementIdListAllCheck.value = isChecked
}

fun getDogName() {
viewModelScope.launch {
dogName.value = DogPreferences(GlobalApplication.applicationContext()).dogName.first()
}
}
}

0 comments on commit 1ce9400

Please sign in to comment.