当前位置: 首页>>代码示例>>Java>>正文


Java LauncherSettings类代码示例

本文整理汇总了Java中com.android.launcher3.LauncherSettings的典型用法代码示例。如果您正苦于以下问题:Java LauncherSettings类的具体用法?Java LauncherSettings怎么用?Java LauncherSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LauncherSettings类属于com.android.launcher3包,在下文中一共展示了LauncherSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initTarget

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
private static Target initTarget(View v, ItemInfo info) {
    Target t = new LauncherLogProto.Target();
    t.type = Target.ITEM;
    switch (info.itemType) {
        case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
            t.itemType = LauncherLogProto.APP_ICON;
            break;
        case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
            t.itemType = LauncherLogProto.SHORTCUT;
            break;
        case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
            t.itemType = LauncherLogProto.FOLDER_ICON;
            break;
        case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
            t.itemType = LauncherLogProto.WIDGET;
            break;
        case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
            t.itemType = LauncherLogProto.DEEPSHORTCUT;
            break;
    }
    return t;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:23,代码来源:LoggerUtils.java

示例2: PendingAddWidgetInfo

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
public PendingAddWidgetInfo(Context context, LauncherAppWidgetProviderInfo i) {
    if (i.isCustomWidget) {
        itemType = LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;
    } else {
        itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
    }
    this.info = i;
    user = AppWidgetManagerCompat.getInstance(context).getUser(i);
    componentName = i.provider;
    previewImage = i.previewImage;
    icon = i.icon;

    spanX = i.spanX;
    spanY = i.spanY;
    minSpanX = i.minSpanX;
    minSpanY = i.minSpanY;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:18,代码来源:PendingAddWidgetInfo.java

示例3: clearHomescreen

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
/**
 * Removes all icons from homescreen and hotseat.
 */
public void clearHomescreen() throws Throwable {
    LauncherSettings.Settings.call(mTargetContext.getContentResolver(),
            LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
    LauncherSettings.Settings.call(mTargetContext.getContentResolver(),
            LauncherSettings.Settings.METHOD_CLEAR_EMPTY_DB_FLAG);
    LauncherClings.markFirstRunClingDismissed(mTargetContext);
    ManagedProfileHeuristic.markExistingUsersForNoFolderCreation(mTargetContext);

    runTestOnUiThread(new Runnable() {
        @Override
        public void run() {
            // Reset the loader state
            LauncherAppState.getInstance().getModel().resetLoadedState(true, true);
        }
    });
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:20,代码来源:LauncherInstrumentationTestCase.java

示例4: getFolderItemsCount

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
/**
 * @return the number of valid items in the folder.
 */
private int getFolderItemsCount(long folderId) {
    Cursor c =  mContext.getContentResolver().query(LauncherSettings.Favorites.CONTENT_URI,
            new String[] {Favorites._ID, Favorites.INTENT},
            Favorites.CONTAINER + " = " + folderId, null, null, null);

    int total = 0;
    while (c.moveToNext()) {
        try {
            verifyIntent(c.getString(1));
            total++;
        } catch (Exception e) {
            mEntryToRemove.add(c.getLong(0));
        }
    }

    return total;
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:21,代码来源:MigrateFromRestoreTask.java

示例5: loadIcon

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
public Bitmap loadIcon(Cursor c, ShortcutInfo info, Context context) {
    Bitmap icon = null;
    int iconType = c.getInt(iconTypeIndex);
    switch (iconType) {
    case LauncherSettings.Favorites.ICON_TYPE_RESOURCE:
        String packageName = c.getString(iconPackageIndex);
        String resourceName = c.getString(iconResourceIndex);
        if (!TextUtils.isEmpty(packageName) || !TextUtils.isEmpty(resourceName)) {
            info.iconResource = new ShortcutIconResource();
            info.iconResource.packageName = packageName;
            info.iconResource.resourceName = resourceName;
            icon = Utilities.createIconBitmap(packageName, resourceName, context);
        }
        if (icon == null) {
            // Failed to load from resource, try loading from DB.
            icon = Utilities.createIconBitmap(c, iconIndex, context);
        }
        break;
    case LauncherSettings.Favorites.ICON_TYPE_BITMAP:
        icon = Utilities.createIconBitmap(c, iconIndex, context);
        info.customIcon = icon != null;
        break;
    }
    return icon;
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:26,代码来源:CursorIconInfo.java

示例6: PendingAddWidgetInfo

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
public PendingAddWidgetInfo(Launcher launcher, LauncherAppWidgetProviderInfo i, Parcelable data) {
    if (i.isCustomWidget) {
        itemType = LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;
    } else {
        itemType = LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
    }
    this.info = i;
    user = AppWidgetManagerCompat.getInstance(launcher).getUser(i);
    componentName = i.provider;
    previewImage = i.previewImage;
    icon = i.icon;

    spanX = i.spanX;
    spanY = i.spanY;
    minSpanX = i.minSpanX;
    minSpanY = i.minSpanY;
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:18,代码来源:PendingAddWidgetInfo.java

示例7: applyOperations

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
/**
 * Applied all the pending DB operations
 * @return true if any DB operation was commited.
 */
private boolean applyOperations() throws Exception {
    // Update items
    if (!mUpdateOperations.isEmpty()) {
        mContext.getContentResolver().applyBatch(LauncherProvider.AUTHORITY, mUpdateOperations);
    }

    if (!mEntryToRemove.isEmpty()) {
        if (DEBUG) {
            Log.d(TAG, "Removing items: " + TextUtils.join(", ", mEntryToRemove));
        }
        mContext.getContentResolver().delete(LauncherSettings.Favorites.CONTENT_URI,
                Utilities.createDbSelectionQuery(
                        LauncherSettings.Favorites._ID, mEntryToRemove), null);
    }

    return !mUpdateOperations.isEmpty() || !mEntryToRemove.isEmpty();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:22,代码来源:GridSizeMigrationTask.java

示例8: acceptDrop

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
public boolean acceptDrop(DragObject d) {
    final ItemInfo item = d.dragInfo;
    final int itemType = item.itemType;
    return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
            itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT ||
            itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) &&
                !isFull());
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:9,代码来源:Folder.java

示例9: willAcceptItem

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
private boolean willAcceptItem(ItemInfo item) {
    final int itemType = item.itemType;
    return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
            itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT ||
            itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) &&
            !mFolder.isFull() && item != mInfo && !mInfo.opened);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:8,代码来源:FolderIcon.java

示例10: close

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
/**
 * Closes the folder without animation.
 */
public void close() {
    if (mOpenCloseAnimator != null) {
        mOpenCloseAnimator.cancel();
        mOpenCloseAnimator = null;
    }
    mIsOpen = false;
    mDeferContainerRemoval = false;
    boolean isInHotseat = ((ItemInfo) mDeferredDragIcon.getTag()).container
            == LauncherSettings.Favorites.CONTAINER_HOTSEAT;
    mDeferredDragIcon.setTextVisibility(!isInHotseat);
    mLauncher.getDragController().removeDragListener(this);
    mLauncher.getDragLayer().removeView(this);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:17,代码来源:DeepShortcutsContainer.java

示例11: importWorkspace

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
public boolean importWorkspace() throws Exception {
    ArrayList<Long> allScreens = LauncherDbUtils.getScreenIdsFromCursor(
            mContext.getContentResolver().query(mOtherScreensUri, null, null, null,
                    LauncherSettings.WorkspaceScreens.SCREEN_RANK));

    // During import we reset the screen IDs to 0-indexed values.
    if (allScreens.isEmpty()) {
        // No thing to migrate
        return false;
    }

    mHotseatSize = mMaxGridSizeX = mMaxGridSizeY = 0;

    // Build screen update
    ArrayList<ContentProviderOperation> screenOps = new ArrayList<>();
    int count = allScreens.size();
    LongSparseArray<Long> screenIdMap = new LongSparseArray<>(count);
    for (int i = 0; i < count; i++) {
        ContentValues v = new ContentValues();
        v.put(LauncherSettings.WorkspaceScreens._ID, i);
        v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i);
        screenIdMap.put(allScreens.get(i), (long) i);
        screenOps.add(ContentProviderOperation.newInsert(
                LauncherSettings.WorkspaceScreens.CONTENT_URI).withValues(v).build());
    }
    mContext.getContentResolver().applyBatch(ProviderConfig.AUTHORITY, screenOps);
    importWorkspaceItems(allScreens.get(0), screenIdMap);

    GridSizeMigrationTask.markForMigration(mContext, mMaxGridSizeX, mMaxGridSizeY, mHotseatSize);

    // Create empty DB flag.
    LauncherSettings.Settings.call(mContext.getContentResolver(),
            LauncherSettings.Settings.METHOD_CLEAR_EMPTY_DB_FLAG);
    return true;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:36,代码来源:ImportDataTask.java

示例12: performAction

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
@Override
public boolean performAction(View host, ItemInfo item, int action) {
    if (action == ADD_TO_WORKSPACE) {
        if (!(host.getParent() instanceof DeepShortcutView)) {
            return false;
        }
        final ShortcutInfo info = ((DeepShortcutView) host.getParent()).getFinalInfo();
        final int[] coordinates = new int[2];
        final long screenId = findSpaceOnWorkspace(item, coordinates);
        Runnable onComplete = new Runnable() {
            @Override
            public void run() {
                LauncherModel.addItemToDatabase(mLauncher, info,
                        LauncherSettings.Favorites.CONTAINER_DESKTOP,
                        screenId, coordinates[0], coordinates[1]);
                ArrayList<ItemInfo> itemList = new ArrayList<>();
                itemList.add(info);
                mLauncher.bindItems(itemList, 0, itemList.size(), true);
                mLauncher.closeShortcutsContainer();
                announceConfirmation(R.string.item_added_to_workspace);
            }
        };

        if (!mLauncher.showWorkspace(true, onComplete)) {
            onComplete.run();
        }
        return true;
    }
    return false;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:31,代码来源:ShortcutMenuAccessibilityDelegate.java

示例13: CursorIconInfo

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
public CursorIconInfo(Context context, Cursor c) {
    mContext = context;

    iconIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON);
    iconPackageIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_PACKAGE);
    iconResourceIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.ICON_RESOURCE);

    titleIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.TITLE);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:10,代码来源:CursorIconInfo.java

示例14: createGrid

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
/**
 * Initializes the DB with dummy elements to represent the provided grid structure.
 * @param typeArray A 3d array of item types. {@see #addItem(int, long, long, int, int)} for
 *                  type definitions. The first dimension represents the screens and the next
 *                  two represent the workspace grid.
 * @return the same grid representation where each entry is the corresponding item id.
 */
private long[][][] createGrid(int[][][] typeArray, long startScreen) throws Exception {
    LauncherSettings.Settings.call(getMockContentResolver(),
            LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
    long[][][] ids = new long[typeArray.length][][];

    for (int i = 0; i < typeArray.length; i++) {
        // Add screen to DB
        long screenId = startScreen + i;

        // Keep the screen id counter up to date
        LauncherSettings.Settings.call(getMockContentResolver(),
                LauncherSettings.Settings.METHOD_NEW_SCREEN_ID);

        ContentValues v = new ContentValues();
        v.put(LauncherSettings.WorkspaceScreens._ID, screenId);
        v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i);
        getMockContentResolver().insert(LauncherSettings.WorkspaceScreens.CONTENT_URI, v);

        ids[i] = new long[typeArray[i].length][];
        for (int y = 0; y < typeArray[i].length; y++) {
            ids[i][y] = new long[typeArray[i][y].length];
            for (int x = 0; x < typeArray[i][y].length; x++) {
                if (typeArray[i][y][x] < 0) {
                    // Empty cell
                    ids[i][y][x] = -1;
                } else {
                    ids[i][y][x] = addItem(typeArray[i][y][x], screenId, DESKTOP, x, y);
                }
            }
        }
    }
    return ids;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:41,代码来源:GridSizeMigrationTaskTest.java

示例15: addItem

import com.android.launcher3.LauncherSettings; //导入依赖的package包/类
/**
 * Adds a dummy item in the DB.
 * @param type {@link #APPLICATION} or {@link #SHORTCUT} or >= 2 for
 *             folder (where the type represents the number of items in the folder).
 */
private long addItem(int type, long screen, long container, int x, int y) throws Exception {
    long id = LauncherSettings.Settings.call(getMockContentResolver(),
            LauncherSettings.Settings.METHOD_NEW_ITEM_ID)
            .getLong(LauncherSettings.Settings.EXTRA_VALUE);

    ContentValues values = new ContentValues();
    values.put(LauncherSettings.Favorites._ID, id);
    values.put(LauncherSettings.Favorites.CONTAINER, container);
    values.put(LauncherSettings.Favorites.SCREEN, screen);
    values.put(LauncherSettings.Favorites.CELLX, x);
    values.put(LauncherSettings.Favorites.CELLY, y);
    values.put(LauncherSettings.Favorites.SPANX, 1);
    values.put(LauncherSettings.Favorites.SPANY, 1);

    if (type == APPLICATION || type == SHORTCUT) {
        values.put(LauncherSettings.Favorites.ITEM_TYPE, type);
        values.put(LauncherSettings.Favorites.INTENT, VALID_INTENT);
    } else {
        values.put(LauncherSettings.Favorites.ITEM_TYPE,
                LauncherSettings.Favorites.ITEM_TYPE_FOLDER);
        // Add folder items.
        for (int i = 0; i < type; i++) {
            addItem(APPLICATION, 0, id, 0, 0);
        }
    }

    getMockContentResolver().insert(LauncherSettings.Favorites.CONTENT_URI, values);
    return id;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:35,代码来源:GridSizeMigrationTaskTest.java


注:本文中的com.android.launcher3.LauncherSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。