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