kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
bt scan kinda works again
rodzic
fb06046796
commit
e7705c83ed
|
@ -241,10 +241,20 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
scanModel.errorText.observe(viewLifecycleOwner, Observer { errMsg ->
|
||||
if (errMsg != null) {
|
||||
scanStatusText.text = errMsg
|
||||
}
|
||||
})
|
||||
|
||||
scanModel.devices.observe(viewLifecycleOwner, Observer { devices ->
|
||||
// Remove the old radio buttons and repopulate
|
||||
deviceRadioGroup.removeAllViews()
|
||||
|
||||
var hasBonded = false // Have any of our devices been bonded
|
||||
devices.values.forEach { device ->
|
||||
hasBonded = hasBonded || device.bonded
|
||||
|
||||
val b = RadioButton(requireActivity())
|
||||
b.text = device.name
|
||||
b.id = View.generateViewId()
|
||||
|
@ -257,6 +267,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
b.isChecked = scanModel.onSelected(device)
|
||||
}
|
||||
}
|
||||
|
||||
// get rid of the warning text once at least one device is paired
|
||||
warningNotPaired.visibility = if (hasBonded) View.GONE else View.VISIBLE
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
|
@ -16,17 +16,19 @@
|
|||
android:text="@string/warning_not_paired"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInputLayout2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="@string/your_name"
|
||||
app:layout_constraintEnd_toEndOf="@+id/warningNotPaired"
|
||||
app:layout_constraintStart_toStartOf="@+id/warningNotPaired"
|
||||
app:layout_constraintTop_toBottomOf="@+id/warningNotPaired">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
|
@ -82,7 +84,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:checked="true"
|
||||
android:text="@string/analytics_okay"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
Ładowanie…
Reference in New Issue