Cherish:Lockscreen Date Fonts [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Varun Date
2019-10-22 18:05:43 +05:30
committed by Hưng Phan
parent 31723cef99
commit 3f9bd00ab7
3 changed files with 30 additions and 0 deletions

View File

@@ -416,4 +416,9 @@
<string name="lock_clock_font_burnstown">Burnstown</string> <string name="lock_clock_font_burnstown">Burnstown</string>
<string name="lock_clock_font_dumbledor">Dumbledor</string> <string name="lock_clock_font_dumbledor">Dumbledor</string>
<string name="lock_clock_font_phantombold">PhantomBold</string> <string name="lock_clock_font_phantombold">PhantomBold</string>
<!-- Lock Date Fonts -->
<string name="lock_date_font_title">Date font options</string>
<string name="lock_date_font_summary">Change the default font of the lockscreen date widget</string>
<string name="lock_date_font_dialog_title">Select lock date font</string>
</resources> </resources>

View File

@@ -53,6 +53,15 @@
android:summary="@string/lock_clock_font_summary" android:summary="@string/lock_clock_font_summary"
android:persistent="false" /> android:persistent="false" />
<ListPreference
android:key="lock_date_fonts"
android:title="@string/lock_date_font_title"
android:dialogTitle="@string/lock_date_font_dialog_title"
android:entries="@array/lock_clock_fonts_entries"
android:entryValues="@array/lock_clock_fonts_values"
android:summary="@string/lock_date_font_summary"
android:persistent="false" />
</PreferenceCategory> </PreferenceCategory>
<!-- Lockscreen Visualizer--> <!-- Lockscreen Visualizer-->

View File

@@ -44,7 +44,10 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener { Preference.OnPreferenceChangeListener {
private static final String LOCK_CLOCK_FONTS = "lock_clock_fonts"; private static final String LOCK_CLOCK_FONTS = "lock_clock_fonts";
private static final String LOCK_DATE_FONTS = "lock_date_fonts";
private ListPreference mLockClockFonts; private ListPreference mLockClockFonts;
private ListPreference mLockDateFonts;
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
@@ -61,6 +64,13 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
getContentResolver(), Settings.System.LOCK_CLOCK_FONTS, 34))); getContentResolver(), Settings.System.LOCK_CLOCK_FONTS, 34)));
mLockClockFonts.setSummary(mLockClockFonts.getEntry()); mLockClockFonts.setSummary(mLockClockFonts.getEntry());
mLockClockFonts.setOnPreferenceChangeListener(this); mLockClockFonts.setOnPreferenceChangeListener(this);
// Lockscren Date Fonts
mLockDateFonts = (ListPreference) findPreference(LOCK_DATE_FONTS);
mLockDateFonts.setValue(String.valueOf(Settings.System.getInt(
getContentResolver(), Settings.System.LOCK_DATE_FONTS, 32)));
mLockDateFonts.setSummary(mLockDateFonts.getEntry());
mLockDateFonts.setOnPreferenceChangeListener(this);
} }
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -72,6 +82,12 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
mLockClockFonts.setValue(String.valueOf(newValue)); mLockClockFonts.setValue(String.valueOf(newValue));
mLockClockFonts.setSummary(mLockClockFonts.getEntry()); mLockClockFonts.setSummary(mLockClockFonts.getEntry());
return true; return true;
} else if (preference == mLockDateFonts) {
Settings.System.putInt(getContentResolver(), Settings.System.LOCK_DATE_FONTS,
Integer.valueOf((String) newValue));
mLockDateFonts.setValue(String.valueOf(newValue));
mLockDateFonts.setSummary(mLockDateFonts.getEntry());
return true;
} }
return false; return false;
} }