diff --git a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt
index 24291bf24..704975a31 100644
--- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt
+++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt
@@ -14,6 +14,7 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.RemoteException
+import android.util.Patterns
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -24,6 +25,7 @@ import android.widget.RadioButton
import android.widget.TextView
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
+import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.asLiveData
@@ -455,6 +457,27 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
}
}
+ private fun addManualDeviceButton() {
+ val b = binding.radioButtonManual
+ val e = binding.editManualAddress
+
+ b.isEnabled = false
+
+ binding.deviceRadioGroup.addView(b)
+
+
+ b.setOnClickListener {
+
+
+ b.isChecked = onSelected(BTScanModel.DeviceListEntry("", "t" + e.text, true))
+
+ }
+ binding.deviceRadioGroup.addView(e)
+ e.doAfterTextChanged {
+ b.isEnabled = Patterns.IP_ADDRESS.matcher(e.text).matches()
+ }
+ }
+
private fun updateDevicesButtons(devices: MutableMap?) {
// Remove the old radio buttons and repopulate
binding.deviceRadioGroup.removeAllViews()
@@ -481,6 +504,8 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
}
}
+ addManualDeviceButton()
+
// get rid of the warning text once at least one device is paired.
// If we are running on an emulator, always leave this message showing so we can test the worst case layout
val curRadio = scanModel.selectedAddress
diff --git a/app/src/main/res/layout/settings_fragment.xml b/app/src/main/res/layout/settings_fragment.xml
index 2b0550d74..21e3b510e 100644
--- a/app/src/main/res/layout/settings_fragment.xml
+++ b/app/src/main/res/layout/settings_fragment.xml
@@ -109,6 +109,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test_devname2" />
+
+
+
+
+
Connected: %1$s of %2$s online
A list of nodes in the network
Update Firmware
+ IP Address:
Connected to radio
Connected to radio (%s)
Not connected