本文整理汇总了Java中com.android.launcher3.model.PackageItemInfo类的典型用法代码示例。如果您正苦于以下问题:Java PackageItemInfo类的具体用法?Java PackageItemInfo怎么用?Java PackageItemInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PackageItemInfo类属于com.android.launcher3.model包,在下文中一共展示了PackageItemInfo类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reapplyItemInfo
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Applies the item info if it is same as what the view is pointing to currently.
*/
public void reapplyItemInfo(final ItemInfo info) {
if (getTag() == info) {
FastBitmapDrawable.State prevState = FastBitmapDrawable.State.NORMAL;
if (mIcon instanceof FastBitmapDrawable) {
prevState = ((FastBitmapDrawable) mIcon).getCurrentState();
}
mIconLoadRequest = null;
mDisableRelayout = true;
if (info instanceof AppInfo) {
applyFromApplicationInfo((AppInfo) info);
} else if (info instanceof ShortcutInfo) {
applyFromShortcutInfo((ShortcutInfo) info,
LauncherAppState.getInstance().getIconCache());
if ((info.rank < FolderIcon.NUM_ITEMS_IN_PREVIEW) && (info.container >= 0)) {
View folderIcon =
mLauncher.getWorkspace().getHomescreenIconByItemId(info.container);
if (folderIcon != null) {
folderIcon.invalidate();
}
}
} else if (info instanceof PackageItemInfo) {
applyFromPackageItemInfo((PackageItemInfo) info);
}
// If we are reapplying over an old icon, then we should update the new icon to the same
// state as the old icon
if (mIcon instanceof FastBitmapDrawable) {
((FastBitmapDrawable) mIcon).setState(prevState);
}
mDisableRelayout = false;
}
}
示例2: scrollToPositionAtProgress
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Maps the touch (from 0..1) to the adapter position that should be visible.
*/
@Override
public String scrollToPositionAtProgress(float touchFraction) {
// Skip early if widgets are not bound.
if (isModelNotReady()) {
return "";
}
// Stop the scroller if it is scrolling
stopScroll();
int rowCount = mWidgets.getPackageSize();
float pos = rowCount * touchFraction;
int availableScrollHeight = getAvailableScrollHeight();
LinearLayoutManager layoutManager = ((LinearLayoutManager) getLayoutManager());
layoutManager.scrollToPositionWithOffset(0, (int) -(availableScrollHeight * touchFraction));
int posInt = (int) ((touchFraction == 1)? pos -1 : pos);
PackageItemInfo p = mWidgets.getPackageItemInfo(posInt);
return p.titleSectionName;
}
示例3: reapplyItemInfo
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Applies the item info if it is same as what the view is pointing to currently.
*/
public void reapplyItemInfo(final ItemInfo info) {
if (getTag() == info) {
mIconLoadRequest = null;
mDisableRelayout = true;
if (info instanceof AppInfo) {
applyFromApplicationInfo((AppInfo) info);
} else if (info instanceof ShortcutInfo) {
applyFromShortcutInfo((ShortcutInfo) info,
LauncherAppState.getInstance().getIconCache());
if ((info.rank < FolderIcon.NUM_ITEMS_IN_PREVIEW) && (info.container >= 0)) {
View folderIcon =
mLauncher.getWorkspace().getHomescreenIconByItemId(info.container);
if (folderIcon != null) {
folderIcon.invalidate();
}
}
} else if (info instanceof PackageItemInfo) {
applyFromPackageItemInfo((PackageItemInfo) info);
}
mDisableRelayout = false;
}
}
示例4: scrollToSection
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
@Override
public String scrollToSection(String sectionName) {
// Skip early if widgets are not bound.
if (mWidgets == null) {
return "";
}
// Skip early if there are no widgets.
int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
return "";
}
for (int i = 0; i < rowCount; i++) {
PackageItemInfo packageItemInfo = mWidgets.getPackageItemInfo(i);
if (packageItemInfo != null && !TextUtils.isEmpty(packageItemInfo.titleSectionName) &&
packageItemInfo.titleSectionName.equals(sectionName)) {
LinearLayoutManager layoutManager = ((LinearLayoutManager) getLayoutManager());
layoutManager.smoothScrollToPosition(this, null, i);
return packageItemInfo.titleSectionName;
}
}
return null;
}
示例5: updateIconInBackground
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Fetches high-res icon for the provided ItemInfo and updates the caller when done.
* @return a request ID that can be used to cancel the request.
*/
public IconLoadRequest updateIconInBackground(final BubbleTextView caller, final ItemInfo info) {
Runnable request = new Runnable() {
@Override
public void run() {
if (info instanceof AppInfo) {
getTitleAndIcon((AppInfo) info, null, false);
} else if (info instanceof ShortcutInfo) {
ShortcutInfo st = (ShortcutInfo) info;
getTitleAndIcon(st,
st.promisedIntent != null ? st.promisedIntent : st.intent,
st.user, false);
} else if (info instanceof PackageItemInfo) {
PackageItemInfo pti = (PackageItemInfo) info;
getTitleAndIconForApp(pti, false);
}
mMainThreadExecutor.execute(new Runnable() {
@Override
public void run() {
caller.reapplyItemInfo(info);
}
});
}
};
mWorkerHandler.post(request);
return new IconLoadRequest(request, mWorkerHandler);
}
示例6: getTitleAndIconForApp
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Fill in {@param infoInOut} with the corresponding icon and label.
*/
public synchronized void getTitleAndIconForApp(
PackageItemInfo infoInOut, boolean useLowResIcon) {
CacheEntry entry = getEntryForPackageLocked(
infoInOut.packageName, infoInOut.user, useLowResIcon);
infoInOut.title = Utilities.trim(entry.title);
infoInOut.contentDescription = entry.contentDescription;
infoInOut.iconBitmap = getNonNullIcon(entry, infoInOut.user);
infoInOut.usingLowResIcon = entry.isLowResIcon;
}
示例7: applyFromPackageItemInfo
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
public void applyFromPackageItemInfo(PackageItemInfo info) {
applyIconAndLabel(info.iconBitmap, info);
// We don't need to check the info since it's not a ShortcutInfo
super.setTag(info);
// Verify high res immediately
verifyHighRes();
}
示例8: updateIconInBackground
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Fetches high-res icon for the provided ItemInfo and updates the caller when done.
* @return a request ID that can be used to cancel the request.
*/
public IconLoadRequest updateIconInBackground(final BubbleTextView caller, final ItemInfo info) {
Runnable request = new Runnable() {
@Override
public void run() {
if (info instanceof AppInfo) {
getTitleAndIcon((AppInfo) info, null, false);
} else if (info instanceof ShortcutInfo) {
ShortcutInfo st = (ShortcutInfo) info;
getTitleAndIcon(st,
st.promisedIntent != null ? st.promisedIntent : st.intent,
st.user, false);
} else if (info instanceof PackageItemInfo) {
PackageItemInfo pti = (PackageItemInfo) info;
getTitleAndIconForApp(pti.packageName, pti.user, false, pti);
}
mMainThreadExecutor.execute(new Runnable() {
@Override
public void run() {
caller.reapplyItemInfo(info);
}
});
}
};
mWorkerHandler.post(request);
return new IconLoadRequest(request, mWorkerHandler);
}
示例9: getTitleAndIconForApp
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Fill in {@param appInfo} with the icon and label for {@param packageName}
*/
public synchronized void getTitleAndIconForApp(
String packageName, UserHandleCompat user, boolean useLowResIcon,
PackageItemInfo infoOut) {
CacheEntry entry = getEntryForPackageLocked(packageName, user, useLowResIcon);
infoOut.iconBitmap = getNonNullIcon(entry, user);
infoOut.title = Utilities.trim(entry.title);
infoOut.usingLowResIcon = entry.isLowResIcon;
infoOut.contentDescription = entry.contentDescription;
}
示例10: applyFromPackageItemInfo
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
public void applyFromPackageItemInfo(PackageItemInfo info) {
setIcon(mLauncher.createIconDrawable(info.iconBitmap), mIconSize);
setText(info.title);
if (info.contentDescription != null) {
setContentDescription(info.contentDescription);
}
// We don't need to check the info since it's not a ShortcutInfo
super.setTag(info);
// Verify high res immediately
verifyHighRes();
}
示例11: scrollToPositionAtProgress
import com.android.launcher3.model.PackageItemInfo; //导入依赖的package包/类
/**
* Maps the touch (from 0..1) to the adapter position that should be visible.
*/
@Override
public String scrollToPositionAtProgress(float touchFraction) {
// Skip early if widgets are not bound.
if (mWidgets == null) {
return "";
}
// Skip early if there are no widgets.
int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
return "";
}
// Stop the scroller if it is scrolling
stopScroll();
getCurScrollState(mScrollPosState);
float pos = rowCount * touchFraction;
int availableScrollHeight = getAvailableScrollHeight(rowCount, mScrollPosState.rowHeight);
LinearLayoutManager layoutManager = ((LinearLayoutManager) getLayoutManager());
layoutManager.scrollToPositionWithOffset(0, (int) -(availableScrollHeight * touchFraction));
int posInt = (int) ((touchFraction == 1)? pos -1 : pos);
PackageItemInfo p = mWidgets.getPackageItemInfo(posInt);
return p.titleSectionName;
}