Cherish: Add custom charging info fonts [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Ido Ben-Hur
2020-02-06 16:44:09 +02:00
committed by Hưng Phan
parent 63ef38c532
commit 3ebd26b070
3 changed files with 28 additions and 0 deletions

View File

@@ -216,6 +216,8 @@
<!-- Lockscreen battery info indicator -->
<string name="lockscreen_battery_info_title">Lockscreen charging info</string>
<string name="lockscreen_battery_info_summary">Display negociated charger max current and voltage and battery temperature on lockscreen while charging</string>
<string name="lockscreen_battery_info_font_title">Charging info font</string>
<string name="lockscreen_battery_info_dialog_title">Select charging info font</string>
<!-- Fingerprint authentication vibration -->
<string name="fprint_sucess_vib_title">Fingerprint authentication vibration</string>

View File

@@ -24,6 +24,17 @@
android:title="@string/lockscreen_battery_info_title"
android:summary="@string/lockscreen_battery_info_summary"
android:defaultValue="true" />
<ListPreference
android:key="lockscreen_battery_info_font"
android:title="@string/lockscreen_battery_info_font_title"
android:dialogTitle="@string/lockscreen_battery_info_dialog_title"
android:entries="@array/lock_clock_fonts_entries"
android:entryValues="@array/lock_clock_fonts_values"
android:summary="%s"
android:defaultValue="28"
android:dependency="lockscreen_battery_info"
android:persistent="false" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="charging_animation"

View File

@@ -59,6 +59,7 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
private static final String KEY_FOD_RECOGNIZING_ANIMATION = "fod_recognizing_animation";
private static final String KEY_FOD_RECOGNIZING_ANIMATION_LIST = "fod_recognizing_animation_list";
private static final String AOD_SCHEDULE_KEY = "always_on_display_schedule";
private static final String KEY_CHARGE_INFO_FONT = "lockscreen_battery_info_font";
static final int MODE_DISABLED = 0;
static final int MODE_NIGHT = 1;
@@ -70,6 +71,7 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
private ListPreference mLockDateFonts;
private ListPreference mTextClockFonts;
private ListPreference mLockOwnerInfoFonts;
private ListPreference mChargingInfoFont;
private CustomSeekBarPreference mClockFontSize;
private CustomSeekBarPreference mDateFontSize;
private CustomSeekBarPreference mOwnerInfoFontSize;
@@ -131,6 +133,12 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
mTextClockFonts.setSummary(mTextClockFonts.getEntry());
mTextClockFonts.setOnPreferenceChangeListener(this);
mChargingInfoFont = (ListPreference) findPreference(KEY_CHARGE_INFO_FONT);
mChargingInfoFont.setValue(String.valueOf(Settings.System.getInt(
getContentResolver(), Settings.System.LOCKSCREEN_BATTERY_INFO_FONT, 28)));
mChargingInfoFont.setSummary(mChargingInfoFont.getEntry());
mChargingInfoFont.setOnPreferenceChangeListener(this);
// Custom Text Clock Size
mCustomTextClockFontSize = (CustomSeekBarPreference) findPreference(CUSTOM_TEXT_CLOCK_FONT_SIZE);
mCustomTextClockFontSize.setValue(Settings.System.getInt(getContentResolver(),
@@ -226,6 +234,13 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKOWNER_FONT_SIZE, top*1);
return true;
} else if (preference == mChargingInfoFont) {
int value = Integer.valueOf((String) newValue);
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKSCREEN_BATTERY_INFO_FONT, value);
mChargingInfoFont.setValue(String.valueOf(value));
mChargingInfoFont.setSummary(mChargingInfoFont.getEntry());
return true;
}
return false;
}