Java Code Examples for android.util.MutableInt

The following are top voted examples for showing how to use android.util.MutableInt. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: LaunchEnr   File: BgDataModel.java   View source code 5 votes vote down vote up
synchronized void removeItem(Context context, Iterable<? extends ItemInfo> items) {
    for (ItemInfo item : items) {
        switch (item.itemType) {
            case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
                folders.remove(item.id);

                workspaceItems.remove(item);
                break;
            case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT: {
                // Decrement pinned shortcut count
                ShortcutKey pinnedShortcut = ShortcutKey.fromItemInfo(item);
                MutableInt count = pinnedShortcutCounts.get(pinnedShortcut);
                if ((count == null || --count.value == 0)
                        && !InstallShortcutReceiver.getPendingShortcuts(context)
                            .contains(pinnedShortcut)) {
                    DeepShortcutManager.getInstance(context).unpinShortcut(pinnedShortcut);
                }
                // Fall through.
            }
            case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
            case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
                workspaceItems.remove(item);
                break;
            case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
            case LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET:
                appWidgets.remove(item);
                break;
        }
        itemsIdMap.remove(item.id);
    }
}
 
Example 2
Project: FlickLauncher   File: LauncherModel.java   View source code 5 votes vote down vote up
/**
 * Decrement the count for the given pinned shortcut, unpinning it if the count becomes 0.
 */
private static void decrementPinnedShortcutCount(final ShortcutKey pinnedShortcut) {
    synchronized (sBgLock) {
        MutableInt count = sBgPinnedShortcutCounts.get(pinnedShortcut);
        if (count == null || --count.value == 0) {
            LauncherAppState.getInstance().getShortcutManager().unpinShortcut(pinnedShortcut);
        }
    }
}
 
Example 3
Project: SimpleUILauncher   File: LauncherModel.java   View source code 5 votes vote down vote up
/**
 * Decrement the count for the given pinned shortcut, unpinning it if the count becomes 0.
 */
private static void decrementPinnedShortcutCount(final ShortcutKey pinnedShortcut) {
    synchronized (sBgLock) {
        MutableInt count = sBgPinnedShortcutCounts.get(pinnedShortcut);
        if (count == null || --count.value == 0) {
            LauncherAppState.getInstance().getShortcutManager().unpinShortcut(pinnedShortcut);
        }
    }
}
 
Example 4
Project: android_packages_apps_tv   File: ChannelDataManager.java   View source code 5 votes vote down vote up
private void addChannel(Channel channel) {
    mChannels.add(channel);
    String inputId = channel.getInputId();
    MutableInt count = mChannelCountMap.get(inputId);
    if (count == null) {
        mChannelCountMap.put(inputId, new MutableInt(1));
    } else {
        count.value++;
    }
}
 
Example 5
Project: android_packages_apps_tv   File: ChannelDataManager.java   View source code 2 votes vote down vote up
/**
 * Returns the total channel count for a given input.
 *
 * @param inputId The ID of the input.
 */
public int getChannelCountForInput(String inputId) {
    MutableInt count = mChannelCountMap.get(inputId);
    return count == null ? 0 : count.value;
}