aboutsummaryrefslogtreecommitdiff
path: root/doze
diff options
context:
space:
mode:
Diffstat (limited to 'doze')
-rw-r--r--doze/Android.mk2
-rw-r--r--doze/res/drawable/ic_settings_doze.xml51
-rw-r--r--doze/res/drawable/switchbar_background.xml3
-rw-r--r--doze/res/layout/switch_bar.xml4
-rw-r--r--doze/res/values/colors.xml23
-rw-r--r--doze/res/values/styles.xml41
-rw-r--r--doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java20
-rw-r--r--doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java13
8 files changed, 53 insertions, 104 deletions
diff --git a/doze/Android.mk b/doze/Android.mk
index cef3610..520a79e 100644
--- a/doze/Android.mk
+++ b/doze/Android.mk
@@ -30,8 +30,6 @@ LOCAL_AAPT_FLAGS := --auto-add-overlay \
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-include frameworks/base/packages/SettingsLib/common.mk
-
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/doze/res/drawable/ic_settings_doze.xml b/doze/res/drawable/ic_settings_doze.xml
deleted file mode 100644
index 8386024..0000000
--- a/doze/res/drawable/ic_settings_doze.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="64dp"
- android:height="64dp"
- android:viewportWidth="64"
- android:viewportHeight="64">
-
- <group
- android:translateY="-988.583">
- <path
- android:fillColor="@android:color/white"
- android:pathData="M15.0133
-1051.24c-1.3615-0.2479-2.37425-1.2789-2.57968-2.6262-0.06554-0.4298-0.06571-55.8484-0.00018-56.28
-0.09875-0.65024 0.367851-1.20544 0.812983-1.6773 0.402211-0.42637
-0.920053-0.7356 1.49909-0.8952l0.299302-0.0825h16.845 16.845l0.291174
-0.0804c1.24697 0.34447 2.13039 1.32473 2.32019 2.57456 0.06515 0.42898 0.06541
-55.8484 0.0003 56.28-0.188067 1.2461-1.07608 2.2305-2.32306 2.5752l-0.288567
-0.08h-16.755c-13.5267 0-16.7958
-0-16.9665-0.034zm29.8065-31.1862v-19.23h-12.99-12.99v19.23 19.23h12.99
-12.99v-19.23zm-13.459
-11.687c-1.03547-0.2354-1.77837-1.1208-1.83292-2.1845l-0.01654-0.3225h1.87175c1.02946
-0 2.10645 0.01 2.3933 0.02l0.521553 0.02-0.01945 0.253c-0.02847 0.3705-0.09559
-0.6134-0.267159 0.9672-0.135477 0.2794-0.18522 0.3474-0.439626 0.6013-0.31197
-0.3114-0.571617 0.4707-0.976866 0.5995-0.269196 0.085-0.949163 0.111-1.23404
-0.046zm-9.04096-4.1842v-0.6872l1.10534-1.0831 1.10534-1.0831
-0.02483-1.2072c0.01366-0.664 0.02781-2.213 0.03145-3.4422 0.007-2.3727
-0.01776-2.5909 0.162279-3.3 0.234013-1.1483 0.861931-2.2993 1.7263-3.1643
-0.762874-0.7634 1.91951-1.4813 3.00204-1.8633 0.262572-0.093 0.512691-0.1813
-0.555819-0.1969l0.07842-0.029 0.01577-0.426c0.01284-0.3469 0.03018-0.4706
-0.09332-0.666 0.197394-0.6109 0.642609-1.0525 1.21018-1.2004 0.365688-0.095
-0.860153-0.043 1.2089 0.1282 0.234414 0.1149 0.589851 0.4783 0.725931 0.7422
-0.171483 0.3325 0.207933 0.491 0.225975 0.9825 0.01148 0.3126 0.02671 0.4425
-0.0519 0.4425 0.01961 0 0.2844 0.088 0.588423 0.1954 2.74734 0.9715 4.21726
-2.7794 4.71985 5.805 0.171696 1.0336 0.211308 1.7926 0.259098 4.9646l0.03345
-2.22 1.10911 1.095 1.1091 1.095-0.0014 0.6825-0.0014 0.6825h-9.57-9.57v-0.6872z" />
- </group>
-</vector>
diff --git a/doze/res/drawable/switchbar_background.xml b/doze/res/drawable/switchbar_background.xml
index 45f1578..314ed12 100644
--- a/doze/res/drawable/switchbar_background.xml
+++ b/doze/res/drawable/switchbar_background.xml
@@ -16,6 +16,5 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
- <item android:drawable="@color/switch_bar_background" />
+ <item android:drawable="?android:attr/colorSecondary" />
</ripple>
-
diff --git a/doze/res/layout/switch_bar.xml b/doze/res/layout/switch_bar.xml
index d25948b..7199174 100644
--- a/doze/res/layout/switch_bar.xml
+++ b/doze/res/layout/switch_bar.xml
@@ -33,7 +33,7 @@
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@android:style/TextAppearance.Material.Title"
- android:textColor="?android:attr/textColorPrimaryInverse"
+ android:textColor="?android:attr/textColorPrimary"
android:textAlignment="viewStart" />
<Switch
@@ -42,6 +42,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@null"
- android:theme="@style/ThemeOverlay.SwitchBar" />
+ android:theme="@style/Theme.Main.SwitchBar" />
</LinearLayout>
diff --git a/doze/res/values/colors.xml b/doze/res/values/colors.xml
deleted file mode 100644
index d598598..0000000
--- a/doze/res/values/colors.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2010, 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.
- */
--->
-<resources>
- <color name="switch_bar_background">#ff37474f</color>
- <color name="switch_accent_color">#ff7fcac3</color>
- <color name="system_secondary_color">#ff37474F</color>
-</resources>
diff --git a/doze/res/values/styles.xml b/doze/res/values/styles.xml
index f64a2b8..082e53c 100644
--- a/doze/res/values/styles.xml
+++ b/doze/res/values/styles.xml
@@ -15,16 +15,43 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="Theme.Main" parent="@android:style/Theme.Material.Settings">
- <item name="preferenceTheme">@android:style/Theme.Material.Settings</item>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <style name="Theme.Main" parent="@android:style/Theme.DeviceDefault.Settings">
+ <item name="dialogPreferenceStyle">@style/Theme.Main.DialogPreferenceStyle</item>
+ <item name="preferenceCategoryStyle">@style/Theme.Main.PreferenceCategoryStyle</item>
+ <item name="preferenceFragmentStyle">@style/Theme.Main.PreferenceFragmentStyle</item>
+ <item name="preferenceStyle">@style/Theme.Main.PreferenceStyle</item>
+ <item name="preferenceTheme">@style/Theme.Main.PreferenceTheme</item>
+ <item name="switchPreferenceStyle">@style/Theme.Main.SwitchPreferenceStyle</item>
</style>
- <style name="ThemeOverlay.SwitchBar" parent="@android:style/ThemeOverlay">
- <item name="android:colorAccent">@color/switch_accent_color</item>
+ <style name="Theme.Main.DialogPreferenceStyle" parent="@style/Theme.Main.PreferenceStyle">
</style>
- <style name="ThemeOverlay.SwitchBar.Secondary" parent="@android:style/ThemeOverlay">
- <item name="android:colorAccent">@color/system_secondary_color</item>
+ <style name="Theme.Main.PreferenceCategoryStyle" parent="@*android:style/Preference.DeviceDefault.Category">
+ <item name="allowDividerAbove">true</item>
+ <item name="allowDividerBelow">true</item>
+ <item name="android:layout">@layout/preference_category_material_settings</item>
+ </style>
+
+ <style name="Theme.Main.PreferenceFragmentStyle" parent="@*android:style/PreferenceFragment.Material">
+ <item name="allowDividerAfterLastItem">false</item>
+ </style>
+
+ <style name="Theme.Main.PreferenceStyle" parent="@*android:style/Preference.DeviceDefault">
+ <item name="allowDividerAbove">false</item>
+ <item name="allowDividerBelow">true</item>
+ <item name="singleLineTitle">false</item>
+ <item name="android:layout">@layout/preference_material_settings</item>
+ </style>
+
+ <style name="Theme.Main.PreferenceTheme">
+ </style>
+
+ <style name="Theme.Main.SwitchPreferenceStyle" parent="@style/Theme.Main.PreferenceStyle">
+ <item name="widgetLayout">@*android:layout/preference_widget_switch</item>
+ </style>
+
+ <style name="Theme.Main.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
</style>
</resources>
diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java b/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java
index 347c57c..1591b2c 100644
--- a/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java
+++ b/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java
@@ -18,11 +18,9 @@
package org.lineageos.settings.doze;
import android.os.Bundle;
-import android.view.MenuItem;
+import android.preference.PreferenceActivity;
-import com.android.settingslib.drawer.SettingsDrawerActivity;
-
-public class DozeSettingsActivity extends SettingsDrawerActivity {
+public class DozeSettingsActivity extends PreferenceActivity {
private static final String TAG_DOZE = "doze";
@@ -30,19 +28,7 @@ public class DozeSettingsActivity extends SettingsDrawerActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.doze);
- getActionBar().setDisplayHomeAsUpEnabled(true);
- getFragmentManager().beginTransaction().replace(R.id.content_frame,
+ getFragmentManager().beginTransaction().replace(android.R.id.content,
new DozeSettingsFragment(), TAG_DOZE).commit();
}
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- onBackPressed();
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
}
diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java
index 9d456a8..14c4c92 100644
--- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java
+++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java
@@ -17,6 +17,7 @@
package org.lineageos.settings.doze;
+import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -33,6 +34,7 @@ import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
@@ -51,6 +53,8 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.doze_settings);
+ final ActionBar actionBar = getActivity().getActionBar();
+ actionBar.setDisplayHomeAsUpEnabled(true);
SharedPreferences prefs = getActivity().getSharedPreferences("doze_settings",
Activity.MODE_PRIVATE);
@@ -127,6 +131,15 @@ public class DozeSettingsFragment extends PreferenceFragment implements OnPrefer
mPocketPreference.setEnabled(b);
}
+ @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) {