From 8330d437f89b8c0cdec11370ba1292ffe19532fb Mon Sep 17 00:00:00 2001 From: Joey Date: Fri, 28 Dec 2018 11:33:30 +0100 Subject: wayne-common: doze: Match Pie settings UI Change-Id: Ia1cde37923c55faf057189f7085b69522e2802ef Signed-off-by: PIPIPIG233666 <2212848813@qq.com> --- doze/res/color/switch_bar_bg.xml | 20 ++++++++++++++++++++ doze/res/color/switchbar_switch_thumb_tint.xml | 20 ++++++++++++++++++++ doze/res/color/switchbar_switch_track_tint.xml | 21 +++++++++++++++++++++ doze/res/drawable/switchbar_background.xml | 10 +++++----- doze/res/layout/switch_bar.xml | 7 ++++--- doze/res/values/styles.xml | 5 +++++ .../settings/doze/DozeSettingsFragment.java | 12 +++++++++--- 7 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 doze/res/color/switch_bar_bg.xml create mode 100644 doze/res/color/switchbar_switch_thumb_tint.xml create mode 100644 doze/res/color/switchbar_switch_track_tint.xml (limited to 'doze') diff --git a/doze/res/color/switch_bar_bg.xml b/doze/res/color/switch_bar_bg.xml new file mode 100644 index 0000000..ba2dae1 --- /dev/null +++ b/doze/res/color/switch_bar_bg.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/doze/res/color/switchbar_switch_thumb_tint.xml b/doze/res/color/switchbar_switch_thumb_tint.xml new file mode 100644 index 0000000..d4bf9b3 --- /dev/null +++ b/doze/res/color/switchbar_switch_thumb_tint.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/doze/res/color/switchbar_switch_track_tint.xml b/doze/res/color/switchbar_switch_track_tint.xml new file mode 100644 index 0000000..ae45c7a --- /dev/null +++ b/doze/res/color/switchbar_switch_track_tint.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/doze/res/drawable/switchbar_background.xml b/doze/res/drawable/switchbar_background.xml index 314ed12..f210707 100644 --- a/doze/res/drawable/switchbar_background.xml +++ b/doze/res/drawable/switchbar_background.xml @@ -1,5 +1,5 @@ - - - - + + + diff --git a/doze/res/layout/switch_bar.xml b/doze/res/layout/switch_bar.xml index 7199174..9e11a0a 100644 --- a/doze/res/layout/switch_bar.xml +++ b/doze/res/layout/switch_bar.xml @@ -29,11 +29,12 @@ android:layout_width="0dp" android:layout_weight="1" android:layout_gravity="center_vertical" - android:paddingStart="48dp" + android:paddingStart="56dp" android:maxLines="2" android:ellipsize="end" android:textAppearance="@android:style/TextAppearance.Material.Title" - android:textColor="?android:attr/textColorPrimary" + android:textColor="@android:color/white" + android:textSize="18sp" android:textAlignment="viewStart" /> + android:theme="@style/Theme.Main.SwitchBar.Switch" /> diff --git a/doze/res/values/styles.xml b/doze/res/values/styles.xml index 082e53c..3443c0b 100644 --- a/doze/res/values/styles.xml +++ b/doze/res/values/styles.xml @@ -54,4 +54,9 @@ + + diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java index 3770b5e..fd1756e 100644 --- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java +++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java @@ -43,6 +43,7 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer CompoundButton.OnCheckedChangeListener { private TextView mTextView; + private View mSwitchBar; private SwitchPreference mPickUpPreference; private SwitchPreference mHandwavePreference; @@ -101,11 +102,15 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer mTextView.setText(getString(dozeEnabled ? R.string.switch_bar_on : R.string.switch_bar_off)); - View switchBar = view.findViewById(R.id.switch_bar); - Switch switchWidget = switchBar.findViewById(android.R.id.switch_widget); + mSwitchBar = view.findViewById(R.id.switch_bar); + Switch switchWidget = mSwitchBar.findViewById(android.R.id.switch_widget); switchWidget.setChecked(dozeEnabled); switchWidget.setOnCheckedChangeListener(this); - switchBar.setOnClickListener(v -> switchWidget.setChecked(!switchWidget.isChecked())); + mSwitchBar.setActivated(dozeEnabled); + mSwitchBar.setOnClickListener(v -> { + switchWidget.setChecked(!switchWidget.isChecked()); + mSwitchBar.setActivated(switchWidget.isChecked()); + }); } @Override @@ -121,6 +126,7 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer Utils.checkDozeService(getActivity()); mTextView.setText(getString(isChecked ? R.string.switch_bar_on : R.string.switch_bar_off)); + mSwitchBar.setActivated(isChecked); mPickUpPreference.setEnabled(isChecked); mHandwavePreference.setEnabled(isChecked); -- cgit v1.2.3