OSDN Git Service

Small UI fix for widgets/app info shortcuts
authorTony Wickham <twickham@google.com>
Mon, 3 Apr 2017 21:27:04 +0000 (14:27 -0700)
committerTony Wickham <twickham@google.com>
Mon, 3 Apr 2017 22:58:50 +0000 (15:58 -0700)
- Switch order of widgets & more and app info.
- Start binding widgets after starting to update these shortcuts on the
  UI thread, so that they will show up without waiting for the bind
  logic, which can take a while. We already have a callback mechanism
  for enabling widgets & more after widgets are bound, so this was how
  it was supposed to work already.

Change-Id: I5f702f9c0814d30acf6298be309c6dc30727316e

src/com/android/launcher3/popup/PopupDataProvider.java
src/com/android/launcher3/popup/PopupPopulator.java

index b101bc5..c1a9ba1 100644 (file)
@@ -50,8 +50,8 @@ public class PopupDataProvider implements NotificationListener.NotificationsChan
 
     /** Note that these are in order of priority. */
     public static final SystemShortcut[] SYSTEM_SHORTCUTS = new SystemShortcut[] {
-            new SystemShortcut.Widgets(),
             new SystemShortcut.AppInfo(),
+            new SystemShortcut.Widgets(),
     };
 
     private final Launcher mLauncher;
index a9f219b..838b9b1 100644 (file)
@@ -211,12 +211,17 @@ public class PopupPopulator {
 
                 // This ensures that mLauncher.getWidgetsForPackageUser()
                 // doesn't return null (it puts all the widgets in memory).
-                launcher.notifyWidgetProvidersChanged(true /* force */);
                 for (int i = 0; i < PopupDataProvider.SYSTEM_SHORTCUTS.length; i++) {
                     final SystemShortcut systemShortcut = PopupDataProvider.SYSTEM_SHORTCUTS[i];
                     uiHandler.post(new UpdateSystemShortcutChild(container,
                             systemShortcutViews.get(i), systemShortcut, launcher, originalInfo));
                 }
+                uiHandler.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        launcher.notifyWidgetProvidersChanged(true /* force */);
+                    }
+                });
             }
         };
     }