Cherish:Add Lockscreen Date n Clock Sizes [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
SuperDroidBond
2018-10-21 23:28:15 +05:30
committed by Hưng Phan
parent 3f9bd00ab7
commit e02b66dda8
3 changed files with 50 additions and 0 deletions

View File

@@ -421,4 +421,9 @@
<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>
<!-- Lock Clock & Date Size -->
<string name="lockdate_font_size_title">Date font size</string>
<string name="lockclock_font_size_title">Clock font size</string>
</resources>

View File

@@ -62,6 +62,24 @@
android:summary="@string/lock_date_font_summary"
android:persistent="false" />
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="lockclock_font_size"
android:title="@string/lockclock_font_size_title"
android:max="101"
settings:min="65"
settings:units="dp"
android:persistent="false"
android:defaultValue="78" />
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="lockdate_font_size"
android:title="@string/lockdate_font_size_title"
android:max="25"
settings:min="10"
settings:units="dp"
android:defaultValue="18"
android:persistent="false" />
</PreferenceCategory>
<!-- Lockscreen Visualizer-->

View File

@@ -39,15 +39,20 @@ import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.cherish.settings.preferences.SystemSettingListPreference;
import com.cherish.settings.preferences.CustomSeekBarPreference;
public class LockScreenSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String LOCK_CLOCK_FONTS = "lock_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 DATE_FONT_SIZE = "lockdate_font_size";
private ListPreference mLockClockFonts;
private ListPreference mLockDateFonts;
private CustomSeekBarPreference mClockFontSize;
private CustomSeekBarPreference mDateFontSize;
@Override
public void onCreate(Bundle icicle) {
@@ -71,6 +76,18 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
getContentResolver(), Settings.System.LOCK_DATE_FONTS, 32)));
mLockDateFonts.setSummary(mLockDateFonts.getEntry());
mLockDateFonts.setOnPreferenceChangeListener(this);
// Lock Clock Size
mClockFontSize = (CustomSeekBarPreference) findPreference(CLOCK_FONT_SIZE);
mClockFontSize.setValue(Settings.System.getInt(getContentResolver(),
Settings.System.LOCKCLOCK_FONT_SIZE, 78));
mClockFontSize.setOnPreferenceChangeListener(this);
// Lock Date Size
mDateFontSize = (CustomSeekBarPreference) findPreference(DATE_FONT_SIZE);
mDateFontSize.setValue(Settings.System.getInt(getContentResolver(),
Settings.System.LOCKDATE_FONT_SIZE, 18));
mDateFontSize.setOnPreferenceChangeListener(this);
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -88,6 +105,16 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
mLockDateFonts.setValue(String.valueOf(newValue));
mLockDateFonts.setSummary(mLockDateFonts.getEntry());
return true;
} else if (preference == mClockFontSize) {
int top = (Integer) newValue;
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKCLOCK_FONT_SIZE, top*1);
return true;
} else if (preference == mDateFontSize) {
int top = (Integer) newValue;
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKDATE_FONT_SIZE, top*1);
return true;
}
return false;
}