Add illustrations to fold lock setting

Added illustrations to fold lock setting for all respective fold lock
setting values.
The illustrations can be found here: https://docs.google.com/presentation/d/1hSDuwaX0fqDSXO7LFmtgNcodaLftqUrgVT1cvfffp_Q/edit?resourcekey=0-ZJ0UdziPYZgD43a8I-cdIw#slide=id.g239e21e8ec8_0_0

Bug: 294194379
Test: Flash device with this change.
* Set diffrent values of fold lock setting
* Verify correct illustration is showed for respective setting value

Change-Id: I16af550b70e951d29bf5e0e2c9e8513473461528
This commit is contained in:
dshivangi
2023-09-08 16:52:06 +00:00
committed by Shivangi Dubey
parent c3ff29b124
commit 0f4ec2b1b7
5 changed files with 66 additions and 9 deletions

View File

@@ -48,18 +48,18 @@ public class FoldLockBehaviorSettings extends RadioButtonPickerFragment implemen
public static final String SETTING_VALUE_STAY_AWAKE_ON_FOLD = "stay_awake_on_fold_key";
public static final String SETTING_VALUE_SELECTIVE_STAY_AWAKE = "selective_stay_awake_key";
public static final String SETTING_VALUE_SLEEP_ON_FOLD = "sleep_on_fold_key";
private static final String SETTING_VALUE_DEFAULT = SETTING_VALUE_SELECTIVE_STAY_AWAKE;
public static final String TAG = "FoldLockBehaviorSetting";
public static final HashSet<String> SETTING_VALUES = new HashSet<>(
Set.of(SETTING_VALUE_STAY_AWAKE_ON_FOLD, SETTING_VALUE_SELECTIVE_STAY_AWAKE,
SETTING_VALUE_SLEEP_ON_FOLD));
private static final String SETTING_VALUE_DEFAULT = SETTING_VALUE_SELECTIVE_STAY_AWAKE;
private Context mContext;
@Override
public void onAttach(Context context) {
super.onAttach(context);
mContext = context;
setIllustrationLottieAnimation(getDefaultKey());
}
@Override
@@ -136,6 +136,31 @@ public class FoldLockBehaviorSettings extends RadioButtonPickerFragment implemen
UserHandle.USER_CURRENT);
}
@Override
protected void onSelectionPerformed(boolean success) {
if (success) {
setIllustrationLottieAnimation(getDefaultKey());
updateCandidates();
}
}
private void setIllustrationLottieAnimation(String foldSettingValue) {
switch (foldSettingValue) {
case SETTING_VALUE_STAY_AWAKE_ON_FOLD:
setIllustration(R.raw.fold_setting_stay_awake_on_fold_lottie,
IllustrationType.LOTTIE_ANIMATION);
break;
case SETTING_VALUE_SELECTIVE_STAY_AWAKE:
setIllustration(R.raw.fold_setting_selective_stay_awake_lottie,
IllustrationType.LOTTIE_ANIMATION);
break;
case SETTING_VALUE_SLEEP_ON_FOLD:
setIllustration(R.raw.fold_setting_sleep_on_fold_lottie,
IllustrationType.LOTTIE_ANIMATION);
break;
}
}
private String resourceToString(int resource) {
return mContext.getText(resource).toString();
}