mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 06:38:29 +02:00
Added setting to disable image animation
This commit is contained in:
@@ -302,7 +302,8 @@ class ImageHelper {
|
||||
}
|
||||
|
||||
static Drawable decodeImage(final Context context, final long id, String source, boolean show, int zoom, final float scale, final TextView view) {
|
||||
return decodeImage(context, id, source, 0, 0, false, show, zoom, scale, view);
|
||||
Drawable d = decodeImage(context, id, source, 0, 0, false, show, zoom, scale, view);
|
||||
return animate(context, d);
|
||||
}
|
||||
|
||||
static Drawable decodeImage(final Context context, final long id, Element img, boolean show, int zoom, final float scale, final TextView view) {
|
||||
@@ -310,7 +311,8 @@ class ImageHelper {
|
||||
Integer w = Helper.parseInt(img.attr("width"));
|
||||
Integer h = Helper.parseInt(img.attr("height"));
|
||||
boolean tracking = !TextUtils.isEmpty(img.attr("x-tracking"));
|
||||
return decodeImage(context, id, source, w == null ? 0 : w, h == null ? 0 : h, tracking, show, zoom, scale, view);
|
||||
Drawable d = decodeImage(context, id, source, w == null ? 0 : w, h == null ? 0 : h, tracking, show, zoom, scale, view);
|
||||
return animate(context, d);
|
||||
}
|
||||
|
||||
private static Drawable decodeImage(final Context context, final long id,
|
||||
@@ -528,10 +530,7 @@ class ImageHelper {
|
||||
lld.setBounds(0, 0, bounds.width(), bounds.height());
|
||||
lld.setLevel(0);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
if (d instanceof AnimatedImageDrawable)
|
||||
((AnimatedImageDrawable) d).start();
|
||||
}
|
||||
animate(context, d);
|
||||
|
||||
view.setText(view.getText());
|
||||
|
||||
@@ -869,6 +868,20 @@ class ImageHelper {
|
||||
return bm;
|
||||
}
|
||||
|
||||
static Drawable animate(Context context, Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
|
||||
return drawable;
|
||||
|
||||
if (drawable instanceof AnimatedImageDrawable) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean animate_images = prefs.getBoolean("animate_images", true);
|
||||
if (animate_images)
|
||||
((AnimatedImageDrawable) drawable).start();
|
||||
}
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
||||
static Matrix getImageRotation(File file) {
|
||||
try {
|
||||
ExifInterface exif = new ExifInterface(file);
|
||||
|
||||
Reference in New Issue
Block a user