summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-12-28 22:18:49 +0000
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2012-12-29 02:05:44 -0800
commit3786ed8df9344d365d063406828afee8293acda8 (patch)
tree36697f8caa98447f65ef9e538f0dcc6d114fadaa /src
parentce7dcdd77320ff852f4b8b53ededd4220379fe44 (diff)
downloadandroid_packages_apps_Trebuchet-3786ed8df9344d365d063406828afee8293acda8.tar.gz
android_packages_apps_Trebuchet-3786ed8df9344d365d063406828afee8293acda8.tar.bz2
android_packages_apps_Trebuchet-3786ed8df9344d365d063406828afee8293acda8.zip
Launcher: Remove long-press menu
Change-Id: Ie513c0c815fcfa0daa2d5503d3c060ae8e2109c0
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/trebuchet/AddAdapter.java23
-rw-r--r--src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java26
-rw-r--r--src/com/cyanogenmod/trebuchet/DeleteDropTarget.java13
-rw-r--r--src/com/cyanogenmod/trebuchet/Launcher.java416
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherAction.java106
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherActionInfo.java23
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherModel.java80
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherProvider.java23
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherSettings.java7
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewWidget.java12
-rw-r--r--src/com/cyanogenmod/trebuchet/PendingAddItemInfo.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java17
12 files changed, 89 insertions, 663 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AddAdapter.java b/src/com/cyanogenmod/trebuchet/AddAdapter.java
index a8c5930ea..5a3d43d05 100644
--- a/src/com/cyanogenmod/trebuchet/AddAdapter.java
+++ b/src/com/cyanogenmod/trebuchet/AddAdapter.java
@@ -38,11 +38,10 @@ public class AddAdapter extends BaseAdapter {
private final ArrayList<ListItem> mItems = new ArrayList<ListItem>();
- public static final int ITEM_APPLICATION = 0;
- public static final int ITEM_SHORTCUT = 1;
- public static final int ITEM_APPWIDGET = 2;
- public static final int ITEM_ACTION = 3;
- public static final int ITEM_WALLPAPER = 4;
+ public static final int ITEM_SHORTCUT = 0;
+ public static final int ITEM_APPWIDGET = 1;
+ public static final int ITEM_APPLICATION = 2;
+ public static final int ITEM_WALLPAPER = 3;
/**
* Specific item in our list.
@@ -62,7 +61,7 @@ public class AddAdapter extends BaseAdapter {
this.actionTag = actionTag;
}
}
-
+
public AddAdapter(Launcher launcher) {
super();
@@ -71,18 +70,6 @@ public class AddAdapter extends BaseAdapter {
// Create default actions
Resources res = launcher.getResources();
- mItems.add(new ListItem(res, R.string.group_applications,
- R.drawable.ic_launcher_application, ITEM_APPLICATION));
-
- mItems.add(new ListItem(res, R.string.group_shortcuts,
- R.drawable.ic_launcher_shortcut, ITEM_SHORTCUT));
-
- mItems.add(new ListItem(res, R.string.group_widgets,
- R.drawable.ic_launcher_appwidget, ITEM_APPWIDGET));
-
- mItems.add(new ListItem(res, R.string.group_actions,
- R.drawable.ic_launcher_home, ITEM_ACTION));
-
mItems.add(new ListItem(res, R.string.group_wallpapers,
R.drawable.ic_launcher_wallpaper, ITEM_WALLPAPER));
}
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
index 127f28fed..d1a200661 100644
--- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
+++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
@@ -646,7 +646,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
AppWidgetManager.getInstance(mLauncher).getInstalledProviders();
Intent shortcutsIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
List<ResolveInfo> shortcuts = mPackageManager.queryIntentActivities(shortcutsIntent, 0);
- List<LauncherAction.Action> launcherActions = LauncherAction.getAllActions();
for (AppWidgetProviderInfo widget : widgets) {
if (widget.minWidth > 0 && widget.minHeight > 0) {
// Ensure that all widgets we show can be added on a workspace of this size
@@ -667,7 +666,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
mWidgets.addAll(shortcuts);
- mWidgets.addAll(launcherActions);
Collections.sort(mWidgets,
new LauncherModel.WidgetAndShortcutNameComparator(mLauncher, mPackageManager));
updatePageCounts();
@@ -1434,19 +1432,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
return preview;
}
- private Bitmap getShortcutPreview(LauncherAction.Action info) {
- int offset = 0;
- int bitmapSize = mAppIconSize;
- Bitmap preview = Bitmap.createBitmap(bitmapSize, bitmapSize, Config.ARGB_8888);
-
- final Resources res = getContext().getResources();
-
- // Render the icon
- Drawable icon = res.getDrawable(info.getDrawable());
- renderDrawableToBitmap(icon, preview, offset, offset, mAppIconSize, mAppIconSize);
- return preview;
- }
-
private Bitmap getWidgetPreview(ComponentName provider, int previewImage, int iconId,
int cellHSpan, int cellVSpan, int maxWidth, int maxHeight) {
// Load the preview image if possible
@@ -1620,14 +1605,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
info.activityInfo.name);
widget.applyFromResolveInfo(mPackageManager, info);
widget.setTag(createItemInfo);
- } else if (rawInfo instanceof LauncherAction.Action) {
- // Fill in the actions information
- LauncherAction.Action info = (LauncherAction.Action) rawInfo;
- createItemInfo = new PendingAddActionInfo();
- ((PendingAddActionInfo)createItemInfo).action = info;
- createItemInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION;
- widget.applyFromLauncherAction(info);
- widget.setTag(createItemInfo);
}
widget.setOnClickListener(this);
widget.setOnLongClickListener(this);
@@ -1714,9 +1691,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Fill in the shortcuts information
ResolveInfo info = (ResolveInfo) item;
images.add(getShortcutPreview(info, data.maxImageWidth, data.maxImageHeight));
- } else if (item instanceof LauncherAction.Action) {
- LauncherAction.Action info = (LauncherAction.Action) item;
- images.add(getShortcutPreview(info));
}
}
}
diff --git a/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java b/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java
index 3a1e94e6d..4f15df7df 100644
--- a/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java
+++ b/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java
@@ -38,8 +38,6 @@ import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
-import com.cyanogenmod.trebuchet.R;
-
public class DeleteDropTarget extends ButtonDropTarget {
private static int DELETE_ANIMATION_DURATION = 285;
private static int FLING_DELETE_ANIMATION_DURATION = 350;
@@ -113,7 +111,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
switch (addInfo.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
return true;
}
}
@@ -149,6 +147,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
boolean isUninstall = false;
+ boolean isVisible = true;
// If we are dragging an application from AppsCustomize, only show the uninstall control if we
// can delete the app (it was downloaded)
@@ -160,12 +159,14 @@ public class DeleteDropTarget extends ButtonDropTarget {
} else if (isWorkspaceOrFolderApplication(source, info)) {
ShortcutInfo shortcutInfo = (ShortcutInfo) info;
PackageManager pm = getContext().getPackageManager();
- if (shortcutInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION) {
+ if (shortcutInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS) {
ResolveInfo resolveInfo = pm.resolveActivity(shortcutInfo.intent, 0);
if (resolveInfo != null && (resolveInfo.activityInfo.applicationInfo.flags &
android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) {
isUninstall = true;
}
+ } else {
+ isVisible = false;
}
}
@@ -173,12 +174,12 @@ public class DeleteDropTarget extends ButtonDropTarget {
mCurrentDrawable = getCompoundDrawables()[0];
mUninstall = isUninstall;
- mActive = true;
+ mActive = isVisible;
mMode = MODE_DELETE;
setTextColor(mOriginalTextColor);
resetHoverColor();
- ((ViewGroup) getParent()).setVisibility(View.VISIBLE);
+ ((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE);
if (getText().length() > 0) {
if (isAllAppsItem(source, info)) {
setText(R.string.cancel_target_label);
diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java
index 951fbe4f3..a65d4cf6a 100644
--- a/src/com/cyanogenmod/trebuchet/Launcher.java
+++ b/src/com/cyanogenmod/trebuchet/Launcher.java
@@ -30,7 +30,6 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AlertDialog;
-import android.app.Dialog;
import android.app.SearchManager;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
@@ -56,7 +55,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
@@ -150,14 +148,9 @@ public final class Launcher extends Activity
static final String EXTRA_SHORTCUT_DUPLICATE = "duplicate";
- static final String ACTION_LAUNCHER = "com.cyanogenmod.trebuchet.LAUNCHER_ACTION";
-
static final int MAX_SCREEN_COUNT = 7;
static final int DEFAULT_SCREEN = 2;
- static final int DIALOG_CREATE_SHORTCUT = 1;
- static final int DIALOG_CREATE_ACTION = 2;
-
private static final String PREFERENCES = "launcher.preferences";
static final String DUMP_STATE_PROPERTY = "debug.dumpstate";
@@ -613,10 +606,6 @@ public final class Launcher extends Activity
args.cellY);
result = true;
break;
- case REQUEST_PICK_APPWIDGET:
- addAppWidgetFromPick(args.intent, args.container, args.screen);
- // Don't remove pending add info
- return false;
case REQUEST_CREATE_APPWIDGET:
int appWidgetId = args.intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
completeAddAppWidget(appWidgetId, args.container, args.screen, null, null);
@@ -647,8 +636,24 @@ public final class Launcher extends Activity
return;
}
boolean delayExitSpringLoadedMode = false;
+ boolean isWidgetDrop = (requestCode == REQUEST_PICK_APPWIDGET ||
+ requestCode == REQUEST_CREATE_APPWIDGET);
mWaitingForResult = false;
+ // We have special handling for widgets
+ if (isWidgetDrop) {
+ int appWidgetId = data != null ?
+ data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1) : -1;
+ if (appWidgetId < 0) {
+ Log.e(TAG, "Error: appWidgetId (EXTRA_APPWIDGET_ID) was not returned from the \\" +
+ "widget configuration activity.");
+ completeTwoStageWidgetDrop(RESULT_CANCELED, appWidgetId);
+ } else {
+ completeTwoStageWidgetDrop(resultCode, appWidgetId);
+ }
+ return;
+ }
+
// The pattern used here is that a user PICKs a specific application,
// which, depending on the target, might need to CREATE the actual target.
@@ -1222,63 +1227,6 @@ public final class Launcher extends Activity
resetAddInfo();
}
- private void addAction(LauncherAction.Action action) {
- int[] cellXY = mPendingAddInfo.dropPos;
- int cellX = mPendingAddInfo.cellX;
- int cellY = mPendingAddInfo.cellY;
- long container = mPendingAddInfo.container;
- int screen = mPendingAddInfo.screen;
- CellLayout layout = getCellLayout(container, screen);
-
- boolean foundCellSpan;
-
- LauncherActionInfo info = new LauncherActionInfo();
- info.action = action;
- info.title = getResources().getString(action.getString());
- info.setIcon(((BitmapDrawable)getResources().getDrawable(action.getDrawable())).getBitmap());
-
- final View view = createShortcut(info);
-
- if (cellX >= 0 && cellY >= 0) {
- if (cellXY == null) {
- cellXY = new int[2];
- }
- cellXY[0] = cellX;
- cellXY[1] = cellY;
-
- foundCellSpan = true;
-
- // If appropriate, either create a folder or add to an existing folder
- if (mWorkspace.createUserFolderIfNecessary(view, container, layout, cellXY, 0,
- true, null,null)) {
- return;
- }
- DragObject dragObject = new DragObject();
- dragObject.dragInfo = info;
- if (mWorkspace.addToExistingFolderIfNecessary(layout, cellXY, 0, dragObject,
- true)) {
- return;
- }
- } else if (cellXY != null) {
- // when dragging and dropping, just find the closest free spot
- int[] result = layout.findNearestVacantArea(cellXY[0], cellXY[1], 1, 1, cellXY);
- foundCellSpan = (result != null);
- } else {
- foundCellSpan = layout.findCellForSpan(cellXY, 1, 1);
- }
-
- if (!foundCellSpan) {
- showOutOfSpaceMessage(isHotseatLayout(layout));
- } else if (cellXY != null) {
- LauncherModel.addItemToDatabase(this, info, container, screen, cellXY[0], cellXY[1], false);
-
- if (!mRestoring) {
- mWorkspace.addInScreen(view, container, screen, cellXY[0], cellXY[1], 1, 1,
- isWorkspaceLocked());
- }
- }
- }
-
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -1511,18 +1459,6 @@ public final class Launcher extends Activity
processIntent.run();
}
- } else if (ACTION_LAUNCHER.equals(intent.getAction())) {
- Bundle extras = intent.getExtras();
- if (extras == null) {
- return;
- }
- String actionString = extras.getString(Intent.EXTRA_TEXT);
- LauncherAction.Action action = LauncherAction.Action.valueOf(actionString);
- switch (action) {
- case AllApps:
- showAllApps(true);
- break;
- }
}
}
@@ -1792,26 +1728,6 @@ public final class Launcher extends Activity
mPendingAddInfo.dropPos = null;
}
- void addAppWidgetFromPick(Intent data, long container, int screen) {
- resetAddInfo();
- mPendingAddInfo.container = container;
- mPendingAddInfo.screen = screen;
-
- int appWidgetId = data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
- if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
- Log.e(TAG, "Invalid appWidgetId sent");
- return;
- }
-
- AppWidgetProviderInfo appWidget = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
-
- PendingAddWidgetInfo createItemInfo = new PendingAddWidgetInfo(appWidget, null, null);
- createItemInfo.container = container;
- createItemInfo.screen = screen;
-
- addAppWidgetImpl(appWidgetId, createItemInfo, null, appWidget);
- }
-
void addAppWidgetImpl(final int appWidgetId, ItemInfo info, AppWidgetHostView boundWidget,
AppWidgetProviderInfo appWidgetInfo) {
if (appWidgetInfo.configure != null) {
@@ -1832,30 +1748,6 @@ public final class Launcher extends Activity
}
/**
- * Process action from drop.
- *
- * @param action The launcher action
- * @param screen The screen where it should be added
- * @param cell The cell it should be added to, optional
- * @param position The location on the screen where it was dropped, optional
- */
- void processActionFromDrop(LauncherAction.Action action, long container, int screen,
- int[] cell, int[] loc) {
- resetAddInfo();
- mPendingAddInfo.container = container;
- mPendingAddInfo.screen = screen;
- mPendingAddInfo.dropPos = loc;
-
- if (cell != null) {
- mPendingAddInfo.cellX = cell[0];
- mPendingAddInfo.cellY = cell[1];
- }
-
- addAction(action);
- exitSpringLoadedDragModeDelayed(true, true, null);
- }
-
- /**
* Process a shortcut drop.
*
* @param componentName The name of the component
@@ -1940,7 +1832,21 @@ public final class Launcher extends Activity
}
void processShortcut(Intent intent) {
- startActivityForResultSafely(intent, REQUEST_CREATE_SHORTCUT);
+ // Handle case where user selected "Applications"
+ String applicationName = getResources().getString(R.string.group_applications);
+ String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
+
+ if (applicationName != null && applicationName.equals(shortcutName)) {
+ Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
+ mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+
+ Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
+ pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
+ pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_application));
+ startActivityForResultSafely(pickIntent, REQUEST_PICK_APPLICATION);
+ } else {
+ startActivityForResultSafely(intent, REQUEST_CREATE_SHORTCUT);
+ }
}
void processWallpaper(Intent intent) {
@@ -2058,26 +1964,23 @@ public final class Launcher extends Activity
}
Object tag = v.getTag();
- if (tag instanceof LauncherActionInfo) {
- LauncherAction.Action action = ((LauncherActionInfo) tag).action;
- switch (action) {
- case AllApps:
- showAllApps(true);
- break;
- }
- } else if (tag instanceof ShortcutInfo) {
- // Open shortcut
- final Intent intent = ((ShortcutInfo) tag).intent;
- int[] pos = new int[2];
- v.getLocationOnScreen(pos);
- intent.setSourceBounds(new Rect(pos[0], pos[1],
- pos[0] + v.getWidth(), pos[1] + v.getHeight()));
-
- boolean success = startActivitySafely(v, intent, tag);
-
- if (success && v instanceof BubbleTextView) {
- mWaitingForResume = (BubbleTextView) v;
- mWaitingForResume.setStayPressed(true);
+ if (tag instanceof ShortcutInfo) {
+ if (((ShortcutInfo) tag).itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS) {
+ showAllApps(true);
+ } else {
+ // Open shortcut
+ final Intent intent = ((ShortcutInfo) tag).intent;
+ int[] pos = new int[2];
+ v.getLocationOnScreen(pos);
+ intent.setSourceBounds(new Rect(pos[0], pos[1],
+ pos[0] + v.getWidth(), pos[1] + v.getHeight()));
+
+ boolean success = startActivitySafely(v, intent, tag);
+
+ if (success && v instanceof BubbleTextView) {
+ mWaitingForResume = (BubbleTextView) v;
+ mWaitingForResume.setStayPressed(true);
+ }
}
} else if (tag instanceof FolderInfo) {
if (v instanceof FolderIcon) {
@@ -2091,14 +1994,10 @@ public final class Launcher extends Activity
public boolean onTouch(View v, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
Object tag = v.getTag();
- if (tag instanceof LauncherActionInfo) {
- LauncherAction.Action action = ((LauncherActionInfo) tag).action;
- switch (action) {
- case AllApps:
- v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
- HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- break;
- }
+ if (tag instanceof ShortcutInfo &&
+ ((ShortcutInfo)tag).itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS) {
+ v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
}
}
return false;
@@ -2502,7 +2401,7 @@ public final class Launcher extends Activity
// User long pressed on empty space
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
- showAddDialog(longClickCellInfo);
+ startWallpaper();
} else {
if (!(itemUnderLongClick instanceof Folder)) {
// User long pressed on an item
@@ -2543,60 +2442,6 @@ public final class Launcher extends Activity
return mWorkspace;
}
- @Override
- protected Dialog onCreateDialog(int id) {
- switch (id) {
- case DIALOG_CREATE_SHORTCUT:
- return new CreateShortcut().createDialog();
- case DIALOG_CREATE_ACTION:
- return new CreateAction().createDialog();
- }
-
- return super.onCreateDialog(id);
- }
-
- @Override
- protected void onPrepareDialog(int id, Dialog dialog) {
- switch (id) {
- case DIALOG_CREATE_SHORTCUT:
- break;
- case DIALOG_CREATE_ACTION:
- break;
- }
- }
-
- private void showAddDialog(CellLayout.CellInfo cell) {
- resetAddInfo();
- mPendingAddInfo.container = cell.container;
- mPendingAddInfo.screen = cell.screen;
- mPendingAddInfo.cellX = cell.cellX;
- mPendingAddInfo.cellY = cell.cellY;
- mWaitingForResult = true;
- showDialog(DIALOG_CREATE_SHORTCUT);
- }
-
- void pickApplication() {
- Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
- mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
-
- Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
- pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
- pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_application));
- startActivityForResultSafely(pickIntent, REQUEST_PICK_APPLICATION);
- }
-
- private void pickShortcut() {
- Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
- pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
- pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_shortcut));
-
- startActivityForResult(pickIntent, REQUEST_PICK_SHORTCUT);
- }
-
- private void pickAction() {
- showDialog(DIALOG_CREATE_ACTION);
- }
-
// Now a part of LauncherModel.Callbacks. Used to reorder loading steps.
public boolean isAllAppsVisible() {
return (mState == State.APPS_CUSTOMIZE) || (mOnResumeState == State.APPS_CUSTOMIZE);
@@ -3497,150 +3342,6 @@ public final class Launcher extends Activity
}
/**
- * Displays the shortcut creation dialog and launches, if necessary, the
- * appropriate activity.
- */
- private class CreateShortcut implements DialogInterface.OnClickListener,
- DialogInterface.OnCancelListener, DialogInterface.OnDismissListener,
- DialogInterface.OnShowListener {
-
- private AddAdapter mAdapter;
-
- Dialog createDialog() {
- mAdapter = new AddAdapter(Launcher.this);
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(Launcher.this,
- AlertDialog.THEME_HOLO_DARK);
- builder.setAdapter(mAdapter, this);
-
- AlertDialog dialog = builder.create();
- dialog.setOnCancelListener(this);
- dialog.setOnDismissListener(this);
- dialog.setOnShowListener(this);
-
- return dialog;
- }
-
- public void onCancel(DialogInterface dialog) {
- mWaitingForResult = false;
- cleanup();
- }
-
- public void onDismiss(DialogInterface dialog) {
- mWaitingForResult = false;
- cleanup();
- }
-
- private void cleanup() {
- try {
- dismissDialog(DIALOG_CREATE_SHORTCUT);
- } catch (Exception e) {
- // An exception is thrown if the dialog is not visible, which is fine
- }
- }
-
- /**
- * Handle the action clicked in the "Add to home" dialog.
- */
- public void onClick(DialogInterface dialog, int which) {
- cleanup();
-
- AddAdapter.ListItem item = (AddAdapter.ListItem) mAdapter.getItem(which);
- switch (item.actionTag) {
- case AddAdapter.ITEM_APPLICATION: {
- pickApplication();
- break;
- }
- case AddAdapter.ITEM_SHORTCUT: {
- pickShortcut();
- break;
- }
- case AddAdapter.ITEM_ACTION: {
- pickAction();
- break;
- }
- case AddAdapter.ITEM_APPWIDGET: {
- int appWidgetId = Launcher.this.mAppWidgetHost.allocateAppWidgetId();
-
- String intent = AppWidgetManager.ACTION_APPWIDGET_PICK;
- Intent pickIntent = new Intent(intent);
- pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
-
- // start the pick activity
- startActivityForResult(pickIntent, REQUEST_PICK_APPWIDGET);
- break;
- }
- case AddAdapter.ITEM_WALLPAPER: {
- startWallpaper();
- break;
- }
- }
- }
-
- public void onShow(DialogInterface dialog) {
- mWaitingForResult = true;
- }
- }
-
- /**
- * Displays the shortcut creation dialog and launches, if necessary, the
- * appropriate activity.
- */
- private class CreateAction implements DialogInterface.OnClickListener,
- DialogInterface.OnCancelListener, DialogInterface.OnDismissListener,
- DialogInterface.OnShowListener {
-
- private LauncherAction.AddAdapter mAdapter;
-
- Dialog createDialog() {
- mAdapter = new LauncherAction.AddAdapter(Launcher.this);
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(Launcher.this,
- AlertDialog.THEME_HOLO_DARK);
- builder.setAdapter(mAdapter, this);
-
- AlertDialog dialog = builder.create();
- dialog.setOnCancelListener(this);
- dialog.setOnDismissListener(this);
- dialog.setOnShowListener(this);
-
- return dialog;
- }
-
- public void onCancel(DialogInterface dialog) {
- mWaitingForResult = false;
- cleanup();
- }
-
- public void onDismiss(DialogInterface dialog) {
- mWaitingForResult = false;
- cleanup();
- }
-
- private void cleanup() {
- try {
- dismissDialog(DIALOG_CREATE_ACTION);
- } catch (Exception e) {
- // An exception is thrown if the dialog is not visible, which is fine
- }
- }
-
- /**
- * Handle the action clicked in the "Add to home" dialog.
- */
- public void onClick(DialogInterface dialog, int which) {
- cleanup();
-
- LauncherAction.AddAdapter.ItemInfo item = (LauncherAction.AddAdapter.ItemInfo) mAdapter.getItem(which);
- addAction(item.action);
- }
-
- public void onShow(DialogInterface dialog) {
- mWaitingForResult = true;
- }
- }
-
- /**
* Receives notifications when system dialogs are to be closed.
*/
private class CloseSystemDialogsIntentReceiver extends BroadcastReceiver {
@@ -3747,8 +3448,9 @@ public final class Launcher extends Activity
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
ShortcutInfo info = (ShortcutInfo) item;
- String uri = info.intent.toUri(0);
+ String uri = info.intent != null ? info.intent.toUri(0) : null;
View shortcut = createShortcut(info);
workspace.addInScreen(shortcut, item.container, item.screen, item.cellX,
item.cellY, 1, 1, false);
@@ -3769,12 +3471,6 @@ public final class Launcher extends Activity
}
}
break;
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
- LauncherActionInfo launcherActionInfo = (LauncherActionInfo) item;
- View launcherAction = createShortcut(launcherActionInfo);
- workspace.addInScreen(launcherAction, item.container, item.screen, item.cellX,
- item.cellY, 1, 1, false);
- break;
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this,
(ViewGroup) workspace.getChildAt(workspace.getCurrentPage()),
@@ -4019,8 +3715,6 @@ public final class Launcher extends Activity
*/
public void bindAppsAdded(ArrayList<ApplicationInfo> apps) {
setLoadOnResume();
- removeDialog(DIALOG_CREATE_SHORTCUT);
- removeDialog(DIALOG_CREATE_ACTION);
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.addApps(apps);
diff --git a/src/com/cyanogenmod/trebuchet/LauncherAction.java b/src/com/cyanogenmod/trebuchet/LauncherAction.java
deleted file mode 100644
index 3ccfc3f0f..000000000
--- a/src/com/cyanogenmod/trebuchet/LauncherAction.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.cyanogenmod.trebuchet;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class LauncherAction {
-
- public enum Action {
- AllApps;
- int getString() {
- return getString(this);
- }
- int getDrawable() {
- return getDrawable(this);
- }
- static int getString(Action action) {
- switch (action) {
- case AllApps:
- return R.string.all_apps_button_label;
- default:
- return -1;
- }
- }
- static int getDrawable(Action action) {
- switch (action) {
- case AllApps:
- return R.drawable.ic_allapps;
- default:
- return -1;
- }
- }
- }
-
- public static List<Action> getAllActions() {
- return Arrays.asList(Action.values());
- }
-
- public static class AddAdapter extends BaseAdapter {
-
- public class ItemInfo {
- public Action action;
- public Drawable drawable;
- public String title;
- public ItemInfo(Action info, Resources res) {
- action = info;
- drawable = res.getDrawable(info.getDrawable());
- title = res.getString(info.getString());
- }
- }
-
- private final LayoutInflater mInflater;
-
- private final List<ItemInfo> mItems = new ArrayList<ItemInfo>();
-
- public AddAdapter(Launcher launcher) {
- super();
-
- mInflater = (LayoutInflater) launcher.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
- // Create default actions
- Resources res = launcher.getResources();
-
- List<Action> items = LauncherAction.getAllActions();
- for (Action item : items) {
- mItems.add(new ItemInfo(item, res));
- }
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- ItemInfo item = (ItemInfo) getItem(position);
-
- if (convertView == null) {
- convertView = mInflater.inflate(R.layout.add_list_item, parent, false);
- }
-
- TextView textView = (TextView) convertView;
- textView.setTag(item);
- textView.setText(item.title);
- textView.setCompoundDrawablesWithIntrinsicBounds(item.drawable, null, null, null);
-
- return convertView;
- }
-
- public int getCount() {
- return mItems.size();
- }
-
- public Object getItem(int position) {
- return mItems.get(position);
- }
-
- public long getItemId(int position) {
- return position;
- }
- }
-}
diff --git a/src/com/cyanogenmod/trebuchet/LauncherActionInfo.java b/src/com/cyanogenmod/trebuchet/LauncherActionInfo.java
deleted file mode 100644
index 034c2ebff..000000000
--- a/src/com/cyanogenmod/trebuchet/LauncherActionInfo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.cyanogenmod.trebuchet;
-
-import android.content.ContentValues;
-
-class LauncherActionInfo extends ShortcutInfo {
-
- /*
- * The launcher action
- */
- LauncherAction.Action action;
-
- LauncherActionInfo() {
- itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_LAUNCHER_ACTION;
- }
-
- @Override
- void onAddToDatabase(ContentValues values) {
- super.onAddToDatabase(values);
-
- String actionText = action != null ? action.name() : null;
- values.put(LauncherSettings.Favorites.LAUNCHER_ACTION, actionText);
- }
-}
diff --git a/src/com/cyanogenmod/trebuchet/LauncherModel.java b/src/com/cyanogenmod/trebuchet/LauncherModel.java
index ae0dbf46a..22ea2f2b3 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherModel.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherModel.java
@@ -345,7 +345,7 @@ public class LauncherModel extends BroadcastReceiver {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
if (!sBgWorkspaceItems.contains(modelItem)) {
sBgWorkspaceItems.add(modelItem);
}
@@ -578,7 +578,7 @@ public class LauncherModel extends BroadcastReceiver {
// Fall through
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP ||
item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
sBgWorkspaceItems.add(item);
@@ -665,7 +665,7 @@ public class LauncherModel extends BroadcastReceiver {
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
sBgWorkspaceItems.remove(item);
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
@@ -1249,8 +1249,6 @@ public class LauncherModel extends BroadcastReceiver {
(LauncherSettings.Favorites.SPANX);
final int spanYIndex = c.getColumnIndexOrThrow(
LauncherSettings.Favorites.SPANY);
- final int actionIndex = c.getColumnIndexOrThrow(
- LauncherSettings.Favorites.LAUNCHER_ACTION);
ShortcutInfo info;
String intentDescription;
@@ -1273,7 +1271,7 @@ public class LauncherModel extends BroadcastReceiver {
continue;
}
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
if (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
info = getShortcutInfo(manager, intent, context, c, iconIndex,
@@ -1295,9 +1293,10 @@ public class LauncherModel extends BroadcastReceiver {
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
}
} else {
- info = getLauncherActionInfo(c, context, iconTypeIndex,
+ info = getShortcutInfo(c, context, iconTypeIndex,
iconPackageIndex, iconResourceIndex, iconIndex,
- titleIndex, actionIndex);
+ titleIndex);
+ info.itemType = LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS;
}
if (info != null) {
@@ -2197,67 +2196,6 @@ public class LauncherModel extends BroadcastReceiver {
return info;
}
- /**
- * Make an ShortcutInfo object for a shortcut that isn't an application.
- */
- private LauncherActionInfo getLauncherActionInfo(Cursor c, Context context,
- int iconTypeIndex, int iconPackageIndex, int iconResourceIndex, int iconIndex,
- int titleIndex, int actionIndex) {
-
- Bitmap icon = null;
- final LauncherActionInfo info = new LauncherActionInfo();
-
- info.title = c.getString(titleIndex);
- info.action = LauncherAction.Action.valueOf(c.getString(actionIndex));
-
- int iconType = c.getInt(iconTypeIndex);
- switch (iconType) {
- case LauncherSettings.Favorites.ICON_TYPE_RESOURCE:
- String packageName = c.getString(iconPackageIndex);
- String resourceName = c.getString(iconResourceIndex);
- PackageManager packageManager = context.getPackageManager();
- info.customIcon = false;
- // the resource
- try {
- Resources resources = packageManager.getResourcesForApplication(packageName);
- if (resources != null) {
- final int id = resources.getIdentifier(resourceName, null, null);
- icon = Utilities.createIconBitmap(
- mIconCache.getFullResIcon(resources, id), context);
- }
- } catch (Exception e) {
- // drop this. we have other places to look for icons
- }
- // the db
- if (icon == null) {
- icon = getIconFromCursor(c, iconIndex, context);
- }
- // the fallback icon
- if (icon == null) {
- icon = getFallbackIcon();
- info.usingFallbackIcon = true;
- }
- break;
- case LauncherSettings.Favorites.ICON_TYPE_BITMAP:
- icon = getIconFromCursor(c, iconIndex, context);
- if (icon == null) {
- icon = getFallbackIcon();
- info.customIcon = false;
- info.usingFallbackIcon = true;
- } else {
- info.customIcon = true;
- }
- break;
- default:
- icon = getFallbackIcon();
- info.usingFallbackIcon = true;
- info.customIcon = false;
- break;
- }
- info.setIcon(icon);
- return info;
- }
-
Bitmap getIconFromCursor(Cursor c, int iconIndex, Context context) {
@SuppressWarnings("all") // suppress dead code warning
final boolean debug = false;
@@ -2484,8 +2422,6 @@ public class LauncherModel extends BroadcastReceiver {
labelA = ((AppWidgetProviderInfo) a).label;
} else if (a instanceof ResolveInfo) {
labelA = ((ResolveInfo) a).loadLabel(mPackageManager).toString();
- } else if (a instanceof LauncherAction.Action) {
- labelA = mContext.getResources().getString(((LauncherAction.Action) a).getString());
}
mLabelCache.put(a, labelA);
}
@@ -2496,8 +2432,6 @@ public class LauncherModel extends BroadcastReceiver {
labelB = ((AppWidgetProviderInfo) b).label;
} else if (b instanceof ResolveInfo) {
labelB = ((ResolveInfo) b).loadLabel(mPackageManager).toString();
- } else if (b instanceof LauncherAction.Action) {
- labelB = mContext.getResources().getString(((LauncherAction.Action) b).getString());
}
mLabelCache.put(b, labelB);
}
diff --git a/src/com/cyanogenmod/trebuchet/LauncherProvider.java b/src/com/cyanogenmod/trebuchet/LauncherProvider.java
index c6539fe48..416d75bcf 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherProvider.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherProvider.java
@@ -230,7 +230,7 @@ public class LauncherProvider extends ContentProvider {
private static final String TAG_SEARCH = "search";
private static final String TAG_APPWIDGET = "appwidget";
private static final String TAG_SHORTCUT = "shortcut";
- private static final String TAG_ACTION = "action";
+ private static final String TAG_ALLAPPS = "allapps";
private static final String TAG_FOLDER = "folder";
private static final String TAG_EXTRA = "extra";
@@ -283,8 +283,7 @@ public class LauncherProvider extends ContentProvider {
"iconType INTEGER," +
"iconPackage TEXT," +
"iconResource TEXT," +
- "icon BLOB," +
- "action TEXT" +
+ "icon BLOB" +
");");
// Database was just created, so wipe any previous widgets
@@ -352,7 +351,7 @@ public class LauncherProvider extends ContentProvider {
try {
// Select and iterate through each matching widget
c = db.query(TABLE_FAVORITES,
- new String[] { Favorites._ID, Favorites.INTENT },
+ new String[]{Favorites._ID, Favorites.INTENT},
selectWhere, null, null, null, null);
if (c == null) return false;
@@ -530,8 +529,8 @@ public class LauncherProvider extends ContentProvider {
added = addClockWidget(db, values);
} else if (TAG_APPWIDGET.equals(name)) {
added = addAppWidget(parser, attrs, db, values, a, packageManager);
- } else if (TAG_ACTION.equals(name)) {
- long id = addLauncherAction(db, values, a);
+ } else if (TAG_ALLAPPS.equals(name)) {
+ long id = addAllAppsButton(db, values, a);
added = id >= 0;
} else if (TAG_SHORTCUT.equals(name)) {
long id = addUriShortcut(db, values, a);
@@ -788,22 +787,18 @@ public class LauncherProvider extends ContentProvider {
return allocatedAppWidgets;
}
- private long addLauncherAction(SQLiteDatabase db, ContentValues values,
+ private long addAllAppsButton(SQLiteDatabase db, ContentValues values,
TypedArray a) {
Resources r = mContext.getResources();
- String actionText = a.getString(R.styleable.Favorite_action);
- LauncherAction.Action action = LauncherAction.Action.valueOf(actionText);
-
long id = generateNewId();
- values.put(Favorites.TITLE, r.getString(action.getString()));
- values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_LAUNCHER_ACTION);
+ values.put(Favorites.TITLE, r.getString(R.string.all_apps_button_label));
+ values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_ALLAPPS);
values.put(Favorites.SPANX, 1);
values.put(Favorites.SPANY, 1);
values.put(Favorites.ICON_TYPE, Favorites.ICON_TYPE_RESOURCE);
values.put(Favorites.ICON_PACKAGE, mContext.getPackageName());
- values.put(Favorites.ICON_RESOURCE, r.getResourceName(action.getDrawable()));
- values.put(LauncherSettings.Favorites.LAUNCHER_ACTION, actionText);
+ values.put(Favorites.ICON_RESOURCE, r.getResourceName(R.drawable.all_apps_button_icon));
values.put(Favorites._ID, id);
if (dbInsertAndCheck(db, TABLE_FAVORITES, null, values) < 0) {
diff --git a/src/com/cyanogenmod/trebuchet/LauncherSettings.java b/src/com/cyanogenmod/trebuchet/LauncherSettings.java
index abbf7d815..425d84f6c 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherSettings.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherSettings.java
@@ -58,7 +58,7 @@ class LauncherSettings {
/**
* The gesture is a launcher action
*/
- static final int ITEM_TYPE_LAUNCHER_ACTION = 3;
+ static final int ITEM_TYPE_ALLAPPS = 3;
/**
* The icon type.
@@ -188,10 +188,5 @@ class LauncherSettings {
* <P>Type: INTEGER</P>
*/
static final String APPWIDGET_ID = "appWidgetId";
-
- /**
- * The LauncherAction of a launcher action shortcut
- */
- static final String LAUNCHER_ACTION = "action";
}
}
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
index ce52bb33b..e694c1502 100644
--- a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
+++ b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
@@ -127,18 +127,6 @@ public class PagedViewWidget extends LinearLayout {
}
}
- public void applyFromLauncherAction(LauncherAction.Action info) {
- mIsAppWidget = false;
- final ImageView image = (ImageView) findViewById(R.id.widget_preview);
- image.setContentDescription(getContext().getResources().getString(info.getString()));
- final TextView name = (TextView) findViewById(R.id.widget_name);
- name.setText(getContext().getResources().getString(info.getString()));
- final TextView dims = (TextView) findViewById(R.id.widget_dims);
- if (dims != null) {
- dims.setText(String.format(mDimensionsFormatString, 1, 1));
- }
- }
-
public int[] getPreviewSize() {
final ImageView i = (ImageView) findViewById(R.id.widget_preview);
int[] maxSize = new int[2];
diff --git a/src/com/cyanogenmod/trebuchet/PendingAddItemInfo.java b/src/com/cyanogenmod/trebuchet/PendingAddItemInfo.java
index 2020c6d97..3e6ea909f 100644
--- a/src/com/cyanogenmod/trebuchet/PendingAddItemInfo.java
+++ b/src/com/cyanogenmod/trebuchet/PendingAddItemInfo.java
@@ -47,12 +47,6 @@ class PendingAddShortcutInfo extends PendingAddItemInfo {
return "Shortcut: " + shortcutActivityInfo.packageName;
}
}
-class PendingAddActionInfo extends PendingAddItemInfo {
- /**
- * The launcher action
- */
- LauncherAction.Action action;
-}
class PendingAddWidgetInfo extends PendingAddItemInfo {
int minWidth;
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java
index f41febeb9..6e8d720cc 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -55,7 +55,6 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewParent;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
@@ -3615,7 +3614,7 @@ public class Workspace extends PagedView
boolean findNearestVacantCell = true;
if (pendingInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT ||
- pendingInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION) {
+ pendingInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS) {
mTargetCell = findNearestArea(touchXY[0], touchXY[1], spanX, spanY,
cellLayout, mTargetCell);
float distance = cellLayout.getDistanceFromCell(mDragViewVisualCenter[0],
@@ -3662,14 +3661,8 @@ public class Workspace extends PagedView
container, screen, mTargetCell, span, null);
break;
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
- if (pendingInfo instanceof PendingAddActionInfo) {
- mLauncher.processActionFromDrop(((PendingAddActionInfo)pendingInfo).action,
- container, screen, mTargetCell, null);
- } else {
- mLauncher.processShortcutFromDrop(pendingInfo.componentName,
- container, screen, mTargetCell, null);
- }
+ mLauncher.processShortcutFromDrop(pendingInfo.componentName,
+ container, screen, mTargetCell, null);
break;
default:
throw new IllegalStateException("Unknown item type: " +
@@ -3700,7 +3693,7 @@ public class Workspace extends PagedView
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- case LauncherSettings.Favorites.ITEM_TYPE_LAUNCHER_ACTION:
+ case LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS:
if (info.container == NO_ID && info instanceof ApplicationInfo) {
// Came from all apps -- make a copy
info = new ShortcutInfo((ApplicationInfo) info);
@@ -3831,7 +3824,7 @@ public class Workspace extends PagedView
int[] finalPos = new int[2];
float scaleXY[] = new float[2];
- boolean scalePreview = !(info instanceof PendingAddShortcutInfo || info instanceof PendingAddActionInfo);
+ boolean scalePreview = !(info instanceof PendingAddShortcutInfo);
getFinalPositionForDropAnimation(finalPos, scaleXY, dragView, cellLayout, info, mTargetCell,
external, scalePreview);