| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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.chrome.browser.widget; | 5 package org.chromium.chrome.browser.widget; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.util.AttributeSet; | 8 import android.util.AttributeSet; |
| 9 import android.widget.ProgressBar; | 9 import android.widget.ProgressBar; |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 private static final int MAX = 100; | 40 private static final int MAX = 100; |
| 41 | 41 |
| 42 // The amount of time between subsequent progress updates. 16ms is chosen to
make 60fps. | 42 // The amount of time between subsequent progress updates. 16ms is chosen to
make 60fps. |
| 43 private static final long PROGRESS_UPDATE_DELAY_MS = 16; | 43 private static final long PROGRESS_UPDATE_DELAY_MS = 16; |
| 44 | 44 |
| 45 private final ObserverList<ProgressChangeListener> mObservers; | 45 private final ObserverList<ProgressChangeListener> mObservers; |
| 46 private final RewindableIterator<ProgressChangeListener> mObserversIterator; | 46 private final RewindableIterator<ProgressChangeListener> mObserversIterator; |
| 47 | 47 |
| 48 private boolean mIsAnimated = false; | 48 private boolean mIsAnimated; |
| 49 private int mTargetProgress; | 49 private int mTargetProgress; |
| 50 | 50 |
| 51 // Since the progress bar is being animated, the internal progress bar resol
ution should be | 51 // Since the progress bar is being animated, the internal progress bar resol
ution should be |
| 52 // at least fine as the width, not MAX. This multiplier will be applied to i
nput progress | 52 // at least fine as the width, not MAX. This multiplier will be applied to i
nput progress |
| 53 // to convert to a finer scale. | 53 // to convert to a finer scale. |
| 54 private int mResolutionMutiplier = 1; | 54 private int mResolutionMutiplier = 1; |
| 55 | 55 |
| 56 private Runnable mUpdateProgressRunnable = new Runnable() { | 56 private Runnable mUpdateProgressRunnable = new Runnable() { |
| 57 @Override | 57 @Override |
| 58 public void run() { | 58 public void run() { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 public void setVisibility(int visibility) { | 145 public void setVisibility(int visibility) { |
| 146 super.setVisibility(visibility); | 146 super.setVisibility(visibility); |
| 147 | 147 |
| 148 if (mObserversIterator != null) { | 148 if (mObserversIterator != null) { |
| 149 for (mObserversIterator.rewind(); mObserversIterator.hasNext();) { | 149 for (mObserversIterator.rewind(); mObserversIterator.hasNext();) { |
| 150 mObserversIterator.next().onProgressVisibilityChanged(visibility
); | 150 mObserversIterator.next().onProgressVisibilityChanged(visibility
); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 } | 154 } |
| OLD | NEW |