Adjust Battery Saver percentage slide size (sync from ag/13330588)
Screenshots:
https://screenshot.googleplex.com/72qRevtZXA4PTcg.png
https://screenshot.googleplex.com/3rJjDRehdsPL8AQ.png
Bug: 157532287
Bug: 202295741
Test: make SettingsGoogleRoboTests
Merged-In: Ia4453261c22919e325a971237efc79b4887362ec
Change-Id: I09fe6fe3de6da45959ee0babbd34202340ec661d
diff --git a/res/layout/battery_saver_schedule_percentage_seekbar.xml b/res/layout/battery_saver_schedule_percentage_seekbar.xml
new file mode 100644
index 0000000..7862822
--- /dev/null
+++ b/res/layout/battery_saver_schedule_percentage_seekbar.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Layout used by BatterySaverScheduleSeekBarController for the seekbar widget. -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginVertical="6dp"
+ android:gravity="center_vertical"
+ android:orientation="vertical"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="marquee"
+ android:layout_marginStart="18dp"
+ android:singleLine="true"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
+ android:textColor="?android:attr/textColorPrimary" />
+
+ <com.android.settings.widget.DefaultIndicatorSeekBar
+ android:id="@*android:id/seekbar"
+ style="@android:style/Widget.Material.SeekBar.Discrete"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:layout_marginStart="18dp"
+ android:layout_marginEnd="9dp" />
+
+</LinearLayout>
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java
index 173d946..52f52bc 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java
@@ -55,7 +55,7 @@
public BatterySaverScheduleSeekBarController(Context context) {
mContext = context;
mSeekBarPreference = new SeekBarPreference(context);
- mSeekBarPreference.setLayoutResource(R.layout.preference_widget_seekbar_settings);
+ mSeekBarPreference.setLayoutResource(R.layout.battery_saver_schedule_percentage_seekbar);
mSeekBarPreference.setIconSpaceReserved(false);
mSeekBarPreference.setOnPreferenceChangeListener(this);
mSeekBarPreference.setContinuousUpdates(true);