sforkowany z mirror/meshtastic-android
fix autobug if user tries to change settings during an update
cc @vfurman-gh Caused by android.os.RemoteException: Operation prohibited during firmware update at com.geeksville.util.ExceptionsKt.toRemoteExceptions(ExceptionsKt.java:61) at com.geeksville.mesh.service.MeshService$binder$1.setRadioConfig(MeshService.java:1589) at com.geeksville.mesh.model.UIViewModel.setRadioConfig(UIViewModel.java:163) at com.geeksville.mesh.model.UIViewModel.setLsSleepSecs(UIViewModel.java:148) at com.geeksville.mesh.ui.SettingsFragment$initCommonUI$8.invoke(SettingsFragment.java:637) at com.geeksville.mesh.ui.SettingsFragment$initCommonUI$8.invoke(SettingsFragment.java:464) at com.geeksville.mesh.ui.MessagesFragmentKt$on$1.onEditorAction(MessagesFragmentKt.java:35) at android.widget.TextView.onEditorAction(TextView.java:7042) at com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:138) at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:357) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:89) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7562) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)1.2-legacy
rodzic
e482d074c7
commit
50dc26b36d
|
@ -14,6 +14,7 @@ import com.geeksville.mesh.databinding.AdvancedSettingsBinding
|
||||||
import com.geeksville.mesh.model.ChannelOption
|
import com.geeksville.mesh.model.ChannelOption
|
||||||
import com.geeksville.mesh.model.UIViewModel
|
import com.geeksville.mesh.model.UIViewModel
|
||||||
import com.geeksville.mesh.service.MeshService
|
import com.geeksville.mesh.service.MeshService
|
||||||
|
import com.geeksville.util.exceptionToSnackbar
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
|
||||||
class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
||||||
|
@ -54,7 +55,9 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
||||||
?: ChannelOption.defaultMinBroadcastPeriod
|
?: ChannelOption.defaultMinBroadcastPeriod
|
||||||
|
|
||||||
if (n != null && n < MAX_INT_DEVICE && (n == 0 || n >= minBroadcastPeriodSecs)) {
|
if (n != null && n < MAX_INT_DEVICE && (n == 0 || n >= minBroadcastPeriodSecs)) {
|
||||||
|
exceptionToSnackbar(requireView()) {
|
||||||
model.positionBroadcastSecs = n
|
model.positionBroadcastSecs = n
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// restore the value in the edit field
|
// restore the value in the edit field
|
||||||
textEdit.setText(model.positionBroadcastSecs.toString())
|
textEdit.setText(model.positionBroadcastSecs.toString())
|
||||||
|
@ -73,7 +76,9 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
||||||
val str = binding.lsSleepEditText.text.toString()
|
val str = binding.lsSleepEditText.text.toString()
|
||||||
val n = str.toIntOrNull()
|
val n = str.toIntOrNull()
|
||||||
if (n != null && n < MAX_INT_DEVICE && n >= 0) {
|
if (n != null && n < MAX_INT_DEVICE && n >= 0) {
|
||||||
|
exceptionToSnackbar(requireView()) {
|
||||||
model.lsSleepSecs = n
|
model.lsSleepSecs = n
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(requireView(), "Bad value: $str", Snackbar.LENGTH_LONG).show()
|
Snackbar.make(requireView(), "Bad value: $str", Snackbar.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ee6611838637d096b39e11365930eb90a5f0fd2e
|
Subproject commit fb14fb659d0b235d325a0d9195cb5f47424dff51
|
Ładowanie…
Reference in New Issue