From beb40362ad0f069102d9e6190c9aa1fb5a4d08e8 Mon Sep 17 00:00:00 2001 From: Al-Mothafar Al-Hasan Date: Sun, 12 Jul 2026 18:33:39 +0300 Subject: [PATCH] Home: move the threshold slider under the gauge and slim it down (#135) On the Mate 10 Pro home screen the critical/warning RangeSlider block sat at the bottom and ate vertical space, squeezing the scrollable details table. - Move the threshold block (slider + Critical/Warning captions) from the bottom section up to directly under the battery gauge it controls; the details table now gets the reclaimed room. IDs are unchanged, so MainActivity needs no edits. - Add a shared Widget.App.RangeSlider style (applied to both the home slider and the Settings BatteryRangeSliderPreference) so the two stay in sync. Material 1.14 defaults to tall bar thumbs and a tick dot per step (40 over 10-50), which looked noisy; the style hides ticks and the end stop-indicators, uses a compact round thumb snug to the track, and drops the floating value bubble (the captions already show the values). - Remove the redundant "Battery Alert Levels" title from Settings (the category header already labels it) and delete the now-unused battery_range_title string (en + ar); shrink the captions and tuck them closer to the slider. - Balance the gauge box: the CircularProgressBar is a square taller than the bottom-open horseshoe, so the old +10/-10 margins left more space above the arc than below. Retune the top margin so top/bottom spacing matches. Co-Authored-By: Claude Opus 4.8 --- app/src/main/res/layout/activity_main.xml | 64 ++++++++++--------- .../preference_battery_range_slider.xml | 24 +++---- app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - app/src/main/res/values/styles.xml | 16 +++++ app/src/main/res/xml/pref_general.xml | 1 - 6 files changed, 59 insertions(+), 48 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 1445b9b..b1ee3fe 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -39,53 +39,37 @@ android:layout_height="160dp" tools:cpb_subtitle="subtitle" tools:cpb_title="Title" - android:layout_marginTop="10dp" + android:layout_marginTop="-2dp" android:layout_marginBottom="-10dp" /> - - - + - - - + android:paddingTop="4dp" + android:paddingBottom="4dp"> + android:valueTo="50" /> + + + + + + + - - + android:paddingTop="8dp" + android:paddingBottom="8dp"> + android:valueTo="50" /> @@ -56,7 +48,7 @@ android:layout_weight="1" android:gravity="end" android:textColor="@color/circular_progress_default_progress_warning" - android:textSize="13sp" + android:textSize="12sp" android:textStyle="bold" tools:text="Warning 40%" /> diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 7555a55..8fdd466 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -56,7 +56,6 @@ المستوى الحرج يبدأ من - مستويات تنبيه البطارية حرج %1$d%% تحذير %1$d%% حرج %1$d%% • تحذير %2$d%% diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 54d04d0..39afde8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -58,7 +58,6 @@ Critical Level Start From - Battery Alert Levels Critical %1$d%% Warning %1$d%% Critical %1$d%% • Warning %2$d%% diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d4a66c3..4f54e0c 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -67,4 +67,20 @@ 64dp 1 + + + diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index 3fa2a60..8b8fad9 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -38,7 +38,6 @@