Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2880)

Unified Diff: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java

Issue 575253003: Add more methods to APICompatibilityUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed API 20 calls Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index 320e6118f066efc41d21cdd04d1eb77cd06a693c..2d7c1a19179afb2df04fc826b8bd349e1e6e2842 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -5,10 +5,15 @@
package org.chromium.base;
import android.animation.ValueAnimator;
+import android.app.ActivityOptions;
+import android.app.Notification;
import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.Build;
+import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewTreeObserver;
@@ -277,6 +282,28 @@ public class ApiCompatibilityUtils {
}
}
+ /**
+ * @see android.app.Activity#startActivity(Intent, Bundle)
+ */
+ public static void startActivity(Context context, Intent intent, Bundle options) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ context.startActivity(intent, options);
+ } else {
+ context.startActivity(intent);
+ }
+ }
+
+ /**
+ * @see android.app.ActivityOptions#toBundle()
+ */
+ public static Bundle toBundle(ActivityOptions options) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ return options.toBundle();
+ } else {
+ return null;
+ }
+ }
+
// These methods have a new name, and the old name is deprecated.
/**
@@ -327,4 +354,16 @@ public class ApiCompatibilityUtils {
return intent.getTargetPackage();
}
}
+
+ /**
+ * @see android.app.Notification.Builder#setLocalOnly(boolean)
+ */
+ @SuppressWarnings("deprecation")
+ public static Notification build(Notification.Builder builder) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ return builder.build();
+ } else {
+ return builder.getNotification();
+ }
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698