mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Fixing issue where shortcuts and widgets were not being removed when the package was uninstalled (Bug 2657997, Bug 6335843)
- Also fixes issue if we are dragging a shortcut/widget and it is removed. - Also exposes App Info for shortcuts and widgets Change-Id: I3bd5056f50f20e8b277dde6456df26eac815bcde
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher2;
|
||||
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -62,8 +63,8 @@ public class InfoDropTarget extends ButtonDropTarget {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAllAppsApplication(DragSource source, Object info) {
|
||||
return (source instanceof AppsCustomizePagedView) && (info instanceof ApplicationInfo);
|
||||
private boolean isFromAllApps(DragSource source) {
|
||||
return (source instanceof AppsCustomizePagedView);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +77,8 @@ public class InfoDropTarget extends ButtonDropTarget {
|
||||
componentName = ((ApplicationInfo) d.dragInfo).componentName;
|
||||
} else if (d.dragInfo instanceof ShortcutInfo) {
|
||||
componentName = ((ShortcutInfo) d.dragInfo).intent.getComponent();
|
||||
} else if (d.dragInfo instanceof PendingAddItemInfo) {
|
||||
componentName = ((PendingAddItemInfo) d.dragInfo).componentName;
|
||||
}
|
||||
if (componentName != null) {
|
||||
mLauncher.startApplicationDetailsActivity(componentName);
|
||||
@@ -90,8 +93,8 @@ public class InfoDropTarget extends ButtonDropTarget {
|
||||
public void onDragStart(DragSource source, Object info, int dragAction) {
|
||||
boolean isVisible = true;
|
||||
|
||||
// If we are dragging a widget or shortcut, hide the info target
|
||||
if (!isAllAppsApplication(source, info)) {
|
||||
// Hide this button unless we are dragging something from AllApps
|
||||
if (!isFromAllApps(source)) {
|
||||
isVisible = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user