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


Java Utilities.isNycMR1OrAbove方法代码示例

本文整理汇总了Java中com.android.launcher3.Utilities.isNycMR1OrAbove方法的典型用法代码示例。如果您正苦于以下问题:Java Utilities.isNycMR1OrAbove方法的具体用法?Java Utilities.isNycMR1OrAbove怎么用?Java Utilities.isNycMR1OrAbove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.launcher3.Utilities的用法示例。


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

示例1: getInstance

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
public static UserManagerCompat getInstance(Context context) {
    synchronized (sInstanceLock) {
        if (sInstance == null) {
            if (Utilities.isNycMR1OrAbove()) {
                sInstance = new UserManagerCompatVNMr1(context.getApplicationContext());
            } else if (Utilities.isNycOrAbove()) {
                sInstance = new UserManagerCompatVN(context.getApplicationContext());
            } else if (Utilities.ATLEAST_MARSHMALLOW) {
                sInstance = new UserManagerCompatVM(context.getApplicationContext());
            } else if (Utilities.ATLEAST_LOLLIPOP) {
                sInstance = new UserManagerCompatVL(context.getApplicationContext());
            } else if (Utilities.ATLEAST_JB_MR1) {
                sInstance = new UserManagerCompatV17(context.getApplicationContext());
            } else {
                sInstance = new UserManagerCompatV16();
            }
        }
        return sInstance;
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:21,代码来源:UserManagerCompat.java

示例2: unpinShortcut

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
/**
 * Removes the given shortcut from the current list of pinned shortcuts.
 * (Runs on background thread)
 */
@TargetApi(25)
public void unpinShortcut(final ShortcutKey key) {
    if (Utilities.isNycMR1OrAbove()) {
        String packageName = key.componentName.getPackageName();
        String id = key.getId();
        UserHandleCompat user = key.user;
        List<String> pinnedIds = extractIds(queryForPinnedShortcuts(packageName, user));
        pinnedIds.remove(id);
        try {
            mLauncherApps.pinShortcuts(packageName, pinnedIds, user.getUser());
            mWasLastCallSuccess = true;
        } catch (SecurityException|IllegalStateException e) {
            Log.w(TAG, "Failed to unpin shortcut", e);
            mWasLastCallSuccess = false;
        }
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:22,代码来源:DeepShortcutManager.java

示例3: pinShortcut

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
/**
 * Adds the given shortcut to the current list of pinned shortcuts.
 * (Runs on background thread)
 */
@TargetApi(25)
public void pinShortcut(final ShortcutKey key) {
    if (Utilities.isNycMR1OrAbove()) {
        String packageName = key.componentName.getPackageName();
        String id = key.getId();
        UserHandleCompat user = key.user;
        List<String> pinnedIds = extractIds(queryForPinnedShortcuts(packageName, user));
        pinnedIds.add(id);
        try {
            mLauncherApps.pinShortcuts(packageName, pinnedIds, user.getUser());
            mWasLastCallSuccess = true;
        } catch (SecurityException|IllegalStateException e) {
            Log.w(TAG, "Failed to pin shortcut", e);
            mWasLastCallSuccess = false;
        }
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:22,代码来源:DeepShortcutManager.java

示例4: getInstance

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
public static DeepShortcutManager getInstance(Context context) {
    DeepShortcutManager deepShortcutManager;
    synchronized (sInstanceLock) {
        if (sInstance == null) {
            if (Utilities.isNycMR1OrAbove())
                sInstance = new DeepShortcutManagerN(context.getApplicationContext());
            else
                sInstance = new DeepShortcutManagerPreN(context.getApplicationContext());
        }
        deepShortcutManager = sInstance;
    }
    return deepShortcutManager;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:14,代码来源:DeepShortcutManager.java

示例5: startShortcut

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
@TargetApi(25)
public void startShortcut(String packageName, String id, Rect sourceBounds,
      Bundle startActivityOptions, UserHandleCompat user) {
    if (Utilities.isNycMR1OrAbove()) {
        try {
            mLauncherApps.startShortcut(packageName, id, sourceBounds,
                    startActivityOptions, user.getUser());
            mWasLastCallSuccess = true;
        } catch (SecurityException|IllegalStateException e) {
            Log.e(TAG, "Failed to start shortcut", e);
            mWasLastCallSuccess = false;
        }
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:15,代码来源:DeepShortcutManager.java

示例6: getShortcutIconDrawable

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
@TargetApi(25)
public Drawable getShortcutIconDrawable(ShortcutInfoCompat shortcutInfo, int density) {
    if (Utilities.isNycMR1OrAbove()) {
        try {
            Drawable icon = mLauncherApps.getShortcutIconDrawable(
                    shortcutInfo.getShortcutInfo(), density);
            mWasLastCallSuccess = true;
            return icon;
        } catch (SecurityException|IllegalStateException e) {
            Log.e(TAG, "Failed to get shortcut icon", e);
            mWasLastCallSuccess = false;
        }
    }
    return null;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:16,代码来源:DeepShortcutManager.java

示例7: query

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
/**
 * Query the system server for all the shortcuts matching the given parameters.
 * If packageName == null, we query for all shortcuts with the passed flags, regardless of app.
 *
 * TODO: Use the cache to optimize this so we don't make an RPC every time.
 */
@TargetApi(25)
private List<ShortcutInfoCompat> query(int flags, String packageName,
        ComponentName activity, List<String> shortcutIds, UserHandleCompat user) {
    if (Utilities.isNycMR1OrAbove()) {
        ShortcutQuery q = new ShortcutQuery();
        q.setQueryFlags(flags);
        if (packageName != null) {
            q.setPackage(packageName);
            q.setActivity(activity);
            q.setShortcutIds(shortcutIds);
        }
        List<ShortcutInfo> shortcutInfos = null;
        try {
            shortcutInfos = mLauncherApps.getShortcuts(q, user.getUser());
            mWasLastCallSuccess = true;
        } catch (SecurityException|IllegalStateException e) {
            Log.e(TAG, "Failed to query for shortcuts", e);
            mWasLastCallSuccess = false;
        }
        if (shortcutInfos == null) {
            return Collections.EMPTY_LIST;
        }
        List<ShortcutInfoCompat> shortcutInfoCompats = new ArrayList<>(shortcutInfos.size());
        for (ShortcutInfo shortcutInfo : shortcutInfos) {
            shortcutInfoCompats.add(new ShortcutInfoCompat(shortcutInfo));
        }
        return shortcutInfoCompats;
    } else {
        return Collections.EMPTY_LIST;
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:38,代码来源:DeepShortcutManager.java

示例8: hasHostPermission

import com.android.launcher3.Utilities; //导入方法依赖的package包/类
@TargetApi(25)
public boolean hasHostPermission() {
    if (Utilities.isNycMR1OrAbove()) {
        try {
            return mLauncherApps.hasShortcutHostPermission();
        } catch (SecurityException|IllegalStateException e) {
            Log.e(TAG, "Failed to make shortcut manager call", e);
        }
    }
    return false;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:12,代码来源:DeepShortcutManager.java


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