kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Cleanup
rodzic
26d7ff9578
commit
45dbcab850
|
@ -462,7 +462,7 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging {
|
|||
|
||||
@SuppressLint("NewApi")
|
||||
class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
|
||||
private val MAX_INT_DEVICE = 0xFFFFFFFF
|
||||
private var _binding: SettingsFragmentBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and onDestroyView.
|
||||
|
@ -579,12 +579,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
})
|
||||
|
||||
model.radioConfig.observe(viewLifecycleOwner, { _ ->
|
||||
var inMinutes = model.positionBroadcastSecs
|
||||
if (inMinutes != null) {
|
||||
inMinutes /= 60
|
||||
}
|
||||
binding.positionBroadcastPeriodEditText.setText(inMinutes.toString())
|
||||
|
||||
binding.positionBroadcastPeriodEditText.setText(model.positionBroadcastSecs.toString())
|
||||
binding.lsSleepEditText.setText(model.lsSleepSecs.toString())
|
||||
})
|
||||
|
||||
|
@ -620,9 +615,8 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
|
||||
binding.positionBroadcastPeriodEditText.on(EditorInfo.IME_ACTION_DONE) {
|
||||
val str = binding.positionBroadcastPeriodEditText.text.toString()
|
||||
var n = str.toIntOrNull()
|
||||
if (n != null && n < 100000 && n >= 0) {
|
||||
n *= 60
|
||||
val n = str.toIntOrNull()
|
||||
if (n != null && n <= MAX_INT_DEVICE && n >= 0) {
|
||||
model.positionBroadcastSecs = n
|
||||
} else {
|
||||
binding.scanStatusText.text = "Bad value: $str"
|
||||
|
@ -632,8 +626,8 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
|
||||
binding.lsSleepEditText.on(EditorInfo.IME_ACTION_DONE) {
|
||||
val str = binding.lsSleepEditText.text.toString()
|
||||
var n = str.toIntOrNull()
|
||||
if (n != null && n < 100000 && n >= 0) {
|
||||
val n = str.toIntOrNull()
|
||||
if (n != null && n < MAX_INT_DEVICE && n >= 0) {
|
||||
model.lsSleepSecs = n
|
||||
} else {
|
||||
binding.scanStatusText.text = "Bad value: $str"
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="Broadcast position period (minutes), 0 - disable"
|
||||
android:hint="@string/broadcast_position_secs"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/warningNotPaired">
|
||||
|
@ -170,7 +170,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="Sleep period, secs"
|
||||
android:hint="@string/ls_sleep_secs"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/positionBroadcastPeriodView">
|
||||
|
|
Ładowanie…
Reference in New Issue