|
|
@@ -80,7 +80,12 @@ class RechargeDailyComp(
|
|
|
|
|
|
|
|
|
fun initDataWithOnlyWeekly() {
|
|
|
- rechargeDailyViewModel?.getWeeklyRechargeProgress()?.observe(viewLifecycleOwner) {
|
|
|
+ rechargeDailyViewModel?.getWeeklyRechargeProgress()?.observe(viewLifecycleOwner) { it->
|
|
|
+ if (it==null){
|
|
|
+ binding.onlyWeeklyLayout.gone()
|
|
|
+ return@observe
|
|
|
+ }
|
|
|
+ binding.onlyWeeklyLayout.show()
|
|
|
val countDownTime = it?.countdown ?: 0
|
|
|
if (countDownTime > 1) {
|
|
|
binding.onlyWeeklyCountDownView.show()
|
|
|
@@ -144,9 +149,15 @@ class RechargeDailyComp(
|
|
|
.show(requireActivity().supportFragmentManager)
|
|
|
|
|
|
}
|
|
|
+ binding.dailyLayout.show()
|
|
|
}
|
|
|
|
|
|
- rechargeDailyViewModel?.getWeeklyRechargeProgress()?.observe(viewLifecycleOwner) {
|
|
|
+ rechargeDailyViewModel?.getWeeklyRechargeProgress()?.observe(viewLifecycleOwner) { it ->
|
|
|
+ if (it==null){
|
|
|
+ binding.weeklyLayout.gone()
|
|
|
+ return@observe
|
|
|
+ }
|
|
|
+ binding.weeklyLayout.show()
|
|
|
val countDownTime = it?.countdown ?: 0
|
|
|
if (countDownTime > 1) {
|
|
|
binding.weeklyCountDownView.show()
|
|
|
@@ -185,6 +196,7 @@ class RechargeDailyComp(
|
|
|
.show(requireActivity().supportFragmentManager)
|
|
|
|
|
|
}
|
|
|
+ binding.weeklyLayout.show()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -205,14 +217,11 @@ class RechargeDailyComp(
|
|
|
}
|
|
|
rechargeDailyViewModel?.allowDailyRechargeLD?.observe(viewLifecycleOwner) {
|
|
|
if (it) {
|
|
|
- binding.dailyLayout.show()
|
|
|
- binding.weeklyLayout.show()
|
|
|
- binding.onlyWeeklyLayout.gone()
|
|
|
initDataWithDaylyAndWeekly()
|
|
|
+ binding.onlyWeeklyLayout.gone()
|
|
|
} else {
|
|
|
binding.dailyLayout.gone()
|
|
|
binding.weeklyLayout.gone()
|
|
|
- binding.onlyWeeklyLayout.show()
|
|
|
initDataWithOnlyWeekly()
|
|
|
}
|
|
|
binding.root.show()
|