mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
testing settings
This commit is contained in:
parent
599f92908c
commit
0ea40967ac
2 changed files with 36 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ import com.geeksville.android.Logging
|
|||
import com.geeksville.android.hideKeyboard
|
||||
import com.geeksville.android.isGooglePlayAvailable
|
||||
import com.geeksville.mesh.MainActivity
|
||||
import com.geeksville.mesh.MeshProtos
|
||||
import com.geeksville.mesh.R
|
||||
import com.geeksville.mesh.android.bluetoothManager
|
||||
import com.geeksville.mesh.android.usbManager
|
||||
|
|
@ -603,6 +604,26 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
requireActivity().hideKeyboard()
|
||||
}
|
||||
|
||||
binding.positionBroadcastPeriodEditText.on(EditorInfo.IME_ACTION_DONE) {
|
||||
val n = binding.positionBroadcastPeriodEditText.text.toString().toIntOrNull()
|
||||
debug("did IME action, text = ${binding.positionBroadcastPeriodEditText.text.toString()}, int=$n")
|
||||
val meshService = model.meshService
|
||||
if (n != null && meshService != null) {
|
||||
try {
|
||||
var config: MeshProtos.RadioConfig =
|
||||
MeshProtos.RadioConfig.parseFrom(meshService.getRadioConfig())
|
||||
val builder : MeshProtos.RadioConfig.Builder = config.toBuilder()
|
||||
builder.preferencesBuilder.setPositionBroadcastSecs(n * 60)
|
||||
builder.preferencesBuilder.setLsSecs(n * 60)
|
||||
config = builder.build()
|
||||
debug("config=${config.toString()}")
|
||||
meshService.setRadioConfig(config.toByteArray())
|
||||
} catch (ex: RemoteException) {
|
||||
errormsg("Can't change parameter, is device offline? ${ex.message}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
val app = (requireContext().applicationContext as GeeksvilleApplication)
|
||||
|
||||
// Set analytics checkbox
|
||||
|
|
|
|||
|
|
@ -19,6 +19,19 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/positionBroadcastPeriodEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:text="9000"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/warningNotPaired" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/usernameView"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -37,6 +50,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionDone"
|
||||
android:singleLine="true" />
|
||||
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue