mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Fix NPE inside SEarchResultThumbnailView on cropping
Bug: 175161949 Test: builds. Created screenshot of landscape portion and verified Change-Id: Ib80147bcb40cf73364e8bed91f38019716aa71c8
This commit is contained in:
@@ -88,9 +88,15 @@ public class ThumbnailSearchResultView extends androidx.appcompat.widget.AppComp
|
||||
bitmap = ((BitmapDrawable) target.getRemoteAction().getIcon()
|
||||
.loadDrawable(getContext())).getBitmap();
|
||||
// crop
|
||||
bitmap = Bitmap.createBitmap(bitmap, 0,
|
||||
bitmap.getHeight() / 2 - bitmap.getWidth() / 2,
|
||||
bitmap.getWidth(), bitmap.getWidth());
|
||||
if (bitmap.getWidth() < bitmap.getHeight()) {
|
||||
bitmap = Bitmap.createBitmap(bitmap, 0,
|
||||
bitmap.getHeight() / 2 - bitmap.getWidth() / 2,
|
||||
bitmap.getWidth(), bitmap.getWidth());
|
||||
} else {
|
||||
bitmap = Bitmap.createBitmap(bitmap, bitmap.getWidth() / 2 - bitmap.getHeight() / 2,
|
||||
0,
|
||||
bitmap.getHeight(), bitmap.getHeight());
|
||||
}
|
||||
setTag(itemInfo);
|
||||
} else {
|
||||
bitmap = (Bitmap) target.getExtras().getParcelable("bitmap");
|
||||
|
||||
Reference in New Issue
Block a user