diff options
34 files changed, 97 insertions, 689 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 70e76b6..79b5399 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -78,7 +78,6 @@ android:windowSoftInputMode="adjustPan"> <intent-filter> <action android:name="android.intent.action.MAIN" /> - <action android:name="com.cyanogenmod.trebuchet.LAUNCHER_ACTION" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.MONKEY"/> diff --git a/res/drawable-hdpi/ic_launcher_application.png b/res/drawable-hdpi/ic_launcher_application.png Binary files differdeleted file mode 100644 index 882eb14..0000000 --- a/res/drawable-hdpi/ic_launcher_application.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_launcher_appwidget.png b/res/drawable-hdpi/ic_launcher_appwidget.png Binary files differdeleted file mode 100644 index 3dc8b20..0000000 --- a/res/drawable-hdpi/ic_launcher_appwidget.png +++ /dev/null diff --git a/res/drawable-hdpi/ic_launcher_shortcut.png b/res/drawable-hdpi/ic_launcher_shortcut.png Binary files differdeleted file mode 100644 index 93ab2df..0000000 --- a/res/drawable-hdpi/ic_launcher_shortcut.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_launcher_application.png b/res/drawable-mdpi/ic_launcher_application.png Binary files differdeleted file mode 100644 index d7ff417..0000000 --- a/res/drawable-mdpi/ic_launcher_application.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_launcher_appwidget.png b/res/drawable-mdpi/ic_launcher_appwidget.png Binary files differdeleted file mode 100644 index e9371d2..0000000 --- a/res/drawable-mdpi/ic_launcher_appwidget.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_launcher_shortcut.png b/res/drawable-mdpi/ic_launcher_shortcut.png Binary files differdeleted file mode 100644 index 05bc055..0000000 --- a/res/drawable-mdpi/ic_launcher_shortcut.png +++ /dev/null diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 63de38e..4829d76 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -42,7 +42,6 @@ <string name="group_shortcuts" msgid="9133529424900391877">"Verknüpfungen"</string> <string name="group_widgets" msgid="6704978494073105844">"Widgets"</string> <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all launcher actions --> - <string name="group_actions">Aktionen</string> <string name="group_wallpapers" msgid="1568191644272224858">"Hintergründe"</string> <string name="completely_out_of_space" msgid="1759078539443491182">"Auf Ihrem Startbildschirm ist kein Platz mehr vorhanden."</string> <string name="out_of_space" msgid="8365249326091984698">"Auf dem Startbildschirm ist kein Platz mehr vorhanden."</string> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 4c9e612..c373a41 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -124,7 +124,6 @@ <string name="all_apps_sort_cling_add_item">Mantener pulsación sobre la pestaña Aplicaciones para elegir el método de ordenación</string> <string name="hidden_apps_title">Aplicaciones ocultas</string> <string name="edit_target_label">Editar</string> - <string name="group_actions">Acciones</string> <string name="preferences_title">Preferencias</string> <string name="preferences_interface_title">Interfaz</string> <string name="preferences_application_title">Aplicación</string> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index fa7e1df..cc557aa 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -152,8 +152,6 @@ <string name="preferences_interface_homescreen_indicator_enable_summary">Afficher l\'indicateur de page en bas de l\'écran</string> <string name="preferences_interface_homescreen_indicator_fade_title">Fondu</string> <string name="preferences_interface_homescreen_indicator_fade_summary">Faire disparaître l\'indicateur après le changement d\'écran</string> - <string name="preferences_interface_homescreen_indicator_background_title">Séparateur horizontal</string> - <string name="preferences_interface_homescreen_indicator_background_summary">Afficher la ligne entre la barre de dock et l\'écran d\'accueil</string> <!-- Drawer --> <string name="preferences_interface_drawer_title">Applications</string> diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index 83b8a7a..de78560 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -40,7 +40,6 @@ <string name="group_applications" msgid="2103752818818161976">"Alkalmazások"</string> <string name="group_shortcuts" msgid="9133529424900391877">"Parancsikonok"</string> <string name="group_widgets" msgid="6704978494073105844">"Modulok"</string> - <string name="group_actions">Műveletek</string> <string name="group_wallpapers" msgid="1568191644272224858">"Háttérképek"</string> <string name="completely_out_of_space" msgid="1759078539443491182">"Nincs több hely a Kezdőképernyőkön."</string> <string name="out_of_space" msgid="8365249326091984698">"Nincs több hely ezen a főoldalon."</string> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index ceac63c..1794fd9 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -112,7 +112,6 @@ <string name="custom_workspace_cling_description_2" msgid="2758258454975288377"></string> <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all launcher actions --> - <string name="group_actions">アクション</string> <!-- Label for the info icon. [CHAR_LIMIT=30] --> <string name="edit_target_label">編集</string> <!-- Noun, menu item used to show system apps --> diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 6fb7c09..6a57d3d 100755 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -195,5 +195,4 @@ <string name="menu_apps_filter_downloaded">Baixado</string> <string name="menu_hidden_apps_delete">Restaurar</string> <string name="hidden_apps_title">Aplicativos ocultos</string> - <string name="group_actions">Ações</string> </resources>
\ No newline at end of file diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index a47ac65..4ed97c8 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -40,7 +40,6 @@ <string name="group_applications" msgid="2103752818818161976">"Aplicaţii"</string> <string name="group_shortcuts" msgid="9133529424900391877">"Comenzi rapide"</string> <string name="group_widgets" msgid="6704978494073105844">"Obiecte widget"</string> - <string name="group_actions">"Acțiuni"</string> <string name="group_wallpapers" msgid="1568191644272224858">"Imagini de fundal"</string> <string name="completely_out_of_space" msgid="1759078539443491182">"Nu mai este loc pe ecranele de pornire."</string> <string name="out_of_space" msgid="8365249326091984698">"Niciun spaţiu rămas pe acest Ecran de pornire."</string> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index c9845c4..7860b62 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -39,7 +39,6 @@ <string name="group_applications" msgid="2103752818818161976">"Приложения"</string> <string name="group_shortcuts" msgid="9133529424900391877">"Ярлыки"</string> <string name="group_widgets" msgid="6704978494073105844">"Виджеты"</string> - <string name="group_actions">Действия</string> <string name="group_wallpapers" msgid="1568191644272224858">"Обои"</string> <string name="completely_out_of_space" msgid="1759078539443491182">"На главных экранах всё занято."</string> <string name="out_of_space" msgid="8365249326091984698">"На этом экране всё занято."</string> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 54dafe3..927e3fa 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -41,7 +41,6 @@ <string name="group_shortcuts" msgid="9133529424900391877">"快捷方式"</string> <string name="group_widgets" msgid="6704978494073105844">"小部件"</string> <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all launcher actions --> - <string name="group_actions">操作</string> <string name="group_wallpapers" msgid="1568191644272224858">"壁纸"</string> <string name="completely_out_of_space" msgid="1759078539443491182">"您的主屏幕上没有空间了。"</string> <string name="out_of_space" msgid="8365249326091984698">"此主屏幕上已没有空间。"</string> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index f03a342..909a17b 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -143,7 +143,6 @@ <attr name="icon" format="reference" /> <attr name="title" format="reference" /> <attr name="uri" format="string" /> - <attr name="action" format="string" /> </declare-styleable> <declare-styleable name="Extra"> <attr name="key" format="string" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index b32df80..f1409f1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -87,8 +87,6 @@ s --> <string name="group_shortcuts">Shortcuts</string> <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all widgets/gadgets --> <string name="group_widgets">Widgets</string> - <!-- Options in "Add to Home" dialog box; Title of the group containing the list of all launcher actions --> - <string name="group_actions">Actions</string> <!-- Options in "Add to Home" dialog box; Title of the group containing the list of apps that can set the wallpaper--> <string name="group_wallpapers">Wallpapers</string> <!-- Error message when user has filled all their home screens --> diff --git a/res/xml-sw600dp/default_workspace.xml b/res/xml-sw600dp/default_workspace.xml index a22e853..ed4b572 100644 --- a/res/xml-sw600dp/default_workspace.xml +++ b/res/xml-sw600dp/default_workspace.xml @@ -74,12 +74,11 @@ launcher:screen="0" launcher:x="3" launcher:y="0" /> - <action + <allapps launcher:container="-101" launcher:screen="0" launcher:x="4" - launcher:y="0" - launcher:action="AllApps" /> + launcher:y="0" /> <favorite launcher:packageName="com.android.mms" launcher:className="com.android.mms.ui.ConversationList" diff --git a/res/xml-sw720dp/default_workspace.xml b/res/xml-sw720dp/default_workspace.xml index 6208bcc..4fdfc39 100644 --- a/res/xml-sw720dp/default_workspace.xml +++ b/res/xml-sw720dp/default_workspace.xml @@ -74,12 +74,11 @@ launcher:screen="0" launcher:x="4" launcher:y="0" /> - <action + <allapps launcher:container="-101" launcher:screen="0" launcher:x="5" - launcher:y="0" - launcher:action="AllApps" /> + launcher:y="0" /> <favorite launcher:packageName="com.android.mms" launcher:className="com.android.mms.ui.ConversationList" diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml index 2ac15d7..80a0e88 100644 --- a/res/xml/default_workspace.xml +++ b/res/xml/default_workspace.xml @@ -74,12 +74,11 @@ launcher:screen="0" launcher:x="1" launcher:y="0" /> - <action + <allapps launcher:container="-101" launcher:screen="0" launcher:x="2" - launcher:y="0" - launcher:action="AllApps" /> + launcher:y="0" /> <favorite launcher:packageName="com.android.mms" launcher:className="com.android.mms.ui.ConversationList" diff --git a/res/xml/update_workspace.xml b/res/xml/update_workspace.xml index 690fafa..b93e29c 100644 --- a/res/xml/update_workspace.xml +++ b/res/xml/update_workspace.xml @@ -31,12 +31,11 @@ launcher:screen="0" launcher:x="1" launcher:y="0" /> - <action + <allapps launcher:container="-101" launcher:screen="0" launcher:x="2" - launcher:y="0" - launcher:action="AllApps" /> + launcher:y="0" /> <favorite launcher:packageName="com.android.mms" launcher:className="com.android.mms.ui.ConversationList" diff --git a/src/com/cyanogenmod/trebuchet/AddAdapter.java b/src/com/cyanogenmod/trebuchet/AddAdapter.java index a8c5930..5a3d43d 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 127f28f..d1a2006 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 3a1e94e..4f15df7 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 951fbe4..a65d4cf 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 3ccfc3f..0000000 --- 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 034c2eb..0000000 --- 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 ae0dbf4..22ea2f2 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 c6539fe..416d75b 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 abbf7d8..425d84f 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 ce52bb3..e694c15 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 2020c6d..3e6ea90 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 f41febe..6e8d720 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); |