summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/popup/PopupDataProvider.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-04-13 16:24:38 -0700
committerTony Wickham <twickham@google.com>2017-04-20 15:10:38 -0700
commita7e1c1c08854930ddb4366698d5bf079ae0536f3 (patch)
tree7ca715956276ac891cd4f5eced4db8c84a15633f /src/com/android/launcher3/popup/PopupDataProvider.java
parent343a77e609382bcb9b1d69ea235a9e6d779b719e (diff)
downloadandroid_packages_apps_Trebuchet-a7e1c1c08854930ddb4366698d5bf079ae0536f3.tar.gz
android_packages_apps_Trebuchet-a7e1c1c08854930ddb4366698d5bf079ae0536f3.tar.bz2
android_packages_apps_Trebuchet-a7e1c1c08854930ddb4366698d5bf079ae0536f3.zip
Only add widgets system shortcut if widgets exist
Before we were adding it in a disabled state, and then enabling it once widgets were bound (if widgets existed for that app). Now we load all widgets when launcher starts so that we can use the values for the purpose of animating the popup container. Then, as the container opens, we reload widgets/shortcuts for that particular app and add/remove the widgets shortcut if necessary. Bug: 34940468 Change-Id: I64bd009442d10d3d1f9a977bdedfdb639a7dd193
Diffstat (limited to 'src/com/android/launcher3/popup/PopupDataProvider.java')
-rw-r--r--src/com/android/launcher3/popup/PopupDataProvider.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/launcher3/popup/PopupDataProvider.java b/src/com/android/launcher3/popup/PopupDataProvider.java
index c1a9ba1bc..eaceaa959 100644
--- a/src/com/android/launcher3/popup/PopupDataProvider.java
+++ b/src/com/android/launcher3/popup/PopupDataProvider.java
@@ -33,6 +33,7 @@ import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.MultiHashMap;
import com.android.launcher3.util.PackageUserKey;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -49,7 +50,7 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
private static final String TAG = "PopupDataProvider";
/** Note that these are in order of priority. */
- public static final SystemShortcut[] SYSTEM_SHORTCUTS = new SystemShortcut[] {
+ private static final SystemShortcut[] SYSTEM_SHORTCUTS = new SystemShortcut[] {
new SystemShortcut.AppInfo(),
new SystemShortcut.Widgets(),
};
@@ -240,6 +241,16 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
: notificationListener.getNotificationsForKeys(notificationKeys);
}
+ public @NonNull List<SystemShortcut> getEnabledSystemShortcutsForItem(ItemInfo info) {
+ List<SystemShortcut> systemShortcuts = new ArrayList<>();
+ for (SystemShortcut systemShortcut : SYSTEM_SHORTCUTS) {
+ if (systemShortcut.getOnClickListener(mLauncher, info) != null) {
+ systemShortcuts.add(systemShortcut);
+ }
+ }
+ return systemShortcuts;
+ }
+
public void cancelNotification(String notificationKey) {
NotificationListener notificationListener = NotificationListener.getInstanceIfConnected();
if (notificationListener == null) {