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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/ClipDrawableProgressBar.java

Issue 960733002: [Andorid] ClipDrawable progress bar experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated test Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBar.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.widget;
6
7 import android.content.Context;
8 import android.util.AttributeSet;
9 import android.widget.ImageView;
10
11 /**
12 * An alternative progress bar implemented using ClipDrawable. We're experimenti ng with this for
13 * faster performance. http://crbug.com/455891
14 */
15 public class ClipDrawableProgressBar extends ImageView {
16 private static final long PROGRESS_CLEARING_DELAY_MS = 200;
17
18 private final Runnable mClearLoadProgressRunnable = new Runnable() {
19 @Override
20 public void run() {
21 setProgress(0);
22 }
23 };
24
25 /**
26 * Constructor for inflating from XML.
27 */
28 public ClipDrawableProgressBar(Context context, AttributeSet attrs) {
29 super(context, attrs);
30 }
31
32 /**
33 * Set the current progress to the specified value.
34 * @param progress The new progress, between 0 and 10000.
35 */
36 public void setProgress(int progress) {
37 getDrawable().setLevel(progress);
38
39 removeCallbacks(mClearLoadProgressRunnable);
40 if (progress == 10000) postDelayed(mClearLoadProgressRunnable, PROGRESS_ CLEARING_DELAY_MS);
41 }
42
43 /**
44 * Get the progress bar's current level of progress.
45 * @return The current progress, between 0 and getMax().
46 */
47 public int getProgress() {
48 return getDrawable().getLevel();
49 }
50 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/widget/ToolbarProgressBar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698