Cherish: Allow setting custom symbol near text on charging [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
neobuddy89
2021-01-25 23:25:05 +05:30
committed by Hưng Phan
parent ee57fca863
commit 8dbd03a32e
4 changed files with 39 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
import com.cherish.settings.preferences.SystemSettingListPreference;
import java.util.ArrayList;
import java.util.List;
@@ -46,9 +47,11 @@ public class StatusbarBatterySettings extends SettingsPreferenceFragment impleme
private static final String STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style";
private static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
private static final String TEXT_CHARGING_SYMBOL = "text_charging_symbol";
private ListPreference mBatteryPercent;
private ListPreference mBatteryStyle;
private SystemSettingListPreference mChargingSymbol;
private int mBatteryPercentValue;
@@ -79,6 +82,10 @@ public class StatusbarBatterySettings extends SettingsPreferenceFragment impleme
mBatteryPercent.setOnPreferenceChangeListener(this);
mBatteryPercent.setEnabled(
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
mChargingSymbol = (SystemSettingListPreference) findPreference("text_charging_symbol");
mChargingSymbol.setEnabled(
batterystyle != BATTERY_STYLE_PORTRAIT && batterystyle != BATTERY_STYLE_HIDDEN);
}
@Override
@@ -93,6 +100,8 @@ public class StatusbarBatterySettings extends SettingsPreferenceFragment impleme
mBatteryStyle.setSummary(mBatteryStyle.getEntries()[index]);
mBatteryPercent.setEnabled(
batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN);
mChargingSymbol.setEnabled(
batterystyle != BATTERY_STYLE_PORTRAIT && batterystyle != BATTERY_STYLE_HIDDEN);
return true;
} else if (preference == mBatteryPercent) {
mBatteryPercentValue = Integer.parseInt((String) newValue);