diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml
index 2ada6e0..a84221c 100644
--- a/res/values/cherish_arrays.xml
+++ b/res/values/cherish_arrays.xml
@@ -383,4 +383,15 @@
- 7
- 5
+
+
+ - @string/status_bar_battery_percentage_default
+ - @string/status_bar_battery_percentage_text_inside
+ - @string/status_bar_battery_percentage_text_next
+
+
+ - 0
+ - 1
+ - 2
+
diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml
index 7a69ebd..ed42d1e 100644
--- a/res/values/cherish_strings.xml
+++ b/res/values/cherish_strings.xml
@@ -484,5 +484,12 @@
Game space
Extra features for immersive gaming experience
+
+
+ Battery icon
+ Battery percentage
+ Hidden
+ Next to the icon
+ Inside the icon
diff --git a/res/xml/statusbar_battery.xml b/res/xml/statusbar_battery.xml
new file mode 100644
index 0000000..525648c
--- /dev/null
+++ b/res/xml/statusbar_battery.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
diff --git a/src/com/cherish/settings/fragments/StatusBarBattery.java b/src/com/cherish/settings/fragments/StatusBarBattery.java
new file mode 100644
index 0000000..ec17f41
--- /dev/null
+++ b/src/com/cherish/settings/fragments/StatusBarBattery.java
@@ -0,0 +1,75 @@
+/*
+ * 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 com.cherish.settings.fragments;
+
+import android.content.ContentResolver;
+import android.os.Bundle;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.provider.Settings;
+
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+
+public class StatusBarBattery extends SettingsPreferenceFragment implements
+ Preference.OnPreferenceChangeListener {
+
+ private static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
+
+ private ListPreference mStatusBarBatteryShowPercent;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.statusbar_battery);
+
+ ContentResolver resolver = getActivity().getContentResolver();
+
+ mStatusBarBatteryShowPercent =
+ (ListPreference) findPreference(SHOW_BATTERY_PERCENT);
+
+ int batteryShowPercent = Settings.System.getInt(resolver,
+ Settings.System.SHOW_BATTERY_PERCENT, 0);
+ mStatusBarBatteryShowPercent.setValue(String.valueOf(batteryShowPercent));
+ mStatusBarBatteryShowPercent.setSummary(mStatusBarBatteryShowPercent.getEntry());
+ mStatusBarBatteryShowPercent.setOnPreferenceChangeListener(this);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.CHERISH_SETTINGS;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ ContentResolver resolver = getActivity().getContentResolver();
+ if (preference == mStatusBarBatteryShowPercent) {
+ int batteryShowPercent = Integer.valueOf((String) newValue);
+ int index = mStatusBarBatteryShowPercent.findIndexOfValue((String) newValue);
+ Settings.System.putInt(
+ resolver, Settings.System.SHOW_BATTERY_PERCENT, batteryShowPercent);
+ mStatusBarBatteryShowPercent.setSummary(
+ mStatusBarBatteryShowPercent.getEntries()[index]);
+ return true;
+ }
+ return false;
+ }
+}