From 705e0deae3470e2571b5ce6d2f64348035e40677 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 11 Feb 2021 13:37:51 +0800 Subject: [PATCH 1/6] make settings layout work on even the tiniest of screens --- .../geeksville/mesh/ui/SettingsFragment.kt | 5 +- app/src/main/res/layout/settings_fragment.xml | 353 +++++++++--------- 2 files changed, 183 insertions(+), 175 deletions(-) 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 decfa6fed..a582d3c5c 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt @@ -745,8 +745,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { val hasBonded = RadioInterfaceService.getBondedDeviceAddress(requireContext()) != null - // get rid of the warning text once at least one device is paired - binding.warningNotPaired.visibility = if (hasBonded) View.GONE else View.VISIBLE + // 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 + binding.warningNotPaired.visibility = if (hasBonded && !RadioInterfaceService.isMockInterfaceAvailable(requireContext())) View.GONE else View.VISIBLE } /// Setup the GUI to do a classic (pre SDK 26 BLE scan) diff --git a/app/src/main/res/layout/settings_fragment.xml b/app/src/main/res/layout/settings_fragment.xml index 7f6e135f2..45a7b535c 100644 --- a/app/src/main/res/layout/settings_fragment.xml +++ b/app/src/main/res/layout/settings_fragment.xml @@ -1,192 +1,199 @@ - + android:layout_height="match_parent" + android:fillViewport="true" + tools:context=".MainActivity"> - + - - - - - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:autoLink="web" + android:ems="10" + android:gravity="start|top" + android:text="@string/warning_not_paired" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/deviceRadioGroup" /> - - - - - - - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:hint="@string/your_name" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + + + + - + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="8dp" + android:text="@string/looking_for_meshtastic_devices" + app:layout_constraintEnd_toStartOf="@+id/updateFirmwareButton" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/usernameView" /> - - -