OmniGears: cleanup unneeded and adjust to 8.1
for now make sure all custom prefs use left margin
Change-Id: Ice25876ad01a0da78bd820f554d670b2ae102adf
diff --git a/res/layout/preference_battery_light.xml b/res/layout/preference_battery_light.xml
index dd17dcd..02e7646 100644
--- a/res/layout/preference_battery_light.xml
+++ b/res/layout/preference_battery_light.xml
@@ -6,7 +6,8 @@
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:background="?android:attr/selectableItemBackground" >
+ android:background="?android:attr/selectableItemBackground"
+ android:layout_marginStart="56dp" >
<RelativeLayout
android:layout_width="wrap_content"
diff --git a/res/layout/seek_bar_preference.xml b/res/layout/seek_bar_preference.xml
index bd028cd..e73efd5 100644
--- a/res/layout/seek_bar_preference.xml
+++ b/res/layout/seek_bar_preference.xml
@@ -22,12 +22,13 @@
android:paddingEnd="?android:attr/scrollbarSize"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical"
- android:focusable="true" >
+ android:focusable="true"
+ android:layout_marginStart="60dp" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="15dip"
+ android:layout_marginStart="12dip"
android:layout_marginEnd="6dip"
android:layout_marginTop="10dip"
android:layout_marginBottom="6dip"
diff --git a/res/xml/display_rotation.xml b/res/xml/display_rotation.xml
index 4fee35b..6831c33 100644
--- a/res/xml/display_rotation.xml
+++ b/res/xml/display_rotation.xml
@@ -23,7 +23,7 @@
android:title="@string/accelerometer_title"
android:persistent="false" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="lockscreen_rotation"
android:title="@string/display_lockscreen_rotation_title"
android:dependency="accelerometer"
@@ -33,28 +33,28 @@
android:key="display_rotation_category"
android:title="@string/display_rotation_category_title" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="display_rotation_0"
android:title="@string/display_rotation_0_title"
android:layout="?android:attr/preferenceLayoutChild"
android:dependency="accelerometer"
android:persistent="false" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="display_rotation_90"
android:title="@string/display_rotation_90_title"
android:layout="?android:attr/preferenceLayoutChild"
android:dependency="accelerometer"
android:persistent="false" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="display_rotation_180"
android:title="@string/display_rotation_180_title"
android:layout="?android:attr/preferenceLayoutChild"
android:dependency="accelerometer"
android:persistent="false" />
- <CheckBoxPreference
+ <SwitchPreference
android:key="display_rotation_270"
android:title="@string/display_rotation_270_title"
android:layout="?android:attr/preferenceLayoutChild"
diff --git a/res/xml/global_actions.xml b/res/xml/global_actions.xml
index 579dc0e..2748338 100644
--- a/res/xml/global_actions.xml
+++ b/res/xml/global_actions.xml
@@ -28,14 +28,7 @@
android:title="@string/global_actions_advanced_reboot_title"
android:summary="@string/global_actions_advanced_reboot_summary_new"
android:defaultValue="false" />
- <ListPreference
- android:key="power_menu_animations"
- android:title="@string/power_menu_animation_title"
- android:dialogTitle="@string/power_menu_animation_dialog_title"
- android:entries="@array/power_menu_animations_entries"
- android:entryValues="@array/power_menu_animations_values"
- android:summary="@string/power_menu_animation_summary"
- android:persistent="false" />
+
<org.omnirom.omnigears.preference.SecureSettingSwitchPreference
android:key="lockscreen_power_menu_disabled"
android:title="@string/lockscreen_power_menu_disabled_title"
diff --git a/src/org/omnirom/omnigears/ButtonBrightnessSettings.java b/src/org/omnirom/omnigears/ButtonBrightnessSettings.java
index a308457..d4870b8 100644
--- a/src/org/omnirom/omnigears/ButtonBrightnessSettings.java
+++ b/src/org/omnirom/omnigears/ButtonBrightnessSettings.java
@@ -25,8 +25,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
-import android.os.IPowerManager;
-import android.os.ServiceManager;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
@@ -68,7 +66,6 @@
private static final String KEY_BUTTON_MANUAL_BRIGHTNESS_NEW = "button_manual_brightness_new";
private static final String KEY_BUTTON_TIMEOUT = "button_timeout";
- private IPowerManager mPowerService;
private SeekBarPreference mButtonTimoutBar;
private SeekBarPreference mManualButtonBrightness;
@@ -99,8 +96,6 @@
Settings.System.BUTTON_BACKLIGHT_TIMEOUT, 0);
mButtonTimoutBar.setValue(currentTimeout);
mButtonTimoutBar.setOnPreferenceChangeListener(this);
-
- mPowerService = IPowerManager.Stub.asInterface(ServiceManager.getService("power"));
}
@Override
diff --git a/src/org/omnirom/omnigears/DisplayRotation.java b/src/org/omnirom/omnigears/DisplayRotation.java
index 3f4a981..1f6084b 100644
--- a/src/org/omnirom/omnigears/DisplayRotation.java
+++ b/src/org/omnirom/omnigears/DisplayRotation.java
@@ -21,7 +21,6 @@
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v7.preference.CheckBoxPreference;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
@@ -53,11 +52,11 @@
private static final String ROTATION_270_PREF = "display_rotation_270";
private SwitchPreference mAccelerometer;
- private CheckBoxPreference mLockScreenRotationPref;
- private CheckBoxPreference mRotation0Pref;
- private CheckBoxPreference mRotation90Pref;
- private CheckBoxPreference mRotation180Pref;
- private CheckBoxPreference mRotation270Pref;
+ private SwitchPreference mLockScreenRotationPref;
+ private SwitchPreference mRotation0Pref;
+ private SwitchPreference mRotation90Pref;
+ private SwitchPreference mRotation180Pref;
+ private SwitchPreference mRotation270Pref;
public static final int ROTATION_0_MODE = 1;
public static final int ROTATION_90_MODE = 2;
@@ -85,11 +84,11 @@
PreferenceScreen prefSet = getPreferenceScreen();
mAccelerometer = (SwitchPreference) findPreference(KEY_ACCELEROMETER);
- mLockScreenRotationPref = (CheckBoxPreference) prefSet.findPreference(LOCKSCREEN_ROTATION);
- mRotation0Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_0_PREF);
- mRotation90Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_90_PREF);
- mRotation180Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_180_PREF);
- mRotation270Pref = (CheckBoxPreference) prefSet.findPreference(ROTATION_270_PREF);
+ mLockScreenRotationPref = (SwitchPreference) prefSet.findPreference(LOCKSCREEN_ROTATION);
+ mRotation0Pref = (SwitchPreference) prefSet.findPreference(ROTATION_0_PREF);
+ mRotation90Pref = (SwitchPreference) prefSet.findPreference(ROTATION_90_PREF);
+ mRotation180Pref = (SwitchPreference) prefSet.findPreference(ROTATION_180_PREF);
+ mRotation270Pref = (SwitchPreference) prefSet.findPreference(ROTATION_270_PREF);
int allowAllRotations = getResources().
getBoolean(com.android.internal.R.bool.config_allowAllRotations) ? 1 : 0;
diff --git a/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java b/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java
index cbfe752..10ddc50 100644
--- a/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java
@@ -51,9 +51,7 @@
public class GlobalActionsSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener, Indexable {
private static final String TAG = "GlobalActionsSettings";
- private static final String POWER_MENU_ANIMATIONS = "power_menu_animations";
- private ListPreference mPowerMenuAnimations;
private SecureSettingSwitchPreference mAdvancedReboot;
@Override
@@ -69,12 +67,6 @@
final PreferenceScreen prefScreen = getPreferenceScreen();
final ContentResolver contentResolver = getContext().getContentResolver();
- mPowerMenuAnimations = (ListPreference) findPreference(POWER_MENU_ANIMATIONS);
- mPowerMenuAnimations.setValue(String.valueOf(Settings.System.getInt(
- getContentResolver(), Settings.System.POWER_MENU_ANIMATIONS, 0)));
- mPowerMenuAnimations.setSummary(mPowerMenuAnimations.getEntry());
- mPowerMenuAnimations.setOnPreferenceChangeListener(this);
-
mAdvancedReboot = (SecureSettingSwitchPreference)
findPreference(Settings.Secure.ADVANCED_REBOOT);
mAdvancedReboot.setOnPreferenceChangeListener(this);
@@ -88,15 +80,7 @@
@Override
public boolean onPreferenceChange(Preference preference, Object objValue) {
boolean result = false;
- if (preference instanceof ListPreference) {
- if (preference == mPowerMenuAnimations) {
- Settings.System.putInt(getContentResolver(), Settings.System.POWER_MENU_ANIMATIONS,
- Integer.valueOf((String) objValue));
- mPowerMenuAnimations.setValue(String.valueOf(objValue));
- mPowerMenuAnimations.setSummary(mPowerMenuAnimations.getEntry());
- return true;
- }
- } else if (preference instanceof SecureSettingSwitchPreference) {
+ if (preference instanceof SecureSettingSwitchPreference) {
if (preference == mAdvancedReboot) {
boolean value = (Boolean) objValue;
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADVANCED_REBOOT,