Chromium Code Reviews| 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.animation.TimeAnimator; | 7 import android.animation.TimeAnimator; |
| 8 import android.animation.TimeAnimator.TimeListener; | 8 import android.animation.TimeAnimator.TimeListener; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 mAnimationInitialized = true; | 99 mAnimationInitialized = true; |
| 100 | 100 |
| 101 assert mAnimationLogic == null; | 101 assert mAnimationLogic == null; |
| 102 | 102 |
| 103 String animation = CommandLine.getInstance().getSwitchValue( | 103 String animation = CommandLine.getInstance().getSwitchValue( |
| 104 ChromeSwitches.PROGRESS_BAR_ANIMATION); | 104 ChromeSwitches.PROGRESS_BAR_ANIMATION); |
| 105 if (TextUtils.equals(animation, "smooth")) { | 105 if (TextUtils.equals(animation, "smooth")) { |
| 106 mAnimationLogic = new ProgressAnimationSmooth(); | 106 mAnimationLogic = new ProgressAnimationSmooth(); |
| 107 } else if (TextUtils.equals(animation, "fast-start")) { | 107 } else if (TextUtils.equals(animation, "fast-start")) { |
| 108 mAnimationLogic = new ProgressAnimationFastStart(); | 108 mAnimationLogic = new ProgressAnimationFastStart(); |
| 109 } else if (TextUtils.equals(animation, "linear")) { | |
| 110 mAnimationLogic = new ProgressAnimationLinear(); | |
| 111 } else { | |
| 112 assert animation == null | |
|
Ted C
2015/08/07 23:11:00
Maybe just this instead of the two checks?
http://
Kibeom Kim (inactive)
2015/08/07 23:35:34
Done.
| |
| 113 || animation.isEmpty() | |
| 114 || TextUtils.equals(animation, "disabled"); | |
| 109 } | 115 } |
| 110 } | 116 } |
| 111 | 117 |
| 112 /** | 118 /** |
| 113 * Start showing progress bar animation. | 119 * Start showing progress bar animation. |
| 114 */ | 120 */ |
| 115 public void start() { | 121 public void start() { |
| 116 mIsStarted = true; | 122 mIsStarted = true; |
| 117 super.setProgress(0.0f); | 123 super.setProgress(0.0f); |
| 118 if (mAnimationLogic != null) mAnimationLogic.reset(); | 124 if (mAnimationLogic != null) mAnimationLogic.reset(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 | 184 |
| 179 @Override | 185 @Override |
| 180 public void setProgress(float progress) { | 186 public void setProgress(float progress) { |
| 181 assert mIsStarted; | 187 assert mIsStarted; |
| 182 assert getProgress() <= progress; | 188 assert getProgress() <= progress; |
| 183 | 189 |
| 184 mTargetProgress = progress; | 190 mTargetProgress = progress; |
| 185 updateVisibleProgress(); | 191 updateVisibleProgress(); |
| 186 } | 192 } |
| 187 } | 193 } |
| OLD | NEW |