Cherish: Lottie Animation selection for Keyguard clock styles [2/2]

SDB: disable it as per the clock selection option
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Advaith Bhat
2021-05-03 15:55:40 +00:00
committed by Hưng Phan
parent 246c09b035
commit fb90dc38b9
4 changed files with 62 additions and 0 deletions

View File

@@ -1368,4 +1368,23 @@
<item>0</item>
<item>1</item>
</string-array>
<!-- Clock Lottie animations -->
<string-array name="clock_lottie_animation_entries" translatable="false">
<item>@string/clock_lottie_animation_hidden</item>
<item>@string/clock_lottie_animation_explosion_circle</item>
<item>@string/clock_lottie_animation_blue_circle</item>
<item>@string/clock_lottie_animation_blue_circle_2</item>
<item>@string/clock_lottie_animation_rainbow_circle</item>
<item>@string/clock_lottie_animation_fire_circle</item>
</string-array>
<string-array name="clock_lottie_animation_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</string-array>
</resources>

View File

@@ -1400,4 +1400,13 @@
<string name="status_bar_temperature_show_scale_hide_image">Show temp with scale</string>
<string name="status_bar_temperature_hide_scale_hide_image">Show temp without scale</string>
<string name="status_bar_show_image">Show image</string>
<!-- Clock lottie animations -->
<string name="clock_lottie_animation_title">Lottie Animation</string>
<string name="clock_lottie_animation_hidden">Hidden</string>
<string name="clock_lottie_animation_explosion_circle">Explosion Circle</string>
<string name="clock_lottie_animation_blue_circle">Blue Circle</string>
<string name="clock_lottie_animation_blue_circle_2">Blue Circle v2</string>
<string name="clock_lottie_animation_rainbow_circle">Rainbow Circle</string>
<string name="clock_lottie_animation_fire_circle">Fire Circle</string>
</resources>

View File

@@ -78,6 +78,14 @@
<PreferenceCategory
android:title="Lock Clock"/>
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="lockscreen_clock_animation_selection"
android:title="@string/clock_lottie_animation_title"
android:entries="@array/clock_lottie_animation_entries"
android:entryValues="@array/clock_lottie_animation_values"
android:summary="%s"
android:defaultValue="0" />
<com.cherish.settings.preferences.SecureSettingListPreference
android:key="lockscreen_clock_selection"
android:title="@string/lockscreen_clock_title"

View File

@@ -64,6 +64,8 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
private static final String AOD_SCHEDULE_KEY = "always_on_display_schedule";
private static final String FOD_ANIMATION_CATEGORY = "fod_animations";
private static final String FOD_ICON_PICKER_CATEGORY = "fod_icon_picker";
private static final String PREF_LS_CLOCK_SELECTION = "lockscreen_clock_selection";
private static final String PREF_LS_CLOCK_ANIM_SELECTION = "lockscreen_clock_animation_selection";
private ContentResolver mResolver;
private Preference FODSettings;
@@ -78,6 +80,8 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
private CustomSeekBarPreference mOwnerInfoFontSize;
private CustomSeekBarPreference mCustomTextClockFontSize;
private PreferenceCategory mFODIconPickerCategory;
private SecureSettingListPreference mLockClockSelection;
private SystemSettingListPreference mLockClockAnimSelection;
private Preference mAODPref;
@Override
@@ -89,6 +93,18 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
PreferenceScreen prefScreen = getPreferenceScreen();
Resources resources = getResources();
mLockClockAnimSelection = (SystemSettingListPreference) findPreference(PREF_LS_CLOCK_ANIM_SELECTION);
mLockClockSelection = (SecureSettingListPreference) findPreference(PREF_LS_CLOCK_SELECTION);
int val = Settings.Secure.getIntForUser(resolver,
Settings.Secure.LOCKSCREEN_CLOCK_SELECTION, 2, UserHandle.USER_CURRENT);
mLockClockSelection.setOnPreferenceChangeListener(this);
if (val > 3 && val < 8) {
mLockClockAnimSelection.setEnabled(true);
} else {
mLockClockAnimSelection.setEnabled(false);
}
mFODIconPickerCategory = findPreference(FOD_ICON_PICKER_CATEGORY);
if (mFODIconPickerCategory != null && !FodUtils.hasFodSupport(getContext())) {
prefScreen.removePreference(mFODIconPickerCategory);
@@ -177,6 +193,16 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements
Settings.System.putInt(getContentResolver(),
Settings.System.LOCKDATE_FONT_SIZE, top*1);
return true;
} else if (preference == mLockClockSelection) {
int val = Integer.parseInt((String) newValue);
Settings.Secure.putInt(resolver,
Settings.Secure.LOCKSCREEN_CLOCK_SELECTION, val);
if (val > 3 && val < 8) {
mLockClockAnimSelection.setEnabled(true);
} else {
mLockClockAnimSelection.setEnabled(false);
}
return true;
}
return false;
}