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

@@ -378,6 +378,7 @@
<!-- Lock Clock Fonts -->
<string name="lock_clock_font_title">Clock font options</string>
<string name="custom_text_clock_font_title">Typo Clock font options</string>
<string name="lock_clock_font_summary">Change the default font of the lockscreen clock widget</string>
<string name="lock_clock_font_dialog_title">Select lock clock font</string>
<string name="lock_clock_font_stock">Normal (default)</string>
@@ -425,6 +426,7 @@
<!-- Lock Clock & Date Size -->
<string name="lockdate_font_size_title">Date font size</string>
<string name="lockclock_font_size_title">Clock font size</string>
<string name="custom_text_clock_font_size_title">Typography Clock size</string>
<!-- Lockscreen Colors -->
<string name="lockscreen_colors">Lockscreen Colors</string>

View File

@@ -54,6 +54,16 @@
android:defaultValue="34"
android:persistent="false" />
<ListPreference
android:key="custom_text_clock_fonts"
android:title="@string/custom_text_clock_font_title"
android:dialogTitle="@string/lock_clock_font_dialog_title"
android:entries="@array/lock_clock_fonts_entries"
android:entryValues="@array/lock_clock_fonts_values"
android:summary="%s"
android:defaultValue="32"
android:persistent="false" />
<ListPreference
android:key="lock_date_fonts"
android:title="@string/lock_date_font_title"
@@ -90,6 +100,15 @@
android:persistent="false"
android:defaultValue="78" />
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="custom_text_clock_font_size"
android:title="@string/custom_text_clock_font_size_title"
android:max="55"
settings:min="35"
settings:units="dp"
android:persistent="false"
android:defaultValue="40" />
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="lockdate_font_size"
android:title="@string/lockdate_font_size_title"

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(),