TypoClock: User selected Font Style & Font Size [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
SuperDroidBond
2018-11-19 20:42:50 +05:30
committed by Hưng Phan
parent 274b2d840a
commit 241c19c498
3 changed files with 49 additions and 0 deletions

View File

@@ -45,18 +45,22 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String LOCK_CLOCK_FONTS = "lock_clock_fonts";
private static final String CUSTOM_TEXT_CLOCK_FONTS = "custom_text_clock_fonts";
private static final String LOCK_DATE_FONTS = "lock_date_fonts";
private static final String CLOCK_FONT_SIZE = "lockclock_font_size";
private static final String CUSTOM_TEXT_CLOCK_FONT_SIZE = "custom_text_clock_font_size";
private static final String DATE_FONT_SIZE = "lockdate_font_size";
private static final String LOCK_OWNERINFO_FONTS = "lock_ownerinfo_fonts";
private static final String LOCKOWNER_FONT_SIZE = "lockowner_font_size";
private ListPreference mLockClockFonts;
private ListPreference mLockDateFonts;
private ListPreference mTextClockFonts;
private ListPreference mLockOwnerInfoFonts;
private CustomSeekBarPreference mClockFontSize;
private CustomSeekBarPreference mDateFontSize;
private CustomSeekBarPreference mOwnerInfoFontSize;
private CustomSeekBarPreference mCustomTextClockFontSize;
@Override
public void onCreate(Bundle icicle) {
@@ -105,6 +109,19 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
mOwnerInfoFontSize.setValue(Settings.System.getInt(getContentResolver(),
Settings.System.LOCKOWNER_FONT_SIZE,21));
mOwnerInfoFontSize.setOnPreferenceChangeListener(this);
// Lockscren Text Clock Fonts
mTextClockFonts = (ListPreference) findPreference(CUSTOM_TEXT_CLOCK_FONTS);
mTextClockFonts.setValue(String.valueOf(Settings.System.getInt(
getContentResolver(), Settings.System.CUSTOM_TEXT_CLOCK_FONTS, 32)));
mTextClockFonts.setSummary(mTextClockFonts.getEntry());
mTextClockFonts.setOnPreferenceChangeListener(this);
// Custom Text Clock Size
mCustomTextClockFontSize = (CustomSeekBarPreference) findPreference(CUSTOM_TEXT_CLOCK_FONT_SIZE);
mCustomTextClockFontSize.setValue(Settings.System.getInt(getContentResolver(),
Settings.System.CUSTOM_TEXT_CLOCK_FONT_SIZE, 40));
mCustomTextClockFontSize.setOnPreferenceChangeListener(this);
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -115,6 +132,12 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Integer.valueOf((String) newValue));
mLockClockFonts.setValue(String.valueOf(newValue));
mLockClockFonts.setSummary(mLockClockFonts.getEntry());
return true;
} else if (preference == mTextClockFonts) {
Settings.System.putInt(getContentResolver(), Settings.System.CUSTOM_TEXT_CLOCK_FONTS,
Integer.valueOf((String) newValue));
mTextClockFonts.setValue(String.valueOf(newValue));
mTextClockFonts.setSummary(mTextClockFonts.getEntry());
return true;
} else if (preference == mLockDateFonts) {
Settings.System.putInt(getContentResolver(), Settings.System.LOCK_DATE_FONTS,
@@ -127,6 +150,11 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKCLOCK_FONT_SIZE, top*1);
return true;
} else if (preference == mCustomTextClockFontSize) {
int top = (Integer) newValue;
Settings.System.putInt(getContentResolver(),
Settings.System.CUSTOM_TEXT_CLOCK_FONT_SIZE, top*1);
return true;
} else if (preference == mDateFontSize) {
int top = (Integer) newValue;
Settings.System.putInt(getContentResolver(),