diff options
author | Joey <joey@lineageos.org> | 2018-12-28 11:33:30 +0100 |
---|---|---|
committer | Isaac Chen <tingyi364@gmail.com> | 2019-08-13 12:17:46 +0200 |
commit | 8330d437f89b8c0cdec11370ba1292ffe19532fb (patch) | |
tree | 55c63182380ff5a9f57aec9a7ed5b43134b087ef /doze/src | |
parent | fe88f9cab1c0210c6c0a392b59a56cf45a4191ca (diff) |
wayne-common: doze: Match Pie settings UI
Change-Id: Ia1cde37923c55faf057189f7085b69522e2802ef
Signed-off-by: PIPIPIG233666 <2212848813@qq.com>
Diffstat (limited to 'doze/src')
-rw-r--r-- | doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java | 12 |
1 files changed, 9 insertions, 3 deletions
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); |