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:
committed by
Shivangi Dubey
parent
c3ff29b124
commit
0f4ec2b1b7
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.widget;
|
||||
|
||||
import android.annotation.AnyRes;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
@@ -38,6 +39,7 @@ import com.android.settings.Utils;
|
||||
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||
import com.android.settings.core.PreferenceXmlParserUtils.MetadataFlag;
|
||||
import com.android.settingslib.widget.CandidateInfo;
|
||||
import com.android.settingslib.widget.IllustrationPreference;
|
||||
import com.android.settingslib.widget.SelectorWithWidgetPreference;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
@@ -64,7 +66,7 @@ public abstract class RadioButtonPickerFragment extends SettingsPreferenceFragme
|
||||
protected int mUserId;
|
||||
private int mIllustrationId;
|
||||
private int mIllustrationPreviewId;
|
||||
private VideoPreference mVideoPreference;
|
||||
private IllustrationType mIllustrationType;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -252,18 +254,41 @@ public abstract class RadioButtonPickerFragment extends SettingsPreferenceFragme
|
||||
/**
|
||||
* Allows you to set an illustration at the top of this screen. Set the illustration id to 0
|
||||
* if you want to remove the illustration.
|
||||
* @param illustrationId The res id for the raw of the illustration.
|
||||
* @param previewId The res id for the drawable of the illustration
|
||||
*
|
||||
* @param illustrationId The res id for the raw of the illustration.
|
||||
* @param previewId The res id for the drawable of the illustration.
|
||||
* @param illustrationType The illustration type for the raw of the illustration.
|
||||
*/
|
||||
protected void setIllustration(int illustrationId, int previewId) {
|
||||
protected void setIllustration(@AnyRes int illustrationId, @AnyRes int previewId,
|
||||
IllustrationType illustrationType) {
|
||||
mIllustrationId = illustrationId;
|
||||
mIllustrationPreviewId = previewId;
|
||||
mIllustrationType = illustrationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to set an illustration at the top of this screen. Set the illustration id to 0
|
||||
* if you want to remove the illustration.
|
||||
*
|
||||
* @param illustrationId The res id for the raw of the illustration.
|
||||
* @param illustrationType The illustration type for the raw of the illustration.
|
||||
*/
|
||||
protected void setIllustration(@AnyRes int illustrationId, IllustrationType illustrationType) {
|
||||
setIllustration(illustrationId, 0, illustrationType);
|
||||
}
|
||||
|
||||
private void addIllustration(PreferenceScreen screen) {
|
||||
mVideoPreference = new VideoPreference(getContext());
|
||||
mVideoPreference.setVideo(mIllustrationId, mIllustrationPreviewId);
|
||||
screen.addPreference(mVideoPreference);
|
||||
switch (mIllustrationType) {
|
||||
case LOTTIE_ANIMATION:
|
||||
IllustrationPreference illustrationPreference = new IllustrationPreference(
|
||||
getContext());
|
||||
illustrationPreference.setLottieAnimationResId(mIllustrationId);
|
||||
screen.addPreference(illustrationPreference);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid illustration type: " + mIllustrationType);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract List<? extends CandidateInfo> getCandidates();
|
||||
@@ -284,4 +309,8 @@ public abstract class RadioButtonPickerFragment extends SettingsPreferenceFragme
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected enum IllustrationType {
|
||||
LOTTIE_ANIMATION
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user