当前位置: 首页>>代码示例>>Java>>正文


Java ComponentKey类代码示例

本文整理汇总了Java中com.android.launcher3.util.ComponentKey的典型用法代码示例。如果您正苦于以下问题:Java ComponentKey类的具体用法?Java ComponentKey怎么用?Java ComponentKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ComponentKey类属于com.android.launcher3.util包,在下文中一共展示了ComponentKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLauncherEvent

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
protected LauncherEvent createLauncherEvent(View v, Intent intent) {
    LauncherEvent event = LoggerUtils.initLauncherEvent(
            Action.TOUCH, v, Target.CONTAINER);
    event.action.touch = Action.TAP;

    // Fill in grid(x,y), pageIndex of the child and container type of the parent
    // TODO: make this percolate up the view hierarchy if needed.
    int idx = 0;
    LaunchSourceProvider provider = getLaunchProviderRecursive(v);
    if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
        return null;
    }
    ItemInfo itemInfo = (ItemInfo) v.getTag();
    provider.fillInLaunchSourceData(v, itemInfo, event.srcTarget[idx], event.srcTarget[idx + 1]);

    event.srcTarget[idx].intentHash = intent.hashCode();
    ComponentName cn = intent.getComponent();
    if (cn != null) {
        event.srcTarget[idx].packageNameHash = cn.getPackageName().hashCode();
        event.srcTarget[idx].componentHash = cn.hashCode();
        if (mPredictedApps != null) {
            event.srcTarget[idx].predictedRank = mPredictedApps.indexOf(
                    new ComponentKey(cn, itemInfo.user));
        }
    }
    return event;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:28,代码来源:UserEventDispatcher.java

示例2: updateCacheAndGetContentValues

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
@Thunk ContentValues updateCacheAndGetContentValues(LauncherActivityInfoCompat app,
        boolean replaceExisting) {
    final ComponentKey key = new ComponentKey(app.getComponentName(), app.getUser());
    CacheEntry entry = null;
    if (!replaceExisting) {
        entry = mCache.get(key);
        // We can't reuse the entry if the high-res icon is not present.
        if (entry == null || entry.isLowResIcon || entry.icon == null) {
            entry = null;
        }
    }
    if (entry == null) {
        entry = new CacheEntry();
        entry.icon = Utilities.createBadgedIconBitmap(
                mIconProvider.getIcon(app, mIconDpi), app.getUser(),
                mContext);
    }
    entry.title = app.getLabel();
    entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser());
    mCache.put(new ComponentKey(app.getComponentName(), app.getUser()), entry);

    Bitmap lowResIcon = generateLowResIcon(entry.icon, mActivityBgColor);
    return newContentValues(entry.icon, lowResIcon, entry.title.toString(),
            app.getApplicationInfo().packageName);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:26,代码来源:IconCache.java

示例3: cachePackageInstallInfo

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
/**
 * Adds a default package entry in the cache. This entry is not persisted and will be removed
 * when the cache is flushed.
 */
public synchronized void cachePackageInstallInfo(String packageName, UserHandleCompat user,
        Bitmap icon, CharSequence title) {
    removeFromMemCacheLocked(packageName, user);

    ComponentKey cacheKey = getPackageKey(packageName, user);
    CacheEntry entry = mCache.get(cacheKey);

    // For icon caching, do not go through DB. Just update the in-memory entry.
    if (entry == null) {
        entry = new CacheEntry();
        mCache.put(cacheKey, entry);
    }
    if (!TextUtils.isEmpty(title)) {
        entry.title = title;
    }
    if (icon != null) {
        entry.icon = Utilities.createIconBitmap(icon, mContext);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:24,代码来源:IconCache.java

示例4: updateDeepShortcutMap

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
/**
 * Clear all the shortcuts for the given package, and re-add the new shortcuts.
 */
private void updateDeepShortcutMap(
        String packageName, UserHandleCompat user, List<ShortcutInfoCompat> shortcuts) {
    if (packageName != null) {
        Iterator<ComponentKey> keysIter = mBgDeepShortcutMap.keySet().iterator();
        while (keysIter.hasNext()) {
            ComponentKey next = keysIter.next();
            if (next.componentName.getPackageName().equals(packageName)
                    && next.user.equals(user)) {
                keysIter.remove();
            }
        }
    }

    // Now add the new shortcuts to the map.
    for (ShortcutInfoCompat shortcut : shortcuts) {
        boolean shouldShowInContainer = shortcut.isEnabled()
                && (shortcut.isDeclaredInManifest() || shortcut.isDynamic());
        if (shouldShowInContainer) {
            ComponentKey targetComponent
                    = new ComponentKey(shortcut.getActivity(), shortcut.getUserHandle());
            mBgDeepShortcutMap.addToList(targetComponent, shortcut.getId());
        }
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:28,代码来源:LauncherModel.java

示例5: updateCacheAndGetContentValues

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
@Thunk ContentValues updateCacheAndGetContentValues(LauncherActivityInfoCompat app,
        boolean replaceExisting) {
    final ComponentKey key = new ComponentKey(app.getComponentName(), app.getUser());
    CacheEntry entry = null;
    if (!replaceExisting) {
        entry = mCache.get(key);
        // We can't reuse the entry if the high-res icon is not present.
        if (entry == null || entry.isLowResIcon || entry.icon == null) {
            entry = null;
        }
    }
    if (entry == null) {
        entry = new CacheEntry();
        entry.icon = Utilities.createIconBitmap(app.getBadgedIcon(mIconDpi), mContext);
    }
    entry.title = app.getLabel();
    entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser());
    mCache.put(new ComponentKey(app.getComponentName(), app.getUser()), entry);

    return newContentValues(entry.icon, entry.title.toString(), mActivityBgColor);
}
 
开发者ID:talentlo,项目名称:Trebuchet,代码行数:22,代码来源:IconCache.java

示例6: tryAndUpdatePredictedApps

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
/**
 * Updates the set of predicted apps if it hasn't been updated since the last time Launcher was
 * resumed.
 */
public void tryAndUpdatePredictedApps() {
    List<ComponentKey> apps;
    if (mLauncherCallbacks != null) {
        apps = mLauncherCallbacks.getPredictedApps();
    } else {
        apps = predictiveAppsProvider.getPredictions();
        predictiveAppsProvider.updateTopPredictedApps();
    }

    if (apps != null) {
        mAppsView.setPredictedApps(apps);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:18,代码来源:Launcher.java

示例7: getShortcutIdsForItem

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
public List<String> getShortcutIdsForItem(ItemInfo info) {
    if (!DeepShortcutManager.supportsShortcuts(info)) {
        return Collections.EMPTY_LIST;
    }
    ComponentName component = info.getTargetComponent();
    if (component == null) {
        return Collections.EMPTY_LIST;
    }

    List<String> ids = mDeepShortcutMap.get(new ComponentKey(component, info.user));
    return ids == null ? Collections.EMPTY_LIST : ids;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:13,代码来源:Launcher.java

示例8: getAllProvidersMap

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
@Override
public HashMap<ComponentKey, AppWidgetProviderInfo> getAllProvidersMap() {
    HashMap<ComponentKey, AppWidgetProviderInfo> result = new HashMap<>();
    UserHandleCompat user = UserHandleCompat.myUserHandle();
    for (AppWidgetProviderInfo info : mAppWidgetManager.getInstalledProviders()) {
        result.put(new ComponentKey(info.provider, user), info);
    }
    return result;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:10,代码来源:AppWidgetManagerCompatV16.java

示例9: getAllProvidersMap

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
@Override
public HashMap<ComponentKey, AppWidgetProviderInfo> getAllProvidersMap() {
    HashMap<ComponentKey, AppWidgetProviderInfo> result = new HashMap<>();
    for (UserHandle user : mUserManager.getUserProfiles()) {
        UserHandleCompat userHandle = UserHandleCompat.fromUser(user);
        for (AppWidgetProviderInfo info :
                mAppWidgetManager.getInstalledProvidersForProfile(user)) {
            result.put(new ComponentKey(info.provider, userHandle), info);
        }
    }
    return result;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:13,代码来源:AppWidgetManagerCompatVL.java

示例10: doSearch

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
public void doSearch(final String query,
        final AllAppsSearchBarController.Callbacks callback) {
    final ArrayList<ComponentKey> result = getTitleMatchResult(query);
    mResultHandler.post(new Runnable() {

        @Override
        public void run() {
            callback.onSearchResult(query, result);
        }
    });
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:12,代码来源:DefaultAppSearchAlgorithm.java

示例11: getTitleMatchResult

import com.android.launcher3.util.ComponentKey; //导入依赖的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;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:13,代码来源:DefaultAppSearchAlgorithm.java

示例12: getPredictions

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
public List<ComponentKey> getPredictions() {
    String predictions = sharedPreferences.getString(TOP_PREDICTIVE_APPS_KEY, "");
    if (predictions.isEmpty()) {
        return new ArrayList<>();
    }

    String[] topPredictions = predictions.split(" ");
    List<ComponentKey> keys = new ArrayList<>();

    for (int i = 0; i < topPredictions.length - 1; i++) {
        keys.add(buildComponentKey(topPredictions[i] + " " + topPredictions[i + 1]));
    }

    return keys;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:16,代码来源:PredictiveAppsProvider.java

示例13: setOrderedFilter

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
/**
 * Sets the sorted list of filtered components.
 */
public boolean setOrderedFilter(ArrayList<ComponentKey> f) {
    if (mSearchResults != f) {
        boolean same = mSearchResults != null && mSearchResults.equals(f);
        mSearchResults = f;
        updateAdapterItems();
        return !same;
    }
    return false;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:13,代码来源:AlphabeticalAppsList.java

示例14: getFiltersAppInfos

import com.android.launcher3.util.ComponentKey; //导入依赖的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;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:15,代码来源:AlphabeticalAppsList.java

示例15: onSearchResult

import com.android.launcher3.util.ComponentKey; //导入依赖的package包/类
@Override
public void onSearchResult(String query, ArrayList<ComponentKey> apps) {
    if (apps != null) {
        if (mApps.setOrderedFilter(apps)) {
            mAppsRecyclerView.onSearchResultsChanged();
        }
        mAdapter.setLastSearchQuery(query);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:10,代码来源:AllAppsContainerView.java


注:本文中的com.android.launcher3.util.ComponentKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。