| 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 a122c06cf6fefd12933d24b1a6a67b7e0d5e2ac3..b673e3be7e89038683a3cc997194220466c15536 100644
|
| --- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
|
| +++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
|
| @@ -4,6 +4,7 @@
|
|
|
| package org.chromium.base;
|
|
|
| +import android.animation.ValueAnimator;
|
| import android.app.PendingIntent;
|
| import android.content.res.Configuration;
|
| import android.graphics.drawable.Drawable;
|
| @@ -234,6 +235,37 @@ public class ApiCompatibilityUtils {
|
| }
|
|
|
| /**
|
| + * @see android.view.View#postOnAnimation()
|
| + */
|
| + public static void postOnAnimation(View view, Runnable action) {
|
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
| + view.postOnAnimation(action);
|
| + } else {
|
| + view.postDelayed(action, getFrameTime());
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * @see android.view.View#postOnAnimationDelayed()
|
| + */
|
| + public static void postOnAnimationDelayed(View view, Runnable action, long delayMillis) {
|
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
| + view.postOnAnimationDelayed(action, delayMillis);
|
| + } else {
|
| + view.postDelayed(action, getFrameTime() + delayMillis);
|
| + }
|
| + }
|
| +
|
| + private static long getFrameTime() {
|
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
| + return ValueAnimator.getFrameDelay();
|
| + } else {
|
| + // Any reasonable fake frame delay will have to do.
|
| + return 10;
|
| + }
|
| + }
|
| +
|
| + /**
|
| * @see android.widget.RemoteViews#setContentDescription(int, CharSequence)
|
| */
|
| public static void setContentDescriptionForRemoteView(RemoteViews remoteViews, int viewId,
|
|
|