diff --git a/parts/AndroidManifest.xml b/parts/AndroidManifest.xml index 49811ff..cd917ce 100644 --- a/parts/AndroidManifest.xml +++ b/parts/AndroidManifest.xml @@ -48,7 +48,7 @@ + android:theme="@style/Theme.SubSettingsBase"> diff --git a/parts/res/layout/doze.xml b/parts/res/layout/doze.xml deleted file mode 100644 index 941cdf6..0000000 --- a/parts/res/layout/doze.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - diff --git a/parts/res/values/strings.xml b/parts/res/values/strings.xml index 476cdb7..0818968 100644 --- a/parts/res/values/strings.xml +++ b/parts/res/values/strings.xml @@ -15,6 +15,9 @@ limitations under the License. --> + + Use ambient display + Always on brightness %s mode is enabled diff --git a/parts/res/xml/doze_settings.xml b/parts/res/xml/doze_settings.xml index 01ef6c0..75710c3 100644 --- a/parts/res/xml/doze_settings.xml +++ b/parts/res/xml/doze_settings.xml @@ -15,7 +15,14 @@ See the License for the specific language governing permissions and limitations under the License. --> - + + + { - switchWidget.setChecked(!switchWidget.isChecked()); - mSwitchBar.setActivated(switchWidget.isChecked()); - }); - } - @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (DozeUtils.ALWAYS_ON_DISPLAY.equals(preference.getKey())) { @@ -184,12 +151,11 @@ public class DozeSettingsFragment extends PreferenceFragment } @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { + public void onSwitchChanged(Switch switchView, boolean isChecked) { DozeUtils.enableDoze(getActivity(), isChecked); DozeUtils.checkDozeService(getActivity()); - mTextView.setText(getString(isChecked ? R.string.switch_bar_on : R.string.switch_bar_off)); - mSwitchBar.setActivated(isChecked); + mSwitchBar.setChecked(isChecked); if (!isChecked) { DozeUtils.enableAlwaysOn(getActivity(), false); @@ -209,15 +175,6 @@ public class DozeSettingsFragment extends PreferenceFragment mPocketPreference.setEnabled(isChecked); } - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - getActivity().onBackPressed(); - return true; - } - return false; - } - private static class HelpDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { diff --git a/parts/src/org/lineageos/settings/doze/DozeUtils.java b/parts/src/org/lineageos/settings/doze/DozeUtils.java index eec61db..8d13cca 100644 --- a/parts/src/org/lineageos/settings/doze/DozeUtils.java +++ b/parts/src/org/lineageos/settings/doze/DozeUtils.java @@ -43,6 +43,7 @@ public final class DozeUtils { private static final String DOZE_INTENT = "com.android.systemui.doze.pulse"; + protected static final String DOZE_ENABLE = "doze_enable"; protected static final String ALWAYS_ON_DISPLAY = "always_on_display"; protected static final String DOZE_BRIGHTNESS_KEY = "doze_brightness"; protected static final String WAKE_ON_GESTURE_KEY = "wake_on_gesture";