Fine-tune the widget of "Allow rich content in Accessibility Settings" for security.
1. Remove tag checker in HtmlTextPreference.
2. Set the max height for AnimatedImagePreference.
Bug: 149516547
Test: manaul test
Change-Id: I98f49d055db9427d91a3f1ca816e94a11d29cd3d
Merged-In: I98f49d055db9427d91a3f1ca816e94a11d29cd3d
(cherry picked from commit 10bc375176)
This commit is contained in:
@@ -34,6 +34,7 @@ import com.android.settings.R;
|
||||
public class AnimatedImagePreference extends Preference {
|
||||
|
||||
private Uri mImageUri;
|
||||
private int mMaxHeight = -1;
|
||||
|
||||
AnimatedImagePreference(Context context) {
|
||||
super(context);
|
||||
@@ -45,20 +46,26 @@ public class AnimatedImagePreference extends Preference {
|
||||
super.onBindViewHolder(holder);
|
||||
|
||||
final ImageView imageView = holder.itemView.findViewById(R.id.animated_img);
|
||||
if (imageView != null && mImageUri != null) {
|
||||
if (imageView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mImageUri != null) {
|
||||
imageView.setImageURI(mImageUri);
|
||||
|
||||
final Drawable drawable = imageView.getDrawable();
|
||||
if (drawable != null) {
|
||||
if (drawable instanceof AnimatedImageDrawable) {
|
||||
((AnimatedImageDrawable) drawable).start();
|
||||
}
|
||||
if (drawable instanceof AnimatedImageDrawable) {
|
||||
((AnimatedImageDrawable) drawable).start();
|
||||
}
|
||||
}
|
||||
|
||||
if (mMaxHeight > -1) {
|
||||
imageView.setMaxWidth(mMaxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image uri to display image in {@link ImageView}
|
||||
* Sets image uri to display image in {@link ImageView}
|
||||
*
|
||||
* @param imageUri the Uri of an image
|
||||
*/
|
||||
@@ -68,4 +75,16 @@ public class AnimatedImagePreference extends Preference {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum height of the view.
|
||||
*
|
||||
* @param maxHeight the maximum height of ImageView in terms of pixels.
|
||||
*/
|
||||
public void setMaxHeight(int maxHeight) {
|
||||
if (maxHeight != mMaxHeight) {
|
||||
mMaxHeight = maxHeight;
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user