use of com.android.launcher3.model.data.ItemInfoWithIcon in project android_packages_apps_Trebuchet by LineageOS.
the class PredictionRowView method fillInLogContainerData.
@Override
public void fillInLogContainerData(ItemInfo childInfo, LauncherLogProto.Target child, ArrayList<LauncherLogProto.Target> parents) {
for (int i = 0; i < mPredictedApps.size(); i++) {
ItemInfoWithIcon appInfo = mPredictedApps.get(i);
if (appInfo == childInfo) {
child.predictedRank = i;
break;
}
}
parents.add(newContainerTarget(LauncherLogProto.ContainerType.PREDICTION));
// include where the prediction is coming this used to be Launcher#modifyUserEvent
LauncherLogProto.Target parent = newTarget(LauncherLogProto.Target.Type.CONTAINER);
LauncherState state = mLauncher.getStateManager().getState();
if (state == LauncherState.ALL_APPS) {
parent.containerType = LauncherLogProto.ContainerType.ALLAPPS;
} else if (state == OVERVIEW) {
parent.containerType = LauncherLogProto.ContainerType.TASKSWITCHER;
}
parents.add(parent);
}
use of com.android.launcher3.model.data.ItemInfoWithIcon in project android_packages_apps_Trebuchet by LineageOS.
the class PopupContainerWithArrow method updateNotificationHeader.
private void updateNotificationHeader() {
ItemInfoWithIcon itemInfo = (ItemInfoWithIcon) mOriginalIcon.getTag();
DotInfo dotInfo = mLauncher.getDotInfoForItem(itemInfo);
if (mNotificationItemView != null && dotInfo != null) {
mNotificationItemView.updateHeader(dotInfo.getNotificationCount(), itemInfo.bitmap.color);
}
}
use of com.android.launcher3.model.data.ItemInfoWithIcon in project Neo-Launcher by NeoApplications.
the class CustomBottomSheet method populateAndShow.
@Override
public void populateAndShow(ItemInfo itemInfo) {
super.populateAndShow(itemInfo);
mItemInfo = itemInfo;
mInfoProvider = CustomInfoProvider.Companion.forItem(getContext(), mItemInfo);
TextView title = findViewById(R.id.title);
title.setText(itemInfo.title);
((PrefsFragment) mFragmentManager.findFragmentById(R.id.sheet_prefs)).loadForApp(itemInfo, this::setForceOpen, this::unsetForceOpen, this::reopen);
boolean allowTitleEdit = true;
if (itemInfo instanceof ItemInfoWithIcon || mInfoProvider.supportsIcon()) {
ImageView icon = findViewById(R.id.icon);
if (itemInfo instanceof WorkspaceItemInfo && ((WorkspaceItemInfo) itemInfo).customIcon != null) {
icon.setImageBitmap(((WorkspaceItemInfo) itemInfo).customIcon);
} else if (itemInfo instanceof ItemInfoWithIcon) {
icon.setImageBitmap(((ItemInfoWithIcon) itemInfo).iconBitmap);
} else if (itemInfo instanceof FolderInfo) {
FolderInfo folderInfo = (FolderInfo) itemInfo;
icon.setImageDrawable(folderInfo.getIcon(mLauncher));
// Drawer folder
if (folderInfo.container == ItemInfo.NO_ID) {
// TODO: Allow editing title for drawer folder & sync with group backend
allowTitleEdit = false;
}
}
if (mInfoProvider != null) {
OmegaLauncher launcher = OmegaLauncher.getLauncher(getContext());
icon.setOnClickListener(v -> {
ItemInfo editItem;
if (mItemInfo instanceof FolderInfo && ((FolderInfo) mItemInfo).isCoverMode()) {
editItem = ((FolderInfo) mItemInfo).getCoverInfo();
} else {
editItem = mItemInfo;
}
CustomInfoProvider editProvider = CustomInfoProvider.Companion.forItem(getContext(), editItem);
if (editProvider != null) {
launcher.startEditIcon(editItem, editProvider);
}
});
}
}
if (mInfoProvider != null && allowTitleEdit) {
mPreviousTitle = mInfoProvider.getCustomTitle(mItemInfo);
if (mPreviousTitle == null)
mPreviousTitle = "";
mEditTitle = findViewById(R.id.edit_title);
mEditTitle.setHint(mInfoProvider.getDefaultTitle(mItemInfo));
mEditTitle.setText(mPreviousTitle);
mEditTitle.setVisibility(VISIBLE);
title.setVisibility(View.GONE);
}
}
use of com.android.launcher3.model.data.ItemInfoWithIcon in project Neo-Launcher by NeoApplications.
the class Utilities method getBadge.
/**
* For apps icons and shortcut icons that have badges, this method creates a drawable that can
* later on be rendered on top of the layers for the badges. For app icons, work profile badges
* can only be applied. For deep shortcuts, when dragged from the pop up container, there's no
* badge. When dragged from workspace or folder, it may contain app AND/OR work profile badge
*/
@TargetApi(Build.VERSION_CODES.O)
public static Drawable getBadge(Launcher launcher, ItemInfo info, Object obj) {
LauncherAppState appState = LauncherAppState.getInstance(launcher);
int iconSize = appState.getInvariantDeviceProfile().iconBitmapSize;
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
boolean iconBadged = (info instanceof ItemInfoWithIcon) && (((ItemInfoWithIcon) info).runtimeStatusFlags & FLAG_ICON_BADGED) > 0;
if ((info.id == ItemInfo.NO_ID && !iconBadged) || !(obj instanceof ShortcutInfo)) {
// The item is not yet added on home screen.
return new FixedSizeEmptyDrawable(iconSize);
}
ShortcutInfo si = (ShortcutInfo) obj;
LauncherIcons li = LauncherIcons.obtain(appState.getContext());
Bitmap badge = li.getShortcutInfoBadge(si, appState.getIconCache()).iconBitmap;
li.recycle();
float badgeSize = LauncherIcons.getBadgeSizeForIconSize(iconSize);
float insetFraction = (iconSize - badgeSize) / iconSize;
return new InsetDrawable(new FastBitmapDrawable(badge), insetFraction, insetFraction, 0, 0);
} else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
return ((FolderAdaptiveIcon) obj).getBadge();
} else {
return launcher.getPackageManager().getUserBadgedIcon(new FixedSizeEmptyDrawable(iconSize), info.user);
}
}
use of com.android.launcher3.model.data.ItemInfoWithIcon in project Neo-Launcher by NeoApplications.
the class DrawableFactory method newIcon.
public FastBitmapDrawable newIcon(Context context, ItemInfoWithIcon info) {
FastBitmapDrawable drawable = info.usingLowResIcon() ? new PlaceHolderIconDrawable(info, getShapePath(), context) : new FastBitmapDrawable(info);
drawable.setIsDisabled(info.isDisabled());
return drawable;
}
Aggregations