本文整理汇总了Java中android.os.Build.VERSION.SDK_INT属性的典型用法代码示例。如果您正苦于以下问题:Java VERSION.SDK_INT属性的具体用法?Java VERSION.SDK_INT怎么用?Java VERSION.SDK_INT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.Build.VERSION
的用法示例。
在下文中一共展示了VERSION.SDK_INT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestPermissions
public static void requestPermissions(@NonNull final Activity activity, @NonNull final String[] permissions, final int requestCode) {
if (VERSION.SDK_INT >= 23) {
ActivityCompatApi23.requestPermissions(activity, permissions, requestCode);
} else if (activity instanceof OnRequestPermissionsResultCallback) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
int[] grantResults = new int[permissions.length];
PackageManager packageManager = activity.getPackageManager();
String packageName = activity.getPackageName();
int permissionCount = permissions.length;
for (int i = 0; i < permissionCount; i++) {
grantResults[i] = packageManager.checkPermission(permissions[i], packageName);
}
((OnRequestPermissionsResultCallback) activity).onRequestPermissionsResult(requestCode, permissions, grantResults);
}
});
}
}
示例2: postOnAnimation
public static void postOnAnimation(View view, Runnable runnable) {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
SDK16.postOnAnimation(view, runnable);
} else {
view.postDelayed(runnable, 16);
}
}
示例3: postOnAnimation
public static void postOnAnimation(View view, Runnable runnable) {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
SDK16.postOnAnimation(view, runnable);
} else {
view.postDelayed(runnable, SIXTY_FPS_INTERVAL);
}
}
示例4: getPersistentNotification
public Notification getPersistentNotification() {
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.context, 0, new Intent(INTENT_ACTION_LAUNCH_SHADE), 0);
RemoteViews content = new RemoteViews(BuildConfig.APPLICATION_ID, R.layout.persistent_notification);
String notificationTitle = this.context.getResources().getString(R.string.persistent_notification_title);
String notificationContent = this.context.getResources().getString(R.string.persistent_notification_text);
int priority = Integer.MIN_VALUE;
int smallIconId = 17170445;
long when = Long.MIN_VALUE;
if (this.hasPendingMessages) {
notificationContent = this.context.getResources().getString(R.string.persistent_notification_with_messages_text);
if (VERSION.SDK_INT <= 19) {
priority = 1;
}
if (!(this.lockScreenManager.isPhoneLocked() || this.lockScreenManager.isScreenOff())) {
when = System.currentTimeMillis();
priority = 1;
}
smallIconId = R.drawable.ic_notification_small;
}
priority=Notification.PRIORITY_MIN;
// builder.setPriority(Notification.PRIORITY_MIN);
content.setTextViewText(R.id.notification_title_textview, notificationTitle);
content.setTextViewText(R.id.notification_content_textview, notificationContent);
return new Builder(this.context).setPriority(priority).setContentIntent(pendingIntent).setSmallIcon(smallIconId).setContent(content).setWhen(when).setOngoing(true).build();
}
示例5: f
static String f(String str) {
if (str == null) {
return null;
}
if (VERSION.SDK_INT < 8) {
return str;
}
try {
return new String(g.c(Base64.decode(str.getBytes("UTF-8"), 0)), "UTF-8").trim()
.replace("\t", "").replace("\n", "").replace("\r", "");
} catch (Throwable th) {
a("decode error", th);
return str;
}
}
示例6: determineYPositionOfGoogleStyleViewLayout
private void determineYPositionOfGoogleStyleViewLayout() {
if ( VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH ) {
mYPositionOfGoogleStyleViewLayout = 0;
} else {
mYPositionOfGoogleStyleViewLayout = mStatusBarHeight;
}
}
示例7: setStatusBarTransparent
protected void setStatusBarTransparent() {
if (VERSION.SDK_INT >= 19) {
requestWindowFeature(9);
requestWindowFeature(10);
getWindow().getDecorView().setSystemUiVisibility(1280);
getWindow().addFlags(67108864);
LOG.d(TAG, "VERSION.SDK_INT =" + VERSION.SDK_INT);
return;
}
LOG.d("CP_Common", "SDK < 19");
}
示例8: create
public static LightAlertDialog create(Context context) {
if (VERSION.SDK_INT >= 14) {
return new LightAlertDialog(context, 3);
}
LightAlertDialog dialog = new LightAlertDialog(context);
dialog.setInverseBackgroundForced(true);
return dialog;
}
示例9: setVersionName
public static void setVersionName(String str) {
if (VERSION.SDK_INT < 10) {
ib.b(a, "Device SDK Version older than 10");
} else if (str == null) {
ib.b(a, "String versionName passed to setVersionName was null.");
} else {
je.a().a("VersionName", (Object) str);
}
}
示例10: setBackground
public static void setBackground(View view, Drawable background) {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
SDK16.setBackground(view, background);
} else {
view.setBackgroundDrawable(background);
}
}
示例11: onConfigurationChanged
protected void onConfigurationChanged(Configuration newConfig) {
if (VERSION.SDK_INT >= 8) {
super.onConfigurationChanged(newConfig);
}
TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0));
a.recycle();
if (this.mActionMenuPresenter != null) {
this.mActionMenuPresenter.onConfigurationChanged(newConfig);
}
}
示例12: createRefreshableView
@Override
protected ExpandableListView createRefreshableView(Context context, AttributeSet attrs) {
final ExpandableListView lv;
if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
lv = new InternalExpandableListViewSDK9(context, attrs);
} else {
lv = new InternalExpandableListView(context, attrs);
}
// Set it to this so it can be used in ListActivity/ListFragment
lv.setId(android.R.id.list);
return lv;
}
示例13: onDraw
@Override
public void onDraw(Canvas canvas) {
if (mBackground != null) {
// Draw the background filling parts not covered by the illustration
canvas.save();
canvas.translate(0, mIllustrationBounds.height());
// Scale the background so its size matches the foreground
canvas.scale(mScale, mScale, 0, 0);
if (VERSION.SDK_INT > VERSION_CODES.JELLY_BEAN_MR1 &&
shouldMirrorDrawable(mBackground, getLayoutDirection())) {
// Flip the illustration for RTL layouts
canvas.scale(-1, 1);
canvas.translate(-mBackground.getBounds().width(), 0);
}
mBackground.draw(canvas);
canvas.restore();
}
if (mIllustration != null) {
canvas.save();
if (VERSION.SDK_INT > VERSION_CODES.JELLY_BEAN_MR1 &&
shouldMirrorDrawable(mIllustration, getLayoutDirection())) {
// Flip the illustration for RTL layouts
canvas.scale(-1, 1);
canvas.translate(-mIllustrationBounds.width(), 0);
}
// Draw the illustration
mIllustration.draw(canvas);
canvas.restore();
}
super.onDraw(canvas);
}
示例14: createListView
protected ListView createListView(Context context, AttributeSet attrs) {
final ListView lv;
if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
lv = new InternalListViewSDK9(context, attrs);
} else {
lv = new InternalListView(context, attrs);
}
return lv;
}
示例15: onPause
public void onPause() {
if (this.b != null && VERSION.SDK_INT >= 11) {
this.b.onPause();
}
if (this.c != null && VERSION.SDK_INT >= 11) {
this.c.onPause();
}
if (m.a().y()) {
MWConfiguration.getContext().sendBroadcast(new Intent("com.magicwindow.webview.pause" +
".MW_MESSAGE"));
}
TrackAgent.currentEvent().onWebviewPause(this.e, this.d);
}