Skip to content

Commit

Permalink
Fixed: Fix overlay color filter messing up screen on API <=28
Browse files Browse the repository at this point in the history
For Android <= 9, `PorterDuff.Mode.MULTIPLY` causing unusable screen lag. Change to `PorterDuff.Mode.DARKEN`.
  • Loading branch information
Kruna1Pate1 authored and Leonid P committed May 3, 2023
1 parent ad77748 commit 6aa99e7
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -10,6 +10,7 @@
import android.graphics.ImageDecoder;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.ThumbnailUtils;
Expand Down Expand Up @@ -174,9 +175,9 @@ public static Drawable getDrawable(String path) {
public static void addOverlay(Drawable drawable, int color) {

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
drawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.MULTIPLY));
drawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.DARKEN));
} else {
drawable.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.DARKEN));
}
}

Expand Down

0 comments on commit 6aa99e7

Please sign in to comment.