本文整理汇总了Java中com.android.launcher3.Utilities.isNycOrAbove方法的典型用法代码示例。如果您正苦于以下问题:Java Utilities.isNycOrAbove方法的具体用法?Java Utilities.isNycOrAbove怎么用?Java Utilities.isNycOrAbove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.launcher3.Utilities
的用法示例。
在下文中一共展示了Utilities.isNycOrAbove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: hasWallpaperIdChanged
import com.android.launcher3.Utilities; //导入方法依赖的package包/类
private static boolean hasWallpaperIdChanged(Context context) {
if (!Utilities.isNycOrAbove()) {
// TODO: update an id in sharedprefs in onWallpaperChanged broadcast, and read it here.
return false;
}
final SharedPreferences sharedPrefs = Utilities.getPrefs(context);
int wallpaperId = getWallpaperId(WallpaperManager.getInstance(context));
int savedWallpaperId = sharedPrefs.getInt(ExtractionUtils.WALLPAPER_ID_PREFERENCE_KEY, -1);
return wallpaperId != savedWallpaperId;
}
示例3: executeCropTaskAfterPrompt
import com.android.launcher3.Utilities; //导入方法依赖的package包/类
/**
* Calls cropTask.execute(), once the user has selected which wallpaper to set. On pre-N
* devices, the prompt is not displayed since there is no API to set the lockscreen wallpaper.
* <p>
* TODO: Don't use CropAndSetWallpaperTask on N+, because the new API will handle cropping instead.
*/
public static void executeCropTaskAfterPrompt(
Context context, final AsyncTask<Integer, ?, ?> cropTask,
DialogInterface.OnCancelListener onCancelListener) {
if (Utilities.isNycOrAbove()) {
new AlertDialog.Builder(context)
.setTitle(R.string.wallpaper_instructions)
.setItems(R.array.which_wallpaper_options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedItemIndex) {
int whichWallpaper;
if (selectedItemIndex == 0) {
whichWallpaper = WallpaperManagerCompat.FLAG_SET_SYSTEM;
} else if (selectedItemIndex == 1) {
whichWallpaper = WallpaperManagerCompat.FLAG_SET_LOCK;
} else {
whichWallpaper = WallpaperManagerCompat.FLAG_SET_SYSTEM
| WallpaperManagerCompat.FLAG_SET_LOCK;
}
cropTask.execute(whichWallpaper);
}
})
.setOnCancelListener(onCancelListener)
.show();
} else {
cropTask.execute(WallpaperManagerCompat.FLAG_SET_SYSTEM);
}
}
示例4: getInstance
import com.android.launcher3.Utilities; //导入方法依赖的package包/类
public static WallpaperManagerCompat getInstance(Context context) {
synchronized (sInstanceLock) {
if (sInstance == null) {
if (Utilities.isNycOrAbove()) {
sInstance = new WallpaperManagerCompatVN(context.getApplicationContext());
} else {
sInstance = new WallpaperManagerCompatV16(context.getApplicationContext());
}
}
return sInstance;
}
}
示例5: handleSystemDragStart
import com.android.launcher3.Utilities; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.N)
private void handleSystemDragStart(DragEvent event) {
if (!FeatureFlags.LAUNCHER3_USE_SYSTEM_DRAG_DRIVER || !Utilities.isNycOrAbove()) {
return;
}
if (mLauncher.isWorkspaceLocked()) {
return;
}
ClipDescription description = event.getClipDescription();
if (!description.hasMimeType(ClipDescription.MIMETYPE_TEXT_INTENT)) {
return;
}
ShortcutInfo info = new ShortcutInfo();
// Set a dummy intent until we get the final value
info.intent = new Intent();
// Since we are not going through the workspace for starting the drag, set drag related
// information on the workspace before starting the drag.
ExternalDragPreviewProvider previewProvider =
new ExternalDragPreviewProvider(mLauncher, info);
mLauncher.getWorkspace().prepareDragWithProvider(previewProvider);
DragOptions options = new DragOptions();
options.systemDndStartPoint = new Point((int) event.getX(), (int) event.getY());
int halfPadding = previewProvider.previewPadding / 2;
mDragController.startDrag(
Bitmap.createBitmap(1, 1, Config.ARGB_8888),
0, 0,
new AnotherWindowDragSource(mLauncher), info,
new Point(- halfPadding, halfPadding),
previewProvider.getPreviewBounds(), 1f, options);
}
示例6: create
import com.android.launcher3.Utilities; //导入方法依赖的package包/类
public static DragDriver create(Context context, DragController dragController,
DragObject dragObject, DragOptions options) {
if (Utilities.isNycOrAbove() && options.systemDndStartPoint != null) {
return new SystemDragDriver(dragController, context, dragObject);
} else {
return new InternalDragDriver(dragController);
}
}
示例7: isAppSuspended
import com.android.launcher3.Utilities; //导入方法依赖的package包/类
public static boolean isAppSuspended(ApplicationInfo info) {
// The value of FLAG_SUSPENDED was reused by a hidden constant
// ApplicationInfo.FLAG_PRIVILEGED prior to N, so only check for suspended flag on N
// or later.
if (Utilities.isNycOrAbove()) {
return (info.flags & FLAG_SUSPENDED) != 0;
} else {
return false;
}
}