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

Commit 1818fb7a authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Dismissing popup if the underlying icon no longer supports it

Bug: 168641545
Change-Id: Ia4f44819af02397efaead935db3fc8e305e47ba7
parent a204de7d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2497,6 +2497,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
    @Override
    public void bindAllApplications(AppInfo[] apps, int flags) {
        mAppsView.getAppsStore().setApps(apps, flags);
        PopupContainerWithArrow.dismissInvalidPopup(this);
    }

    /**
@@ -2528,6 +2529,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
    public void bindWorkspaceItemsChanged(List<WorkspaceItemInfo> updated) {
        if (!updated.isEmpty()) {
            mWorkspace.updateShortcuts(updated);
            PopupContainerWithArrow.dismissInvalidPopup(this);
        }
    }

@@ -2552,6 +2554,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
    public void bindWorkspaceComponentsRemoved(final ItemInfoMatcher matcher) {
        mWorkspace.removeItemsByMatcher(matcher);
        mDragController.onAppsRemoved(matcher);
        PopupContainerWithArrow.dismissInvalidPopup(this);
    }

    @Override
+11 −0
Original line number Diff line number Diff line
@@ -599,6 +599,17 @@ public class PopupContainerWithArrow<T extends BaseDraggingActivity> extends Arr
        }
    }

    /**
     * Dismisses the popup if it is no longer valid
     */
    public static void dismissInvalidPopup(BaseDraggingActivity activity) {
        PopupContainerWithArrow popup = getOpen(activity);
        if (popup != null && (!popup.mOriginalIcon.isAttachedToWindow()
                || !canShow(popup.mOriginalIcon, (ItemInfo) popup.mOriginalIcon.getTag()))) {
            popup.animateClose();
        }
    }

    /**
     * Handler to control drag-and-drop for popup items
     */
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.IntArray;
@@ -296,6 +297,7 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
    @Override
    public void bindAllApplications(AppInfo[] apps, int flags) {
        mAppsView.getAppsStore().setApps(apps, flags);
        PopupContainerWithArrow.dismissInvalidPopup(this);
    }

    public PopupDataProvider getPopupDataProvider() {