本文整理汇总了Java中com.android.launcher3.AppInfo类的典型用法代码示例。如果您正苦于以下问题:Java AppInfo类的具体用法?Java AppInfo怎么用?Java AppInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppInfo类属于com.android.launcher3包,在下文中一共展示了AppInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDragEnter
import com.android.launcher3.AppInfo; //导入依赖的package包/类
public void onDragEnter(ItemInfo dragInfo) {
if (mFolder.isDestroyed() || !willAcceptItem(dragInfo)) return;
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
CellLayout cl = (CellLayout) getParent().getParent();
mBackground.animateToAccept(cl, lp.cellX, lp.cellY);
mOpenAlarm.setOnAlarmListener(mOnOpenListener);
if (SPRING_LOADING_ENABLED &&
((dragInfo instanceof AppInfo) || (dragInfo instanceof ShortcutInfo))) {
// TODO: we currently don't support spring-loading for PendingAddShortcutInfos even
// though widget-style shortcuts can be added to folders. The issue is that we need
// to deal with configuration activities which are currently handled in
// Workspace#onDropExternal.
mOpenAlarm.setAlarm(ON_OPEN_DELAY);
}
}
示例2: getConfirmationForIconDrop
import com.android.launcher3.AppInfo; //导入依赖的package包/类
@Override
protected String getConfirmationForIconDrop(int id) {
int x = id % mView.getCountX();
int y = id / mView.getCountX();
LauncherAccessibilityDelegate.DragInfo dragInfo = mDelegate.getDragInfo();
View child = mView.getChildAt(x, y);
if (child == null || child == dragInfo.item) {
return mContext.getString(R.string.item_moved);
} else {
ItemInfo info = (ItemInfo) child.getTag();
if (info instanceof AppInfo || info instanceof ShortcutInfo) {
return mContext.getString(R.string.folder_created);
} else if (info instanceof FolderInfo) {
return mContext.getString(R.string.added_to_folder);
}
}
return "";
}
示例3: matches
import com.android.launcher3.AppInfo; //导入依赖的package包/类
protected boolean matches(AppInfo info, String[] queryWords) {
String title = info.title.toString();
String[] words = SPLIT_PATTERN.split(title.toLowerCase());
for (int qi = 0; qi < queryWords.length; qi++) {
boolean foundMatch = false;
for (int i = 0; i < words.length; i++) {
if (words[i].startsWith(queryWords[qi])) {
foundMatch = true;
break;
}
}
if (!foundMatch) {
// If there is a word in the query that does not match any words in this
// title, so skip it.
return false;
}
}
return true;
}
示例4: AppNameComparator
import com.android.launcher3.AppInfo; //导入依赖的package包/类
public AppNameComparator(Context context) {
mCollator = Collator.getInstance();
mAppInfoComparator = new AbstractUserComparator<ItemInfo>(context) {
@Override
public final int compare(ItemInfo a, ItemInfo b) {
// Order by the title in the current locale
int result = compareTitles(a.title.toString(), b.title.toString());
if (result == 0 && a instanceof AppInfo && b instanceof AppInfo) {
AppInfo aAppInfo = (AppInfo) a;
AppInfo bAppInfo = (AppInfo) b;
// If two apps have the same title, then order by the component name
result = aAppInfo.componentName.compareTo(bAppInfo.componentName);
if (result == 0) {
// If the two apps are the same component, then prioritize by the order that
// the app user was created (prioritizing the main user's apps)
return super.compare(a, b);
}
}
return result;
}
};
mSectionNameComparator = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return compareTitles(o1, o2);
}
};
}
示例5: getTitleMatchResult
import com.android.launcher3.AppInfo; //导入依赖的package包/类
protected ArrayList<ComponentKey> getTitleMatchResult(String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final ArrayList<ComponentKey> result = new ArrayList<>();
for (AppInfo info : mApps) {
if (matches(info, queryTextLower)) {
result.add(info.toComponentKey());
}
}
return result;
}
示例6: matches
import com.android.launcher3.AppInfo; //导入依赖的package包/类
protected boolean matches(AppInfo info, String query) {
int queryLength = query.length();
String title = info.title.toString();
int titleLength = title.length();
if (titleLength < queryLength || queryLength <= 0) {
return false;
}
int lastType;
int thisType = Character.UNASSIGNED;
int nextType = Character.getType(title.codePointAt(0));
int end = titleLength - queryLength;
for (int i = 0; i <= end; i++) {
lastType = thisType;
thisType = nextType;
nextType = i < (titleLength - 1) ?
Character.getType(title.codePointAt(i + 1)) : Character.UNASSIGNED;
if (isBreak(thisType, lastType, nextType) &&
title.substring(i, i + queryLength).equalsIgnoreCase(query)) {
return true;
}
}
return false;
}
示例7: asApp
import com.android.launcher3.AppInfo; //导入依赖的package包/类
public static AdapterItem asApp(int pos, SectionInfo section, String sectionName,
int sectionAppIndex, AppInfo appInfo, int appIndex) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.VIEW_TYPE_ICON;
item.position = pos;
item.sectionInfo = section;
item.sectionName = sectionName;
item.sectionAppIndex = sectionAppIndex;
item.appInfo = appInfo;
item.appIndex = appIndex;
return item;
}
示例8: updateApps
import com.android.launcher3.AppInfo; //导入依赖的package包/类
/**
* Updates existing apps in the list
*/
public void updateApps(List<AppInfo> apps) {
for (AppInfo app : apps) {
mComponentToAppMap.put(app.toComponentKey(), app);
}
onAppsUpdated();
}
示例9: removeApps
import com.android.launcher3.AppInfo; //导入依赖的package包/类
/**
* Removes some apps from the list.
*/
public void removeApps(List<AppInfo> apps) {
for (AppInfo app : apps) {
mComponentToAppMap.remove(app.toComponentKey());
}
onAppsUpdated();
}
示例10: getFiltersAppInfos
import com.android.launcher3.AppInfo; //导入依赖的package包/类
private List<AppInfo> getFiltersAppInfos() {
if (mSearchResults == null) {
return mApps;
}
ArrayList<AppInfo> result = new ArrayList<>();
for (ComponentKey key : mSearchResults) {
AppInfo match = mComponentToAppMap.get(key);
if (match != null) {
result.add(match);
}
}
return result;
}
示例11: addActions
import com.android.launcher3.AppInfo; //导入依赖的package包/类
protected void addActions(View host, AccessibilityNodeInfo info) {
if (!(host.getTag() instanceof ItemInfo)) return;
ItemInfo item = (ItemInfo) host.getTag();
if (host instanceof BubbleTextView && ((BubbleTextView) host).hasDeepShortcuts()) {
info.addAction(mActions.get(DEEP_SHORTCUTS));
}
if (DeleteDropTarget.supportsAccessibleDrop(item)) {
info.addAction(mActions.get(REMOVE));
}
if (UninstallDropTarget.supportsDrop(host.getContext(), item)) {
info.addAction(mActions.get(UNINSTALL));
}
if (InfoDropTarget.supportsDrop(item)) {
info.addAction(mActions.get(INFO));
}
if ((item instanceof ShortcutInfo)
|| (item instanceof LauncherAppWidgetInfo)
|| (item instanceof FolderInfo)) {
info.addAction(mActions.get(MOVE));
if (item.container >= 0) {
info.addAction(mActions.get(MOVE_TO_WORKSPACE));
} else if (item instanceof LauncherAppWidgetInfo) {
if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) {
info.addAction(mActions.get(RESIZE));
}
}
}
if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
info.addAction(mActions.get(ADD_TO_WORKSPACE));
}
}
示例12: getTitleMatchResult
import com.android.launcher3.AppInfo; //导入依赖的package包/类
protected ArrayList<ComponentKey> getTitleMatchResult(String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final String[] queryWords = SPLIT_PATTERN.split(queryTextLower);
final ArrayList<ComponentKey> result = new ArrayList<>();
for (AppInfo info : mApps) {
if (matches(info, queryWords)) {
result.add(info.toComponentKey());
}
}
return result;
}
示例13: asApp
import com.android.launcher3.AppInfo; //导入依赖的package包/类
public static AdapterItem asApp(int pos, SectionInfo section, String sectionName,
int sectionAppIndex, AppInfo appInfo, int appIndex) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.ICON_VIEW_TYPE;
item.position = pos;
item.sectionInfo = section;
item.sectionName = sectionName;
item.sectionAppIndex = sectionAppIndex;
item.appInfo = appInfo;
item.appIndex = appIndex;
return item;
}
示例14: setPredictedApps
import com.android.launcher3.AppInfo; //导入依赖的package包/类
/**
* Sets the current set of predicted apps. This uses the info directly, so we do not
* merge data in {@link #onAppsUpdated()}, but go directly to {@link #updateAdapterItems()}.
*/
public void setPredictedApps(List<AppInfo> apps) {
if (!mCustomPredictedAppsEnabled) {
throw new IllegalStateException("Unable to set predicted apps directly when adapter " +
"is not set to accept a custom predicted apps list.");
}
mPredictedApps.clear();
mPredictedApps.addAll(apps);
updateAdapterItems();
}
示例15: onReloadAppDrawer
import com.android.launcher3.AppInfo; //导入依赖的package包/类
/**
* Reloads the existing apps in the list
*/
public void onReloadAppDrawer() {
mReloadDrawer = true;
List<AppInfo> apps = mApps.getApps();
updateApps(apps);
requestLayout();
}