Cherish : Introduce Battery Landscape | Left Battery Text [2/2]
Signed-off-by: 703joko <703joko@gmail.com> Signed-off-by: Genkzsz11 <genkzsz11@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -267,6 +267,8 @@
|
|||||||
<!-- Battery -->
|
<!-- Battery -->
|
||||||
<string-array name="status_bar_battery_style_entries" translatable="false">
|
<string-array name="status_bar_battery_style_entries" translatable="false">
|
||||||
<item>@string/status_bar_battery_style_icon_portrait</item>
|
<item>@string/status_bar_battery_style_icon_portrait</item>
|
||||||
|
<item>@string/status_bar_battery_style_icon_rlandscape</item>
|
||||||
|
<item>@string/status_bar_battery_style_icon_landscape</item>
|
||||||
<item>@string/status_bar_battery_style_circle</item>
|
<item>@string/status_bar_battery_style_circle</item>
|
||||||
<item>@string/status_bar_battery_style_dotted_circle</item>
|
<item>@string/status_bar_battery_style_dotted_circle</item>
|
||||||
<item>@string/status_bar_battery_style_filled_circle</item>
|
<item>@string/status_bar_battery_style_filled_circle</item>
|
||||||
@@ -280,6 +282,8 @@
|
|||||||
<item>3</item>
|
<item>3</item>
|
||||||
<item>4</item>
|
<item>4</item>
|
||||||
<item>5</item>
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>7</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Tiles animation style -->
|
<!-- Tiles animation style -->
|
||||||
|
|||||||
@@ -465,6 +465,8 @@
|
|||||||
<!-- Status bar - Battery -->
|
<!-- Status bar - Battery -->
|
||||||
<string name="status_bar_battery_style_title">Battery style</string>
|
<string name="status_bar_battery_style_title">Battery style</string>
|
||||||
<string name="status_bar_battery_style_icon_portrait">Icon portrait (default)</string>
|
<string name="status_bar_battery_style_icon_portrait">Icon portrait (default)</string>
|
||||||
|
<string name="status_bar_battery_style_icon_rlandscape">Icon landscape R</string>
|
||||||
|
<string name="status_bar_battery_style_icon_landscape">Icon landscape L</string>
|
||||||
<string name="status_bar_battery_style_circle">Circle</string>
|
<string name="status_bar_battery_style_circle">Circle</string>
|
||||||
<string name="status_bar_battery_style_dotted_circle">Circle (Dotted)</string>
|
<string name="status_bar_battery_style_dotted_circle">Circle (Dotted)</string>
|
||||||
<string name="status_bar_battery_style_filled_circle">Circle (Filled)</string>
|
<string name="status_bar_battery_style_filled_circle">Circle (Filled)</string>
|
||||||
@@ -475,7 +477,9 @@
|
|||||||
<string name="status_bar_battery_percentage_title">Battery percentage</string>
|
<string name="status_bar_battery_percentage_title">Battery percentage</string>
|
||||||
<string name="status_bar_battery_percentage_default">Hidden (default)</string>
|
<string name="status_bar_battery_percentage_default">Hidden (default)</string>
|
||||||
<string name="status_bar_battery_percentage_text_inside">Inside the icon</string>
|
<string name="status_bar_battery_percentage_text_inside">Inside the icon</string>
|
||||||
<string name="status_bar_battery_percentage_text_next">Next to the icon</string>
|
<string name="status_bar_battery_percentage_text_next">Outside the icon</string>
|
||||||
|
<string name="left_battery_text_title">Left battery text</string>
|
||||||
|
<string name="left_battery_text_summary">Put the battery text on left of battery icon</string>
|
||||||
|
|
||||||
<!-- Call strength icons in QS -->
|
<!-- Call strength icons in QS -->
|
||||||
<string name="show_qs_call_strength_icon_title">Show call strength icon(s)</string>
|
<string name="show_qs_call_strength_icon_title">Show call strength icon(s)</string>
|
||||||
|
|||||||
@@ -19,22 +19,28 @@
|
|||||||
android:key="battery_style_category"
|
android:key="battery_style_category"
|
||||||
android:title="@string/battery_style_category_title" >
|
android:title="@string/battery_style_category_title" >
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||||
android:key="status_bar_battery_style"
|
android:key="do_left_battery_text"
|
||||||
android:title="@string/status_bar_battery_style_title"
|
android:title="@string/left_battery_text_title"
|
||||||
android:summary="%s"
|
android:summary="@string/left_battery_text_summary"
|
||||||
android:dialogTitle="@string/status_bar_battery_style_title"
|
android:defaultValue="false"/>
|
||||||
android:entries="@array/status_bar_battery_style_entries"
|
|
||||||
android:entryValues="@array/status_bar_battery_style_values"
|
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||||
android:defaultValue="0" />
|
android:key="status_bar_battery_style"
|
||||||
|
android:title="@string/status_bar_battery_style_title"
|
||||||
|
android:summary="%s"
|
||||||
|
android:dialogTitle="@string/status_bar_battery_style_title"
|
||||||
|
android:entries="@array/status_bar_battery_style_entries"
|
||||||
|
android:entryValues="@array/status_bar_battery_style_values"
|
||||||
|
android:defaultValue="0" />
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||||
android:key="status_bar_show_battery_percent"
|
android:key="status_bar_show_battery_percent"
|
||||||
android:title="@string/battery_percent_title"
|
android:title="@string/battery_percent_title"
|
||||||
android:dialogTitle="@string/battery_percent_title"
|
android:dialogTitle="@string/battery_percent_title"
|
||||||
android:entries="@array/battery_percent_entries"
|
android:entries="@array/battery_percent_entries"
|
||||||
android:entryValues="@array/battery_percent_values"
|
android:entryValues="@array/battery_percent_values"
|
||||||
android:defaultValue="0" />
|
android:defaultValue="0" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ import com.android.internal.logging.nano.MetricsProto;
|
|||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
|
||||||
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
||||||
|
|
||||||
|
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||||
|
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
||||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
|
||||||
@@ -52,10 +55,11 @@ public class BatterySettings extends SettingsPreferenceFragment
|
|||||||
private static final String PREF_BATT_BLEND_COLOR_REVERSE = "statusbar_battery_bar_blend_color_reverse";
|
private static final String PREF_BATT_BLEND_COLOR_REVERSE = "statusbar_battery_bar_blend_color_reverse";
|
||||||
private static final String PREF_STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
|
private static final String PREF_STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
|
||||||
private static final String PREF_STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style";
|
private static final String PREF_STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style";
|
||||||
|
private static final String LEFT_BATTERY_TEXT = "do_left_battery_text";
|
||||||
|
|
||||||
private static final int BATTERY_STYLE_PORTRAIT = 0;
|
private static final int BATTERY_STYLE_PORTRAIT = 0;
|
||||||
private static final int BATTERY_STYLE_TEXT = 4;
|
private static final int BATTERY_STYLE_TEXT = 6;
|
||||||
private static final int BATTERY_STYLE_HIDDEN = 5;
|
private static final int BATTERY_STYLE_HIDDEN = 7;
|
||||||
private static final int BATTERY_PERCENT_HIDDEN = 0;
|
private static final int BATTERY_PERCENT_HIDDEN = 0;
|
||||||
//private static final int BATTERY_PERCENT_SHOW_INSIDE = 1;
|
//private static final int BATTERY_PERCENT_SHOW_INSIDE = 1;
|
||||||
//private static final int BATTERY_PERCENT_SHOW_OUTSIDE = 2;
|
//private static final int BATTERY_PERCENT_SHOW_OUTSIDE = 2;
|
||||||
@@ -72,6 +76,7 @@ public class BatterySettings extends SettingsPreferenceFragment
|
|||||||
private ColorPickerPreference mBatteryBarBatteryLowColor;
|
private ColorPickerPreference mBatteryBarBatteryLowColor;
|
||||||
private ListPreference mBatteryPercent;
|
private ListPreference mBatteryPercent;
|
||||||
private ListPreference mBatteryStyle;
|
private ListPreference mBatteryStyle;
|
||||||
|
private SystemSettingSwitchPreference mLeftBatteryText;
|
||||||
private int mBatteryPercentValue;
|
private int mBatteryPercentValue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -140,6 +145,11 @@ public class BatterySettings extends SettingsPreferenceFragment
|
|||||||
mBatteryStyle.setSummary(mBatteryStyle.getEntry());
|
mBatteryStyle.setSummary(mBatteryStyle.getEntry());
|
||||||
mBatteryStyle.setOnPreferenceChangeListener(this);
|
mBatteryStyle.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
mLeftBatteryText = (SystemSettingSwitchPreference) findPreference(LEFT_BATTERY_TEXT);
|
||||||
|
mLeftBatteryText.setChecked((Settings.System.getInt(resolver,
|
||||||
|
Settings.System.DO_LEFT_BATTERY_TEXT, 0) == 1));
|
||||||
|
mLeftBatteryText.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mBatteryPercentValue = Settings.System.getIntForUser(getContentResolver(),
|
mBatteryPercentValue = Settings.System.getIntForUser(getContentResolver(),
|
||||||
Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, BATTERY_PERCENT_HIDDEN, UserHandle.USER_CURRENT);
|
Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, BATTERY_PERCENT_HIDDEN, UserHandle.USER_CURRENT);
|
||||||
|
|
||||||
@@ -213,6 +223,8 @@ public class BatterySettings extends SettingsPreferenceFragment
|
|||||||
mBatteryStyle.setSummary(mBatteryStyle.getEntries()[index]);
|
mBatteryStyle.setSummary(mBatteryStyle.getEntries()[index]);
|
||||||
mBatteryPercent.setEnabled(
|
mBatteryPercent.setEnabled(
|
||||||
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
||||||
|
mLeftBatteryText.setEnabled(
|
||||||
|
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == mBatteryPercent) {
|
} else if (preference == mBatteryPercent) {
|
||||||
mBatteryPercentValue = Integer.parseInt((String) newValue);
|
mBatteryPercentValue = Integer.parseInt((String) newValue);
|
||||||
@@ -222,6 +234,11 @@ public class BatterySettings extends SettingsPreferenceFragment
|
|||||||
int index = mBatteryPercent.findIndexOfValue((String) newValue);
|
int index = mBatteryPercent.findIndexOfValue((String) newValue);
|
||||||
mBatteryPercent.setSummary(mBatteryPercent.getEntries()[index]);
|
mBatteryPercent.setSummary(mBatteryPercent.getEntries()[index]);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (preference == mLeftBatteryText) {
|
||||||
|
boolean value = (Boolean) newValue;
|
||||||
|
Settings.System.putInt(resolver,
|
||||||
|
Settings.System.DO_LEFT_BATTERY_TEXT, value ? 1 : 0);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user