diff options
author | Winson Chung <winsonc@google.com> | 2015-06-25 11:36:50 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2015-06-25 13:14:14 -0700 |
commit | 5ffd51db0c6d7686352f84fd52b4963bd528cd36 (patch) | |
tree | b11e4085fa988e78493ba5a89a83c5f56fe81c16 | |
parent | 2a1d4ed54feb26405c0c6253df5431303cedefa8 (diff) | |
download | android_packages_apps_Trebuchet-5ffd51db0c6d7686352f84fd52b4963bd528cd36.tar.gz android_packages_apps_Trebuchet-5ffd51db0c6d7686352f84fd52b4963bd528cd36.tar.bz2 android_packages_apps_Trebuchet-5ffd51db0c6d7686352f84fd52b4963bd528cd36.zip |
Exposing drag methods with user info.
Change-Id: I974b67d23d3d29795c1c1d24e1ecf212b52e3912
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 77c45407f..7a709f18d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -4490,42 +4490,63 @@ public class Launcher extends Activity if (mSearchDropTargetBar != null) mSearchDropTargetBar.hideSearchBar(false); } + // TODO: These method should be a part of LauncherSearchCallback public ItemInfo createAppDragInfo(Intent appLaunchIntent) { - // Called from search suggestion, not supported in other profiles. - final UserHandleCompat myUser = UserHandleCompat.myUserHandle(); + // Called from search suggestion + return createAppDragInfo(appLaunchIntent, UserHandleCompat.myUserHandle()); + } + + // TODO: This method should be a part of LauncherSearchCallback + public ItemInfo createAppDragInfo(Intent appLaunchIntent, UserHandleCompat user) { + if (user == null) { + user = UserHandleCompat.myUserHandle(); + } + + // Called from search suggestion, add the profile extra to the intent to ensure that we + // can launch it correctly + long serialNumber = UserManagerCompat.getInstance(this).getSerialNumberForUser(user); + appLaunchIntent.putExtra(AppInfo.EXTRA_PROFILE, serialNumber); LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(this); LauncherActivityInfoCompat activityInfo = launcherApps.resolveActivity(appLaunchIntent, - myUser); + user); if (activityInfo == null) { return null; } - return new AppInfo(this, activityInfo, myUser, mIconCache); + return new AppInfo(this, activityInfo, user, mIconCache); } + // TODO: This method should be a part of LauncherSearchCallback public ItemInfo createShortcutDragInfo(Intent shortcutIntent, CharSequence caption, Bitmap icon) { - // Called from search suggestion, not supported in other profiles. + // Called from search suggestion return createShortcutDragInfo(shortcutIntent, caption, icon, UserHandleCompat.myUserHandle()); } + // TODO: This method should be a part of LauncherSearchCallback public ItemInfo createShortcutDragInfo(Intent shortcutIntent, CharSequence caption, Bitmap icon, UserHandleCompat user) { + if (user == null) { + user = UserHandleCompat.myUserHandle(); + } + + // Called from search suggestion UserManagerCompat userManager = UserManagerCompat.getInstance(this); CharSequence contentDescription = userManager.getBadgedLabelForUser(caption, user); return new ShortcutInfo(shortcutIntent, caption, contentDescription, icon, user); } - protected void moveWorkspaceToDefaultScreen() { - mWorkspace.moveToDefaultScreen(false); - } - + // TODO: This method should be a part of LauncherSearchCallback public void startDrag(View dragView, ItemInfo dragInfo, DragSource source) { dragView.setTag(dragInfo); mWorkspace.onExternalDragStartedWithItem(dragView); mWorkspace.beginExternalDragShared(dragView, source); } + protected void moveWorkspaceToDefaultScreen() { + mWorkspace.moveToDefaultScreen(false); + } + @Override public void onPageSwitch(View newPage, int newPageIndex) { if (mLauncherCallbacks != null) { |