/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3; import android.net.Uri; import android.provider.BaseColumns; import com.android.launcher3.config.ProviderConfig; /** * Settings related utilities. */ public class LauncherSettings { /** Columns required on table staht will be subject to backup and restore. */ static interface ChangeLogColumns extends BaseColumns { /** * The time of the last update to this row. *

Type: INTEGER

*/ public static final String MODIFIED = "modified"; } static interface BaseLauncherColumns extends ChangeLogColumns { /** * Descriptive name of the gesture that can be displayed to the user. *

Type: TEXT

*/ public 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#parseUri(String, int)} to create * an Intent that can be launched. *

Type: TEXT

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

Type: INTEGER

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

Type: INTEGER

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

Type: TEXT

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

Type: TEXT

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

Type: BLOB

*/ public static final String ICON = "icon"; } /** * Workspace Screens. * * Tracks the order of workspace screens. */ public static final class WorkspaceScreens implements ChangeLogColumns { public static final String TABLE_NAME = "workspaceScreens"; /** * The content:// style URL for this table */ public static final Uri CONTENT_URI = Uri.parse("content://" + ProviderConfig.AUTHORITY + "/" + TABLE_NAME); /** * The rank of this screen -- ie. how it is ordered relative to the other screens. *

Type: INTEGER

*/ public static final String SCREEN_RANK = "screenRank"; } /** * Favorites. */ public static final class Favorites implements BaseLauncherColumns { public static final String TABLE_NAME = "favorites"; /** * The content:// style URL for this table */ public static final Uri CONTENT_URI = Uri.parse("content://" + ProviderConfig.AUTHORITY + "/" + TABLE_NAME); /** * The content:// style URL for a given row, identified by its id. * * @param id The row id. * * @return The unique content URL for the specified row. */ public static Uri getContentUri(long id) { return Uri.parse("content://" + ProviderConfig.AUTHORITY + "/" + TABLE_NAME + "/" + id); } /** * The container holding the favorite *

Type: INTEGER

*/ public static final String CONTAINER = "container"; /** * The icon is a resource identified by a package name and an integer id. */ public static final int CONTAINER_DESKTOP = -100; public static final int CONTAINER_HOTSEAT = -101; static final String containerToString(int container) { switch (container) { case CONTAINER_DESKTOP: return "desktop"; case CONTAINER_HOTSEAT: return "hotseat"; default: return String.valueOf(container); } } /** * The screen holding the favorite (if container is CONTAINER_DESKTOP) *

Type: INTEGER

*/ public static final String SCREEN = "screen"; /** * The X coordinate of the cell holding the favorite * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT) *

Type: INTEGER

*/ public static final String CELLX = "cellX"; /** * The Y coordinate of the cell holding the favorite * (if container is CONTAINER_DESKTOP) *

Type: INTEGER

*/ public static final String CELLY = "cellY"; /** * The X span of the cell holding the favorite *

Type: INTEGER

*/ public static final String SPANX = "spanX"; /** * The Y span of the cell holding the favorite *

Type: INTEGER

*/ public static final String SPANY = "spanY"; /** * The profile id of the item in the cell. *

* Type: INTEGER *

*/ public static final String PROFILE_ID = "profileId"; /** * The favorite is a user created folder */ public static final int ITEM_TYPE_FOLDER = 2; /** * The favorite is a live folder * * Note: live folders can no longer be added to Launcher, and any live folders which * exist within the launcher database will be ignored when loading. That said, these * entries in the database may still exist, and are not automatically stripped. */ @Deprecated static final int ITEM_TYPE_LIVE_FOLDER = 3; /** * The favorite is a widget */ public static final int ITEM_TYPE_APPWIDGET = 4; /** * The favorite is a custom widget provided by the launcher */ public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5; /** * The favorite is a clock */ @Deprecated static final int ITEM_TYPE_WIDGET_CLOCK = 1000; /** * The favorite is a search widget */ @Deprecated static final int ITEM_TYPE_WIDGET_SEARCH = 1001; /** * The favorite is a photo frame */ @Deprecated static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002; /** * The appWidgetId of the widget * *

Type: INTEGER

*/ public static final String APPWIDGET_ID = "appWidgetId"; /** * The ComponentName of the widget provider * *

Type: STRING

*/ public static final String APPWIDGET_PROVIDER = "appWidgetProvider"; /** * Indicates whether this favorite is an application-created shortcut or not. * If the value is 0, the favorite is not an application-created shortcut, if the * value is 1, it is an application-created shortcut. *

Type: INTEGER

*/ @Deprecated static final String IS_SHORTCUT = "isShortcut"; /** * The URI associated with the favorite. It is used, for instance, by * live folders to find the content provider. *

Type: TEXT

*/ @Deprecated static final String URI = "uri"; /** * The display mode if the item is a live folder. *

Type: INTEGER

* * @see android.provider.LiveFolders#DISPLAY_MODE_GRID * @see android.provider.LiveFolders#DISPLAY_MODE_LIST */ @Deprecated static final String DISPLAY_MODE = "displayMode"; /** * Boolean indicating that his item was restored and not yet successfully bound. *

Type: INTEGER

*/ public static final String RESTORED = "restored"; /** * Indicates the position of the item inside an auto-arranged view like folder or hotseat. *

Type: INTEGER

*/ public static final String RANK = "rank"; /** * Stores general flag based options for {@link ItemInfo}s. *

Type: INTEGER

*/ public static final String OPTIONS = "options"; } /** * Launcher settings */ public static final class Settings { public static final Uri CONTENT_URI = Uri.parse("content://" + ProviderConfig.AUTHORITY + "/settings"); public static final String METHOD_GET_BOOLEAN = "get_boolean_setting"; public static final String METHOD_SET_BOOLEAN = "set_boolean_setting"; public static final String EXTRA_VALUE = "value"; public static final String EXTRA_DEFAULT_VALUE = "default_value"; // Extra for set_boolean method to also notify the backup manager of the change. public static final String NOTIFY_BACKUP = "notify_backup"; } }