Merge "Dismissing popup if the underlying icon no longer supports it" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
d7f0ead7e5
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user