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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.animation.ValueAnimator;
7 import android.app.PendingIntent; 8 import android.app.PendingIntent;
8 import android.content.res.Configuration; 9 import android.content.res.Configuration;
9 import android.graphics.drawable.Drawable; 10 import android.graphics.drawable.Drawable;
10 import android.os.Build; 11 import android.os.Build;
11 import android.view.View; 12 import android.view.View;
12 import android.view.ViewGroup.MarginLayoutParams; 13 import android.view.ViewGroup.MarginLayoutParams;
13 import android.view.ViewTreeObserver; 14 import android.view.ViewTreeObserver;
14 import android.widget.ImageView; 15 import android.widget.ImageView;
15 import android.widget.RemoteViews; 16 import android.widget.RemoteViews;
16 import android.widget.TextView; 17 import android.widget.TextView;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 */ 228 */
228 public static void postInvalidateOnAnimation(View view) { 229 public static void postInvalidateOnAnimation(View view) {
229 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 230 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
230 view.postInvalidateOnAnimation(); 231 view.postInvalidateOnAnimation();
231 } else { 232 } else {
232 view.postInvalidate(); 233 view.postInvalidate();
233 } 234 }
234 } 235 }
235 236
236 /** 237 /**
238 * @see android.view.View#postOnAnimation()
239 */
240 public static void postOnAnimation(View view, Runnable action) {
241 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
242 view.postOnAnimation(action);
243 } else {
244 view.postDelayed(action, getFrameTime());
245 }
246 }
247
248 /**
249 * @see android.view.View#postOnAnimationDelayed()
250 */
251 public static void postOnAnimationDelayed(View view, Runnable action, long d elayMillis) {
252 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
253 view.postOnAnimationDelayed(action, delayMillis);
254 } else {
255 view.postDelayed(action, getFrameTime() + delayMillis);
256 }
257 }
258
259 private static long getFrameTime() {
260 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
261 return ValueAnimator.getFrameDelay();
262 } else {
263 // Any reasonable fake frame delay will have to do.
264 return 10;
265 }
266 }
267
268 /**
237 * @see android.widget.RemoteViews#setContentDescription(int, CharSequence) 269 * @see android.widget.RemoteViews#setContentDescription(int, CharSequence)
238 */ 270 */
239 public static void setContentDescriptionForRemoteView(RemoteViews remoteView s, int viewId, 271 public static void setContentDescriptionForRemoteView(RemoteViews remoteView s, int viewId,
240 CharSequence contentDescription) { 272 CharSequence contentDescription) {
241 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { 273 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
242 remoteViews.setContentDescription(viewId, contentDescription); 274 remoteViews.setContentDescription(viewId, contentDescription);
243 } else { 275 } else {
244 // setContentDescription() is unavailable in earlier versions. 276 // setContentDescription() is unavailable in earlier versions.
245 } 277 }
246 } 278 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return intent.getTargetPackage(); 327 return intent.getTargetPackage();
296 } 328 }
297 } 329 }
298 330
299 public static boolean datePickerRequiresAccept() { 331 public static boolean datePickerRequiresAccept() {
300 // TODO(miguelg) use the final code for the L 332 // TODO(miguelg) use the final code for the L
301 // https://crbug.com/399198 333 // https://crbug.com/399198
302 return Build.VERSION.SDK_INT < 20; /* CUR_DEVELOPMENT */ 334 return Build.VERSION.SDK_INT < 20; /* CUR_DEVELOPMENT */
303 } 335 }
304 } 336 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698