Cherish:LS OwnerInfo Fonts & Size Options [2/2]

SuperdroidBond:- It's done on the basis of LS Date Font & Size.

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
SuperDroidBond
2018-10-25 00:49:34 +05:30
committed by Hưng Phan
parent 9269a6a1a5
commit b2cb7d21bf
3 changed files with 52 additions and 0 deletions

View File

@@ -444,4 +444,10 @@
<string name="lockscreen_weather_city_color">Weather City Color</string>
<string name="lockscreen_weather_icon_color">Weather Icon Color</string>
<string name="yes">YES</string>
<!-- LS OwnerInfo Font & Size -->
<string name="lock_ownerinfo_font_title">OwnerInfo font options</string>
<string name="lock_ownerinfo_font_summary">Change the default font of the lockscreen owner info</string>
<string name="lock_ownerinfo_font_dialog_title">Select lock ownerinfo font</string>
<string name="lockowner_font_size_title">Owner info font size</string>
</resources>

View File

@@ -69,6 +69,16 @@
android:summary="@string/lockscreen_colors_summary"
android:fragment="com.cherish.settings.fragments.LockColors" />
<ListPreference
android:key="lock_ownerinfo_fonts"
android:title="@string/lock_ownerinfo_font_title"
android:dialogTitle="@string/lock_ownerinfo_font_dialog_title"
android:entries="@array/lock_clock_fonts_entries"
android:entryValues="@array/lock_clock_fonts_values"
android:summary="%s"
android:defaultValue="0"
android:persistent="false" />
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="lockclock_font_size"
android:title="@string/lockclock_font_size_title"
@@ -87,6 +97,14 @@
android:defaultValue="18"
android:persistent="false" />
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="lockowner_font_size"
android:title="@string/lockowner_font_size_title"
android:max="25"
settings:min="10"
settings:units="sp"
android:defaultValue="21"
android:persistent="false" />
</PreferenceCategory>
<!-- Lockscreen Visualizer-->

View File

@@ -48,11 +48,15 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
private static final String LOCK_DATE_FONTS = "lock_date_fonts";
private static final String CLOCK_FONT_SIZE = "lockclock_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 mLockOwnerInfoFonts;
private CustomSeekBarPreference mClockFontSize;
private CustomSeekBarPreference mDateFontSize;
private CustomSeekBarPreference mOwnerInfoFontSize;
@Override
public void onCreate(Bundle icicle) {
@@ -88,6 +92,19 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
mDateFontSize.setValue(Settings.System.getInt(getContentResolver(),
Settings.System.LOCKDATE_FONT_SIZE, 18));
mDateFontSize.setOnPreferenceChangeListener(this);
// Lockscren OwnerInfo Fonts
mLockOwnerInfoFonts = (ListPreference) findPreference(LOCK_OWNERINFO_FONTS);
mLockOwnerInfoFonts.setValue(String.valueOf(Settings.System.getInt(
getContentResolver(), Settings.System.LOCK_OWNERINFO_FONTS, 0)));
mLockOwnerInfoFonts.setSummary(mLockOwnerInfoFonts.getEntry());
mLockOwnerInfoFonts.setOnPreferenceChangeListener(this);
// Lockscren OwnerInfo Size
mOwnerInfoFontSize = (CustomSeekBarPreference) findPreference(LOCKOWNER_FONT_SIZE);
mOwnerInfoFontSize.setValue(Settings.System.getInt(getContentResolver(),
Settings.System.LOCKOWNER_FONT_SIZE,21));
mOwnerInfoFontSize.setOnPreferenceChangeListener(this);
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -115,6 +132,17 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKDATE_FONT_SIZE, top*1);
return true;
} else if (preference == mLockOwnerInfoFonts) {
Settings.System.putInt(getContentResolver(), Settings.System.LOCK_OWNERINFO_FONTS,
Integer.valueOf((String) newValue));
mLockOwnerInfoFonts.setValue(String.valueOf(newValue));
mLockOwnerInfoFonts.setSummary(mLockOwnerInfoFonts.getEntry());
return true;
} else if (preference == mOwnerInfoFontSize) {
int top = (Integer) newValue;
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKOWNER_FONT_SIZE, top*1);
return true;
}
return false;
}