use of com.android.launcher3.ItemInfoWithIcon in project Neo-Launcher by NeoApplications.
the class PredictionRowView method fillInLogContainerData.
@Override
public void fillInLogContainerData(View v, ItemInfo info, LauncherLogProto.Target target, LauncherLogProto.Target targetParent) {
for (int i = 0; i < mPredictedApps.size(); i++) {
ItemInfoWithIcon appInfo = mPredictedApps.get(i);
if (appInfo == info) {
targetParent.containerType = LauncherLogProto.ContainerType.PREDICTION;
target.predictedRank = i;
break;
}
}
}
use of com.android.launcher3.ItemInfoWithIcon in project Neo-Launcher by NeoApplications.
the class PendingAppWidgetHostView method reapplyItemInfo.
@Override
public void reapplyItemInfo(ItemInfoWithIcon info) {
if (mCenterDrawable != null) {
mCenterDrawable.setCallback(null);
mCenterDrawable = null;
}
if (info.iconBitmap != null) {
// The view displays three modes,
// 1) App icon in the center
// 2) Preload icon in the center
// 3) Setup icon in the center and app icon in the top right corner.
DrawableFactory drawableFactory = DrawableFactory.INSTANCE.get(getContext());
if (mDisabledForSafeMode) {
FastBitmapDrawable disabledIcon = drawableFactory.newIcon(getContext(), info);
disabledIcon.setIsDisabled(true);
mCenterDrawable = disabledIcon;
mSettingIconDrawable = null;
} else if (isReadyForClickSetup()) {
mCenterDrawable = drawableFactory.newIcon(getContext(), info);
mSettingIconDrawable = getResources().getDrawable(R.drawable.ic_setting).mutate();
updateSettingColor(info.iconColor);
} else {
mCenterDrawable = DrawableFactory.INSTANCE.get(getContext()).newPendingIcon(getContext(), info);
mSettingIconDrawable = null;
applyState();
}
mCenterDrawable.setCallback(this);
mDrawableSizeChanged = true;
}
invalidate();
}
use of com.android.launcher3.ItemInfoWithIcon in project Neo-Launcher by NeoApplications.
the class DrawableFactory method newIcon.
/**
* Returns a FastBitmapDrawable with the icon.
*/
public FastBitmapDrawable newIcon(ItemInfoWithIcon info) {
FastBitmapDrawable drawable = new FastBitmapDrawable(info);
drawable.setIsDisabled(info.isDisabled());
return drawable;
}
use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Trebuchet by LineageOS.
the class PendingAppWidgetHostView method reapplyItemInfo.
@Override
public void reapplyItemInfo(ItemInfoWithIcon info) {
if (mCenterDrawable != null) {
mCenterDrawable.setCallback(null);
mCenterDrawable = null;
}
if (info.bitmap.icon != null) {
// 3) Setup icon in the center and app icon in the top right corner.
if (mDisabledForSafeMode) {
FastBitmapDrawable disabledIcon = newIcon(getContext(), info);
disabledIcon.setIsDisabled(true);
mCenterDrawable = disabledIcon;
mSettingIconDrawable = null;
} else if (isReadyForClickSetup()) {
mCenterDrawable = newIcon(getContext(), info);
mSettingIconDrawable = getResources().getDrawable(R.drawable.ic_setting).mutate();
updateSettingColor(info.bitmap.color);
} else {
mCenterDrawable = newPendingIcon(getContext(), info);
mSettingIconDrawable = null;
applyState();
}
mCenterDrawable.setCallback(this);
mDrawableSizeChanged = true;
}
invalidate();
}
use of com.android.launcher3.ItemInfoWithIcon in project android_packages_apps_Trebuchet by LineageOS.
the class PredictionRowView method processPredictedAppComponents.
private List<ItemInfoWithIcon> processPredictedAppComponents(List<ComponentKeyMapper> components) {
if (getAppsStore().getApps().length == 0) {
// Apps have not been bound yet.
return Collections.emptyList();
}
List<ItemInfoWithIcon> predictedApps = new ArrayList<>();
for (ComponentKeyMapper mapper : components) {
ItemInfoWithIcon info = mapper.getApp(getAppsStore());
if (info != null) {
ItemInfoWithIcon predictedApp = info.clone();
predictedApp.container = LauncherSettings.Favorites.CONTAINER_PREDICTION;
predictedApps.add(predictedApp);
} else {
if (FeatureFlags.IS_STUDIO_BUILD) {
Log.e(TAG, "Predicted app not found: " + mapper);
}
}
// Stop at the number of predicted apps
if (predictedApps.size() == mNumPredictedAppsPerRow) {
break;
}
}
return predictedApps;
}
Aggregations