Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8aee0b2c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensure the icon load request matches the ItemInfo for the floating...

Merge "Ensure the icon load request matches the ItemInfo for the floating view." into ub-launcher3-qt-qpr1-dev
parents 735d1fe1 bdda7251
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -721,7 +721,7 @@ public class FloatingIconView extends View implements
     */
    @UiThread
    public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
        IconLoadResult result = new IconLoadResult();
        IconLoadResult result = new IconLoadResult(info);
        new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
            RectF position = new RectF();
            getLocationBoundsForView(l, v, isOpening, position);
@@ -750,11 +750,14 @@ public class FloatingIconView extends View implements

        // Get the drawable on the background thread
        boolean shouldLoadIcon = originalView.getTag() instanceof ItemInfo && hideOriginal;
        if (shouldLoadIcon) {
            if (sIconLoadResult != null && sIconLoadResult.itemInfo == originalView.getTag()) {
                view.mIconLoadResult = sIconLoadResult;
        if (shouldLoadIcon && view.mIconLoadResult == null) {
            } else {
                view.mIconLoadResult = fetchIcon(launcher, originalView,
                        (ItemInfo) originalView.getTag(), isOpening);
            }
        }
        sIconLoadResult = null;

        view.mIsVerticalBarLayout = launcher.getDeviceProfile().isVerticalBarLayout();
@@ -895,10 +898,15 @@ public class FloatingIconView extends View implements
    }

    private static class IconLoadResult {
        final ItemInfo itemInfo;
        Drawable drawable;
        Drawable badge;
        int iconOffset;
        Runnable onIconLoaded;
        boolean isIconLoaded;

        public IconLoadResult(ItemInfo itemInfo) {
            this.itemInfo = itemInfo;
        }
    }
}