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.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.animation.ObjectAnimator; | 9 import android.animation.ObjectAnimator; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 for (int i = 0; i < ld.getNumberOfLayers(); i++) { | 121 for (int i = 0; i < ld.getNumberOfLayers(); i++) { |
122 ld.getDrawable(i).setBounds(currentDrawable.getBounds()); | 122 ld.getDrawable(i).setBounds(currentDrawable.getBounds()); |
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 /** | 127 /** |
128 * @return Whether or not this progress bar has animations running for showi
ng/hiding itself. | 128 * @return Whether or not this progress bar has animations running for showi
ng/hiding itself. |
129 */ | 129 */ |
130 @VisibleForTesting | 130 @VisibleForTesting |
131 boolean isAnimatingForShowOrHide() { | 131 public boolean isAnimatingForShowOrHide() { |
132 return (mShowAnimator != null && mShowAnimator.isStarted()) | 132 return (mShowAnimator != null && mShowAnimator.isStarted()) |
133 || (mHideAnimator != null && mHideAnimator.isStarted()); | 133 || (mHideAnimator != null && mHideAnimator.isStarted()); |
134 } | 134 } |
135 | 135 |
136 private void buildAnimators() { | 136 private void buildAnimators() { |
137 if (mShowAnimator != null && mShowAnimator.isRunning()) mShowAnimator.en
d(); | 137 if (mShowAnimator != null && mShowAnimator.isRunning()) mShowAnimator.en
d(); |
138 if (mHideAnimator != null && mHideAnimator.isRunning()) mHideAnimator.en
d(); | 138 if (mHideAnimator != null && mHideAnimator.isRunning()) mHideAnimator.en
d(); |
139 | 139 |
140 mShowAnimator = ObjectAnimator.ofFloat(this, View.SCALE_Y, 0.f, 1.f); | 140 mShowAnimator = ObjectAnimator.ofFloat(this, View.SCALE_Y, 0.f, 1.f); |
141 mShowAnimator.setDuration(SHOW_HIDE_DURATION_MS); | 141 mShowAnimator.setDuration(SHOW_HIDE_DURATION_MS); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (mHideAnimator.isRunning()) mHideAnimator.end(); | 177 if (mHideAnimator.isRunning()) mHideAnimator.end(); |
178 | 178 |
179 if (willShow) { | 179 if (willShow) { |
180 mShowAnimator.start(); | 180 mShowAnimator.start(); |
181 } else { | 181 } else { |
182 mHideAnimator.start(); | 182 mHideAnimator.start(); |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 } | 186 } |
OLD | NEW |