Omnigears: Disable unimplemented settings
Change-Id: I41013d57808e40ca48666e93c86e311cb995d025
diff --git a/res/xml/ambient_settings.xml b/res/xml/ambient_settings.xml
index 729c881..5b3759c 100644
--- a/res/xml/ambient_settings.xml
+++ b/res/xml/ambient_settings.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The OmniROM Project
This program is free software: you can redistribute it and/or modify
@@ -13,13 +13,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
+-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/doze_title"
settings:keywords="@string/doze_title">
-
+<!--
<SwitchPreference
android:key="doze"
android:title="@string/doze_title"
@@ -107,4 +107,5 @@
android:persistent="false"
android:dependency="doze" />
</PreferenceCategory>
+-->
</PreferenceScreen>
diff --git a/res/xml/bars_settings.xml b/res/xml/bars_settings.xml
index c9f192a..31f9ca0 100644
--- a/res/xml/bars_settings.xml
+++ b/res/xml/bars_settings.xml
@@ -13,11 +13,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
+<!--
<PreferenceCategory
android:key="category_statusbar"
android:title="@string/statusbar_title">
@@ -47,8 +46,9 @@
android:targetPackage="com.android.systemui"
android:targetClass="com.android.systemui.tuner.StatusBarActivity" />
</PreferenceScreen>
-
+-->
<!-- Network traffic meter -->
+<!--
<PreferenceScreen
android:key="category_network_traffic"
android:title="@string/network_traffic_title"
@@ -111,4 +111,5 @@
android:targetClass="com.android.systemui.tuner.QsTunerActivity" />
</PreferenceScreen>
</PreferenceCategory>
+-->
</PreferenceScreen>
diff --git a/res/xml/button_brightness_settings.xml b/res/xml/button_brightness_settings.xml
index 561ed0d..6475d9e 100644
--- a/res/xml/button_brightness_settings.xml
+++ b/res/xml/button_brightness_settings.xml
@@ -13,11 +13,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
+<!--
<SwitchPreference
android:key="button_backlight_enable"
android:title="@string/button_backlight_enable_title"
@@ -46,4 +45,5 @@
settings:unitsRight="@string/unit_sec"
android:persistent="false"
android:dependency="button_backlight_enable" />
+-->
</PreferenceScreen>
diff --git a/res/xml/network_traffic.xml b/res/xml/network_traffic.xml
index c0d9cee..0f45550 100644
--- a/res/xml/network_traffic.xml
+++ b/res/xml/network_traffic.xml
@@ -13,13 +13,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="category_network_traffic"
android:title="@string/network_traffic_title">
-
+<!--
<ListPreference
android:key="network_traffic_state"
android:title="@string/show_network_traffic_state"
@@ -57,4 +56,5 @@
android:dependency="network_traffic_autohide"
android:persistent="false" />
+-->
</PreferenceScreen>
diff --git a/res/xml/statusbar_battery_settings.xml b/res/xml/statusbar_battery_settings.xml
index 0eb7c13..5b52e5a 100644
--- a/res/xml/statusbar_battery_settings.xml
+++ b/res/xml/statusbar_battery_settings.xml
@@ -13,11 +13,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
+-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
+<!--
<ListPreference
android:key="statusbar_battery_enable"
android:title="@string/battery_enable_title"
@@ -66,4 +65,5 @@
android:dependency ="statusbar_battery_charging_color_enable"/>
</PreferenceCategory>
+-->
</PreferenceScreen>
diff --git a/src/org/omnirom/omnigears/AmbientSettings.java b/src/org/omnirom/omnigears/AmbientSettings.java
index 4814e6a..ef831a7 100644
--- a/src/org/omnirom/omnigears/AmbientSettings.java
+++ b/src/org/omnirom/omnigears/AmbientSettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -512,4 +511,4 @@
return result;
}
};
-}
+}*/
diff --git a/src/org/omnirom/omnigears/ButtonBrightnessSettings.java b/src/org/omnirom/omnigears/ButtonBrightnessSettings.java
index 3d91713..d965e37 100644
--- a/src/org/omnirom/omnigears/ButtonBrightnessSettings.java
+++ b/src/org/omnirom/omnigears/ButtonBrightnessSettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.brightness;
@@ -146,4 +145,4 @@
return true;
}
}
-
+*/
diff --git a/src/org/omnirom/omnigears/ButtonSettings.java b/src/org/omnirom/omnigears/ButtonSettings.java
index 9216ea0..b19d1c7 100644
--- a/src/org/omnirom/omnigears/ButtonSettings.java
+++ b/src/org/omnirom/omnigears/ButtonSettings.java
@@ -14,22 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
-/*
- * Copyright (C) 2013 The CyanogenMod 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.
- */
package org.omnirom.omnigears;
import android.content.ContentResolver;
@@ -898,4 +882,4 @@
return result;
}
};
-}
+}*/
diff --git a/src/org/omnirom/omnigears/batterylight/BatteryLightDialog.java b/src/org/omnirom/omnigears/batterylight/BatteryLightDialog.java
deleted file mode 100644
index cb1e820..0000000
--- a/src/org/omnirom/omnigears/batterylight/BatteryLightDialog.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (C) 2010 Daniel Nilsson
- * Copyright (C) 2012 The CyanogenMod 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.
- */
-
-package org.omnirom.omnigears.batterylight;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.Context;
-import android.graphics.Color;
-import android.graphics.PixelFormat;
-import android.os.Bundle;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.text.InputFilter;
-import android.text.InputFilter.LengthFilter;
-import android.util.Pair;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnFocusChangeListener;
-import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.SpinnerAdapter;
-import android.widget.TextView;
-
-import com.android.settings.R;
-import org.omnirom.omnigears.ui.ColorPanelView;
-import org.omnirom.omnigears.ui.ColorPickerView;
-import org.omnirom.omnigears.ui.ColorPickerView.OnColorChangedListener;
-
-import java.util.ArrayList;
-import java.util.IllegalFormatException;
-import java.util.Locale;
-
-public class BatteryLightDialog extends AlertDialog implements
- ColorPickerView.OnColorChangedListener, TextWatcher, OnFocusChangeListener {
-
- private static final String TAG = "BatteryLightDialog";
- private final static String STATE_KEY_COLOR = "BatteryLightDialog:color";
-
- private ColorPickerView mColorPicker;
-
- private EditText mHexColorInput;
- private ColorPanelView mNewColor;
- private LayoutInflater mInflater;
- private boolean mMultiColor = true;
- private Spinner mColorList;
- private LinearLayout mColorListView;
- private LinearLayout mColorPanelView;
- private ColorPanelView mNewListColor;
- private LedColorAdapter mLedColorAdapter;
- private boolean mWithAlpha;
-
- protected BatteryLightDialog(Context context, int initialColor) {
- super(context);
- mWithAlpha = false;
- mMultiColor = getContext().getResources().getBoolean(R.bool.config_has_multi_color_led);
- init(initialColor);
- }
-
- private void init(int color) {
- // To fight color banding.
- getWindow().setFormat(PixelFormat.RGBA_8888);
- setUp(color);
- }
-
- /**
- * This function sets up the dialog with the proper values. If the speedOff parameters
- * has a -1 value disable both spinners
- *
- * @param color - the color to set
- * @param speedOn - the flash time in ms
- * @param speedOff - the flash length in ms
- */
- private void setUp(int color) {
- mInflater = (LayoutInflater) getContext()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View layout = mInflater.inflate(R.layout.dialog_battery_settings, null);
-
- mColorPicker = (ColorPickerView) layout.findViewById(R.id.color_picker_view);
- mHexColorInput = (EditText) layout.findViewById(R.id.hex_color_input);
- mNewColor = (ColorPanelView) layout.findViewById(R.id.color_panel);
- mColorPanelView = (LinearLayout) layout.findViewById(R.id.color_panel_view);
-
- mColorListView = (LinearLayout) layout.findViewById(R.id.color_list_view);
- mColorList = (Spinner) layout.findViewById(R.id.color_list_spinner);
- mNewListColor = (ColorPanelView) layout.findViewById(R.id.color_list_panel);
-
- mColorPicker.setOnColorChangedListener(this);
- mHexColorInput.setOnFocusChangeListener(this);
- setAlphaSliderVisible(mWithAlpha);
- mColorPicker.setColor(color, true);
-
- mColorList = (Spinner) layout.findViewById(R.id.color_list_spinner);
- mLedColorAdapter = new LedColorAdapter(
- R.array.entries_led_colors,
- R.array.values_led_colors);
- mColorList.setAdapter(mLedColorAdapter);
- mColorList.setSelection(mLedColorAdapter.getColorPosition(color));
- mColorList.setOnItemSelectedListener(mColorListListener);
-
- setView(layout);
-
- // show and hide the correct UI depending if we have multi-color led or not
- if (mMultiColor){
- mColorListView.setVisibility(View.GONE);
- mColorPicker.setVisibility(View.VISIBLE);
- mColorPanelView.setVisibility(View.VISIBLE);
- } else {
- mColorListView.setVisibility(View.VISIBLE);
- mColorPicker.setVisibility(View.GONE);
- mColorPanelView.setVisibility(View.GONE);
- }
- }
-
- private AdapterView.OnItemSelectedListener mColorListListener = new AdapterView.OnItemSelectedListener() {
-
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- int color = mLedColorAdapter.getColor(position);
- mNewListColor.setColor(color);
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- }
- };
-
- @Override
- public Bundle onSaveInstanceState() {
- Bundle state = super.onSaveInstanceState();
- state.putInt(STATE_KEY_COLOR, getColor());
- return state;
- }
-
- @Override
- public void onRestoreInstanceState(Bundle state) {
- super.onRestoreInstanceState(state);
- mColorPicker.setColor(state.getInt(STATE_KEY_COLOR), true);
- }
-
- @Override
- public void onColorChanged(int color) {
- final boolean hasAlpha = mWithAlpha;
- final String format = hasAlpha ? "%08x" : "%06x";
- final int mask = hasAlpha ? 0xFFFFFFFF : 0x00FFFFFF;
-
- mNewColor.setColor(color);
- mHexColorInput.setText(String.format(Locale.US, format, color & mask));
- }
-
- public void setAlphaSliderVisible(boolean visible) {
- mHexColorInput.setFilters(new InputFilter[] { new InputFilter.LengthFilter(visible ? 8 : 6) } );
- mColorPicker.setAlphaSliderVisible(visible);
- }
-
- public int getColor() {
- if (mMultiColor){
- return mColorPicker.getColor();
- } else {
- return mNewListColor.getColor();
- }
- }
-
- class LedColorAdapter extends BaseAdapter implements SpinnerAdapter {
- private ArrayList<Pair<String, Integer>> mColors;
-
- public LedColorAdapter(int ledColorResource, int ledValueResource) {
- mColors = new ArrayList<Pair<String, Integer>>();
-
- String[] color_names = getContext().getResources().getStringArray(ledColorResource);
- String[] color_values = getContext().getResources().getStringArray(ledValueResource);
-
- for(int i = 0; i < color_values.length; ++i) {
- try {
- int color = Color.parseColor(color_values[i]);
- mColors.add(new Pair<String, Integer>(color_names[i], color));
- } catch (IllegalArgumentException ex) {
- // Number format is incorrect, ignore entry
- }
- }
- }
-
- /**
- * Will return the position of the spinner entry with the specified
- * color. Returns 0 if there is no such entry.
- */
- public int getColorPosition(int color) {
- for (int position = 0; position < getCount(); ++position) {
- if (getItem(position).second.equals(color)) {
- return position;
- }
- }
-
- return 0;
- }
-
- public int getColor(int position) {
- Pair<String, Integer> item = getItem(position);
- if (item != null){
- return item.second;
- }
-
- // -1 is white
- return -1;
- }
-
- @Override
- public int getCount() {
- return mColors.size();
- }
-
- @Override
- public Pair<String, Integer> getItem(int position) {
- return mColors.get(position);
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public View getView(int position, View view, ViewGroup parent) {
- if (view == null) {
- view = mInflater.inflate(R.layout.led_color_item, null);
- }
-
- Pair<String, Integer> entry = getItem(position);
- ((TextView) view.findViewById(R.id.textViewName)).setText(entry.first);
-
- return view;
- }
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- String hexColor = mHexColorInput.getText().toString();
- if (!hexColor.isEmpty()) {
- try {
- int color = Color.parseColor('#' + hexColor);
- if (!mWithAlpha) {
- color |= 0xFF000000; // set opaque
- }
- mColorPicker.setColor(color);
- mNewColor.setColor(color);
- } catch (IllegalArgumentException ex) {
- // Number format is incorrect, ignore
- }
- }
- }
-
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if (!hasFocus) {
- mHexColorInput.removeTextChangedListener(this);
- InputMethodManager inputMethodManager = (InputMethodManager) getContext()
- .getSystemService(Activity.INPUT_METHOD_SERVICE);
- inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
- } else {
- mHexColorInput.addTextChangedListener(this);
- }
- }
-}
diff --git a/src/org/omnirom/omnigears/batterylight/BatteryLightPreference.java b/src/org/omnirom/omnigears/batterylight/BatteryLightPreference.java
deleted file mode 100644
index 7cb5914..0000000
--- a/src/org/omnirom/omnigears/batterylight/BatteryLightPreference.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod 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.
- */
-
-package org.omnirom.omnigears.batterylight;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.res.Resources;
-import android.graphics.drawable.ShapeDrawable;
-import android.graphics.drawable.shapes.RectShape;
-import android.os.Bundle;
-import android.preference.Preference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.android.settings.R;
-
-public class BatteryLightPreference extends Preference implements DialogInterface.OnDismissListener {
-
- private static String TAG = "BatteryLightPreference";
- public static final int DEFAULT_COLOR = 0xFFFFFF; //White
-
- private ImageView mLightColorView;
- private Resources mResources;
- private int mColorValue;
- private Dialog mDialog;
-
- /**
- * @param context
- * @param attrs
- */
- public BatteryLightPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mColorValue = DEFAULT_COLOR;
- init();
- }
-
- public BatteryLightPreference(Context context, int color) {
- super(context, null);
- mColorValue = color;
- init();
- }
-
- private void init() {
- setLayoutResource(R.layout.preference_battery_light);
- mResources = getContext().getResources();
- }
-
- public void setColor(int color) {
- mColorValue = color;
- updatePreferenceViews();
- }
-
- public int getColor() {
- return mColorValue;
- }
-
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
-
- mLightColorView = (ImageView) view.findViewById(R.id.light_color);
-
- updatePreferenceViews();
- }
-
- private void updatePreferenceViews() {
- final int width = (int) mResources.getDimension(R.dimen.color_preference_width);
- final int height = (int) mResources.getDimension(R.dimen.color_preference_height);
-
- if (mLightColorView != null) {
- mLightColorView.setEnabled(true);
- mLightColorView.setImageDrawable(createRectShape(width, height, 0xFF000000 | mColorValue));
- }
- }
-
- @Override
- protected void onClick() {
- if (mDialog != null && mDialog.isShowing()) return;
- mDialog = getDialog();
- mDialog.setOnDismissListener(this);
- mDialog.show();
- }
-
- public Dialog getDialog() {
- final BatteryLightDialog d = new BatteryLightDialog(getContext(),
- 0xFF000000 | mColorValue);
-
- d.setButton(AlertDialog.BUTTON_POSITIVE, mResources.getString(R.string.ok),
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- mColorValue = d.getColor() & 0x00FFFFFF; // strip alpha, led does not support it
- updatePreferenceViews();
- callChangeListener(this);
- }
- });
- d.setButton(AlertDialog.BUTTON_NEGATIVE, mResources.getString(R.string.cancel),
- (DialogInterface.OnClickListener) null);
-
- return d;
- }
-
- private static ShapeDrawable createRectShape(int width, int height, int color) {
- ShapeDrawable shape = new ShapeDrawable(new RectShape());
- shape.setIntrinsicHeight(height);
- shape.setIntrinsicWidth(width);
- shape.getPaint().setColor(color);
- return shape;
- }
-
- @Override
- public void onDismiss(DialogInterface dialog) {
- mDialog = null;
- }
-}
diff --git a/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java b/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java
deleted file mode 100644
index dac55f4..0000000
--- a/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod 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.
- */
-
-package org.omnirom.omnigears.batterylight;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.res.Resources;
-import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
-import android.provider.SearchIndexableResource;
-import android.provider.Settings;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settings.search.Indexable;
-
-import java.util.List;
-import java.util.ArrayList;
-
-public class BatteryLightSettings extends SettingsPreferenceFragment implements
- Preference.OnPreferenceChangeListener, Indexable {
- private static final String TAG = "BatteryLightSettings";
-
- private static final String LOW_COLOR_PREF = "low_color";
- private static final String MEDIUM_COLOR_PREF = "medium_color";
- private static final String FULL_COLOR_PREF = "full_color";
- private static final String REALLY_FULL_COLOR_PREF = "really_full_color";
- private static final String BATTERY_LIGHT_PREF = "battery_light_enabled";
- private static final String BATTERY_PULSE_PREF = "battery_light_pulse";
-
- private boolean mMultiColorLed;
- private SwitchPreference mEnabledPref;
- private CheckBoxPreference mPulsePref;
- private PreferenceGroup mColorPrefs;
- private BatteryLightPreference mLowColorPref;
- private BatteryLightPreference mMediumColorPref;
- private BatteryLightPreference mFullColorPref;
- private BatteryLightPreference mReallyFullColorPref;
- private static final int MENU_RESET = Menu.FIRST;
- private int mLowBatteryWarningLevel;
- private boolean mBatteryLightEnabled;
-
- @Override
- protected int getMetricsCategory() {
- return MetricsLogger.OMNI_SETTINGS;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.battery_light_settings);
-
- PreferenceScreen prefSet = getPreferenceScreen();
- ContentResolver resolver = getContentResolver();
-
- mLowBatteryWarningLevel = getResources().getInteger(
- com.android.internal.R.integer.config_lowBatteryWarningLevel);
- mBatteryLightEnabled = getResources().getBoolean(
- com.android.internal.R.bool.config_intrusiveBatteryLed);
-
- mEnabledPref = (SwitchPreference)prefSet.findPreference(BATTERY_LIGHT_PREF);
- mEnabledPref.setChecked(Settings.System.getInt(resolver,
- Settings.System.BATTERY_LIGHT_ENABLED, mBatteryLightEnabled ? 1 : 0) != 0);
- mEnabledPref.setOnPreferenceChangeListener(this);
-
- mPulsePref = (CheckBoxPreference)prefSet.findPreference(BATTERY_PULSE_PREF);
- mPulsePref.setChecked(Settings.System.getInt(resolver,
- Settings.System.BATTERY_LIGHT_PULSE, mBatteryLightEnabled ? 1 : 0) != 0);
-
- // Does the Device support changing battery LED colors?
- if (getResources().getBoolean(com.android.internal.R.bool.config_multiColorBatteryLed)) {
- setHasOptionsMenu(true);
-
- // Low, Medium and full color preferences
- mLowColorPref = (BatteryLightPreference) prefSet.findPreference(LOW_COLOR_PREF);
- mLowColorPref.setOnPreferenceChangeListener(this);
-
- mMediumColorPref = (BatteryLightPreference) prefSet.findPreference(MEDIUM_COLOR_PREF);
- mMediumColorPref.setOnPreferenceChangeListener(this);
-
- mFullColorPref = (BatteryLightPreference) prefSet.findPreference(FULL_COLOR_PREF);
- mFullColorPref.setOnPreferenceChangeListener(this);
-
- mReallyFullColorPref = (BatteryLightPreference) prefSet.findPreference(REALLY_FULL_COLOR_PREF);
- mReallyFullColorPref.setOnPreferenceChangeListener(this);
- } else {
- prefSet.removePreference(prefSet.findPreference("colors_list"));
- }
- }
-
- @Override
- public void onResume() {
- super.onResume();
- refreshDefault();
- }
-
- private void refreshDefault() {
- ContentResolver resolver = getContentResolver();
- Resources res = getResources();
-
- if (mLowColorPref != null) {
- int lowColor = Settings.System.getInt(resolver, Settings.System.BATTERY_LIGHT_LOW_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryLowARGB));
- mLowColorPref.setColor(lowColor);
- }
-
- if (mMediumColorPref != null) {
- int mediumColor = Settings.System.getInt(resolver, Settings.System.BATTERY_LIGHT_MEDIUM_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryMediumARGB));
- mMediumColorPref.setColor(mediumColor);
- }
-
- if (mFullColorPref != null) {
- int fullColor = Settings.System.getInt(resolver, Settings.System.BATTERY_LIGHT_FULL_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryFullARGB));
- mFullColorPref.setColor(fullColor);
- }
-
- if (mReallyFullColorPref != null) {
- int reallyFullColor = Settings.System.getInt(resolver, Settings.System.BATTERY_LIGHT_REALLY_FULL_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryFullARGB));
- mReallyFullColorPref.setColor(reallyFullColor);
- }
- }
-
- /**
- * Updates the default or application specific notification settings.
- *
- * @param key of the specific setting to update
- * @param color
- */
- protected void updateValues(String key, Integer color) {
- ContentResolver resolver = getContentResolver();
-
- if (key.equals(LOW_COLOR_PREF)) {
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_LOW_COLOR, color);
- } else if (key.equals(MEDIUM_COLOR_PREF)) {
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_MEDIUM_COLOR, color);
- } else if (key.equals(FULL_COLOR_PREF)) {
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_FULL_COLOR, color);
- } else if (key.equals(REALLY_FULL_COLOR_PREF)) {
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_REALLY_FULL_COLOR, color);
- }
- }
-
- /*@Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- menu.add(0, MENU_RESET, 0, R.string.reset)
- .setIcon(R.drawable.ic_settings_backup) // use the backup icon
- .setAlphabeticShortcut('r')
- .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case MENU_RESET:
- resetColors();
- return true;
- }
- return false;
- }
-
- protected void resetColors() {
- ContentResolver resolver = getContentResolver();
- Resources res = getResources();
-
- // Reset to the framework default colors
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_LOW_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryLowARGB));
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_MEDIUM_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryMediumARGB));
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_FULL_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryFullARGB));
- Settings.System.putInt(resolver, Settings.System.BATTERY_LIGHT_REALLY_FULL_COLOR,
- res.getInteger(com.android.internal.R.integer.config_notificationsBatteryFullARGB));
- refreshDefault();
- }*/
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object objValue) {
- if (preference == mEnabledPref) {
- boolean value = (Boolean) objValue;
- Settings.System.putInt(getActivity().getContentResolver(),
- Settings.System.BATTERY_LIGHT_ENABLED, value ? 1:0);
- } else {
- BatteryLightPreference lightPref = (BatteryLightPreference) preference;
- updateValues(lightPref.getKey(), lightPref.getColor());
- }
- return true;
- }
-
- @Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference == mPulsePref) {
- boolean checked = ((CheckBoxPreference)preference).isChecked();
- Settings.System.putInt(getActivity().getContentResolver(),
- Settings.System.BATTERY_LIGHT_PULSE, checked ? 1:0);
-
- return true;
- }
-
- return super.onPreferenceTreeClick(preferenceScreen, preference);
- }
-
- public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider() {
- @Override
- public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
- boolean enabled) {
- ArrayList<SearchIndexableResource> result =
- new ArrayList<SearchIndexableResource>();
-
- SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = R.xml.battery_light_settings;
- result.add(sir);
- return result;
- }
-
- @Override
- public List<String> getNonIndexableKeys(Context context) {
- ArrayList<String> result = new ArrayList<String>();
- final Resources res = context.getResources();
- if (!res.getBoolean(com.android.internal.R.bool.config_intrusiveBatteryLed)) {
- result.add(BATTERY_LIGHT_PREF);
- result.add(BATTERY_PULSE_PREF);
- }
- if (!res.getBoolean(com.android.internal.R.bool.config_multiColorBatteryLed)) {
- result.add(LOW_COLOR_PREF);
- result.add(MEDIUM_COLOR_PREF);
- result.add(FULL_COLOR_PREF);
- result.add(REALLY_FULL_COLOR_PREF);
- }
- return result;
- }
- };
-}
diff --git a/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java b/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
index f93ffe9..b04ded8 100644
--- a/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.interfacesettings;
@@ -245,4 +244,4 @@
return result;
}
};
-}
+}*/
diff --git a/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java b/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java
index cb7ecbe..1608b21 100644
--- a/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/GlobalActionsSettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.interfacesettings;
@@ -160,4 +159,4 @@
}
};
}
-
+*/
diff --git a/src/org/omnirom/omnigears/interfacesettings/LockscreenSettings.java b/src/org/omnirom/omnigears/interfacesettings/LockscreenSettings.java
index 628f94c..77e82be 100644
--- a/src/org/omnirom/omnigears/interfacesettings/LockscreenSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/LockscreenSettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.interfacesettings;
import android.app.Activity;
@@ -240,4 +239,4 @@
return result;
}
};
-}
+}*/
diff --git a/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java b/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java
index 415d285..532ff28 100644
--- a/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/MoreInterfaceSettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.interfacesettings;
@@ -275,4 +274,4 @@
}
};
}
-
+*/
diff --git a/src/org/omnirom/omnigears/interfacesettings/NetworkTraffic.java b/src/org/omnirom/omnigears/interfacesettings/NetworkTraffic.java
index d791b1b..6ea7309 100644
--- a/src/org/omnirom/omnigears/interfacesettings/NetworkTraffic.java
+++ b/src/org/omnirom/omnigears/interfacesettings/NetworkTraffic.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.interfacesettings;
@@ -205,4 +204,4 @@
return result;
}
};
-}
+}*/
diff --git a/src/org/omnirom/omnigears/interfacesettings/StatusbarBatterySettings.java b/src/org/omnirom/omnigears/interfacesettings/StatusbarBatterySettings.java
index ecb3d51..a82616f 100644
--- a/src/org/omnirom/omnigears/interfacesettings/StatusbarBatterySettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/StatusbarBatterySettings.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.interfacesettings;
@@ -201,4 +200,4 @@
return result;
}
};
-}
+}*/
diff --git a/src/org/omnirom/omnigears/ui/ShortcutDialog.java b/src/org/omnirom/omnigears/ui/ShortcutDialog.java
index 3dc7726..139c686 100644
--- a/src/org/omnirom/omnigears/ui/ShortcutDialog.java
+++ b/src/org/omnirom/omnigears/ui/ShortcutDialog.java
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */
package org.omnirom.omnigears.ui;
import android.app.AlertDialog;
@@ -444,4 +443,4 @@
return collator.compare(a.label, b.label);
}
};
-}
+}*/