use setAutoMirrored for image flipping on API 19 and higher

This commit is contained in:
Nazar-Kutz 2020-05-12 14:42:36 +03:00
parent 7906b9e632
commit 0ece2bcd0e

View file

@ -703,6 +703,10 @@ public class AndroidUtils {
public static Drawable getMirroredDrawable(@NonNull Context ctx, public static Drawable getMirroredDrawable(@NonNull Context ctx,
@NonNull Drawable drawable) { @NonNull Drawable drawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
drawable.setAutoMirrored(true);
return drawable;
}
Bitmap bitmap = drawableToBitmap(drawable); Bitmap bitmap = drawableToBitmap(drawable);
return new BitmapDrawable(ctx.getResources(), flipBitmapHorizontally(bitmap)); return new BitmapDrawable(ctx.getResources(), flipBitmapHorizontally(bitmap));
} }