Autotune Fix tuneDays modification from keyboard

This commit is contained in:
Philoul 2022-07-27 23:38:51 +02:00
parent 0734b4c620
commit a67bcddbfd

View file

@ -115,6 +115,7 @@ class AutotuneFragment : DaggerFragment() {
} }
autotunePlugin.selectedProfile = profileName autotunePlugin.selectedProfile = profileName
resetParam() resetParam()
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
} }
updateGui() updateGui()
} }
@ -275,6 +276,7 @@ class AutotuneFragment : DaggerFragment() {
.observeOn(aapsSchedulers.main) .observeOn(aapsSchedulers.main)
.subscribe({ updateGui() }, fabricPrivacy::logException) .subscribe({ updateGui() }, fabricPrivacy::logException)
checkNewDay() checkNewDay()
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
updateGui() updateGui()
} }
@ -287,7 +289,6 @@ class AutotuneFragment : DaggerFragment() {
@Synchronized @Synchronized
private fun updateGui() { private fun updateGui() {
_binding ?: return _binding ?: return
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil) profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil)
profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString() profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString()
profileFunction.getProfile()?.let { currentProfile -> profileFunction.getProfile()?.let { currentProfile ->
@ -387,7 +388,7 @@ class AutotuneFragment : DaggerFragment() {
try { try {
if (autotunePlugin.calculationRunning) if (autotunePlugin.calculationRunning)
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble() binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
if (binding.tuneDays.value != autotunePlugin.lastNbDays.toDouble()) { if (binding.tuneDays.text != autotunePlugin.lastNbDays) {
autotunePlugin.lastNbDays = binding.tuneDays.text autotunePlugin.lastNbDays = binding.tuneDays.text
resetParam(false) resetParam(false)
} }