diff options
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 3ae4316a9..7c258616f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -209,10 +209,8 @@ public class Launcher extends BaseActivity private boolean mIsSafeModeEnabled; - public static final int APPWIDGET_HOST_ID = 1024; public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 500; private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500; - private static final int ACTIVITY_START_DELAY = 1000; // How long to wait before the new-shortcut animation automatically pans the workspace private static final int NEW_APPS_PAGE_MOVE_DELAY = 500; @@ -397,7 +395,10 @@ public class Launcher extends BaseActivity mAppWidgetManager = AppWidgetManagerCompat.getInstance(this); - mAppWidgetHost = new LauncherAppWidgetHost(this, APPWIDGET_HOST_ID); + mAppWidgetHost = new LauncherAppWidgetHost(this); + if (Utilities.ATLEAST_MARSHMALLOW) { + mAppWidgetHost.addProviderChangeListener(this); + } mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, @@ -789,7 +790,7 @@ public class Launcher extends BaseActivity } @Override - protected void onActivityResult( + public void onActivityResult( final int requestCode, final int resultCode, final Intent data) { handleActivityResult(requestCode, resultCode, data); if (mLauncherCallbacks != null) { @@ -1468,23 +1469,25 @@ public class Launcher extends BaseActivity mWorkspace.addInScreen(view, info); } else { // Adding a shortcut to a Folder. - final long folderIconId = container; - FolderIcon folderIcon = (FolderIcon) mWorkspace.getFirstMatch(new ItemOperator() { - @Override - public boolean evaluate(ItemInfo info, View view) { - return info != null && info.id == folderIconId; - } - }); - + FolderIcon folderIcon = findFolderIcon(container); if (folderIcon != null) { FolderInfo folderInfo = (FolderInfo) folderIcon.getTag(); folderInfo.add(info, args.rank, false); } else { - Log.e(TAG, "Could not find folder with id " + folderIconId + " to add shortcut."); + Log.e(TAG, "Could not find folder with id " + container + " to add shortcut."); } } } + public FolderIcon findFolderIcon(final long folderIconId) { + return (FolderIcon) mWorkspace.getFirstMatch(new ItemOperator() { + @Override + public boolean evaluate(ItemInfo info, View view) { + return info != null && info.id == folderIconId; + } + }); + } + /** * Add a widget to the workspace. * |