本文整理汇总了Java中android.util.MutableInt类的典型用法代码示例。如果您正苦于以下问题:Java MutableInt类的具体用法?Java MutableInt怎么用?Java MutableInt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableInt类属于android.util包,在下文中一共展示了MutableInt类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeItem
import android.util.MutableInt; //导入依赖的package包/类
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);
}
}
示例2: decrementPinnedShortcutCount
import android.util.MutableInt; //导入依赖的package包/类
/**
* 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);
}
}
}
示例3: addChannel
import android.util.MutableInt; //导入依赖的package包/类
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++;
}
}
示例4: getChannelCountForInput
import android.util.MutableInt; //导入依赖的package包/类
/**
* 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;
}