From 73b979d8c141c7ceac82dad7c5b271a6a42afa67 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 9 Jun 2009 12:57:21 -0700 Subject: Add gestures to Home. Press the Home key while in Home to enable the gestures pad. --- src/com/android/launcher/LauncherSettings.java | 168 ++++++++++++++----------- 1 file changed, 98 insertions(+), 70 deletions(-) (limited to 'src/com/android/launcher/LauncherSettings.java') diff --git a/src/com/android/launcher/LauncherSettings.java b/src/com/android/launcher/LauncherSettings.java index 60ea0df6a..062c8a6ef 100644 --- a/src/com/android/launcher/LauncherSettings.java +++ b/src/com/android/launcher/LauncherSettings.java @@ -23,16 +23,79 @@ import android.net.Uri; * Settings related utilities. */ class LauncherSettings { - /** - * Favorites. When changing these values, be sure to update - * {@link com.android.settings.LauncherAppWidgetBinder} as needed. - */ - static final class Favorites implements BaseColumns { + static interface BaseLauncherColumns extends BaseColumns { + /** + * Descriptive name of the gesture that can be displayed to the user. + *

Type: TEXT

+ */ + static final String TITLE = "title"; + /** + * The Intent URL of the gesture, describing what it points to. This + * value is given to {@link android.content.Intent#getIntent} to create + * an Intent that can be launched. + *

Type: TEXT

+ */ + static final String INTENT = "intent"; + + /** + * The type of the gesture + * + *

Type: INTEGER

+ */ + static final String ITEM_TYPE = "itemType"; + + /** + * The gesture is an application + */ + static final int ITEM_TYPE_APPLICATION = 0; + + /** + * The gesture is an application created shortcut + */ + static final int ITEM_TYPE_SHORTCUT = 1; + + /** + * The icon type. + *

Type: INTEGER

+ */ + static final String ICON_TYPE = "iconType"; + + /** + * The icon is a resource identified by a package name and an integer id. + */ + static final int ICON_TYPE_RESOURCE = 0; + + /** + * The icon is a bitmap. + */ + static final int ICON_TYPE_BITMAP = 1; + + /** + * The icon package name, if icon type is ICON_TYPE_RESOURCE. + *

Type: TEXT

+ */ + static final String ICON_PACKAGE = "iconPackage"; + + /** + * The icon resource id, if icon type is ICON_TYPE_RESOURCE. + *

Type: TEXT

+ */ + static final String ICON_RESOURCE = "iconResource"; + + /** + * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP. + *

Type: BLOB

+ */ + static final String ICON = "icon"; + } + + static final class Gestures implements BaseLauncherColumns { + /** * The content:// style URL for this table */ static final Uri CONTENT_URI = Uri.parse("content://" + - LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + + LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_GESTURES + "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); /** @@ -40,7 +103,7 @@ class LauncherSettings { * sent if the content changes. */ static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" + - LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + + LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_GESTURES + "?" + LauncherProvider.PARAMETER_NOTIFY + "=false"); /** @@ -53,29 +116,44 @@ class LauncherSettings { */ static Uri getContentUri(long id, boolean notify) { return Uri.parse("content://" + LauncherProvider.AUTHORITY + - "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" + + "/" + LauncherProvider.TABLE_GESTURES + "/" + id + "?" + LauncherProvider.PARAMETER_NOTIFY + "=" + notify); } + } + /** + * Favorites. When changing these values, be sure to update + * {@link com.android.settings.LauncherAppWidgetBinder} as needed. + */ + static final class Favorites implements BaseLauncherColumns { /** - * The row ID. - *

Type: INTEGER

+ * The content:// style URL for this table */ - static final String ID = "_id"; + static final Uri CONTENT_URI = Uri.parse("content://" + + LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + + "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); /** - * Descriptive name of the favorite that can be displayed to the user. - *

Type: TEXT

+ * The content:// style URL for this table. When this Uri is used, no notification is + * sent if the content changes. */ - static final String TITLE = "title"; + static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" + + LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + + "?" + LauncherProvider.PARAMETER_NOTIFY + "=false"); /** - * The Intent URL of the favorite, describing what it points to. This - * value is given to {@link android.content.Intent#getIntent} to create - * an Intent that can be launched. - *

Type: TEXT

+ * The content:// style URL for a given row, identified by its id. + * + * @param id The row id. + * @param notify True to send a notification is the content changes. + * + * @return The unique content URL for the specified row. */ - static final String INTENT = "intent"; + static Uri getContentUri(long id, boolean notify) { + return Uri.parse("content://" + LauncherProvider.AUTHORITY + + "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" + + LauncherProvider.PARAMETER_NOTIFY + "=" + notify); + } /** * The container holding the favorite @@ -120,23 +198,6 @@ class LauncherSettings { */ static final String SPANY = "spanY"; - /** - * The type of the favorite - * - *

Type: INTEGER

- */ - static final String ITEM_TYPE = "itemType"; - - /** - * The favorite is an application - */ - static final int ITEM_TYPE_APPLICATION = 0; - - /** - * The favorite is an application created shortcut - */ - static final int ITEM_TYPE_SHORTCUT = 1; - /** * The favorite is a user created folder */ @@ -180,42 +241,9 @@ class LauncherSettings { * value is 1, it is an application-created shortcut. *

Type: INTEGER

*/ + @Deprecated static final String IS_SHORTCUT = "isShortcut"; - /** - * The icon type. - *

Type: INTEGER

- */ - static final String ICON_TYPE = "iconType"; - - /** - * The icon is a resource identified by a package name and an integer id. - */ - static final int ICON_TYPE_RESOURCE = 0; - - /** - * The icon is a bitmap. - */ - static final int ICON_TYPE_BITMAP = 1; - - /** - * The icon package name, if icon type is ICON_TYPE_RESOURCE. - *

Type: TEXT

- */ - static final String ICON_PACKAGE = "iconPackage"; - - /** - * The icon resource id, if icon type is ICON_TYPE_RESOURCE. - *

Type: TEXT

- */ - static final String ICON_RESOURCE = "iconResource"; - - /** - * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP. - *

Type: BLOB

- */ - static final String ICON = "icon"; - /** * The URI associated with the favorite. It is used, for instance, by * live folders to find the content provider. -- cgit v1.2.3