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

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

Issue 583673002: [Android] Invalidate ChromeShell progress bar during animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Line break cleanup 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
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,

Powered by Google App Engine
This is Rietveld 408576698