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.snackbar; | 5 package org.chromium.chrome.browser.snackbar; |
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.AnimatorSet; | 9 import android.animation.AnimatorSet; |
10 import android.animation.ObjectAnimator; | 10 import android.animation.ObjectAnimator; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 boolean isShowing() { | 164 boolean isShowing() { |
165 return mView.isShown(); | 165 return mView.isShown(); |
166 } | 166 } |
167 | 167 |
168 /** | 168 /** |
169 * Sends an accessibility event to mMessageView announcing that this window
was added so that | 169 * Sends an accessibility event to mMessageView announcing that this window
was added so that |
170 * the mMessageView content description is read aloud if accessibility is en
abled. | 170 * the mMessageView content description is read aloud if accessibility is en
abled. |
171 */ | 171 */ |
172 void announceforAccessibility() { | 172 void announceforAccessibility() { |
173 mMessageView.announceForAccessibility(mMessageView.getContentDescription
() | 173 mMessageView.announceForAccessibility(mMessageView.getContentDescription
() + " " |
174 + mView.getResources().getString(R.string.bottom_bar_screen_posi
tion)); | 174 + mView.getResources().getString(R.string.bottom_bar_screen_posi
tion)); |
175 } | 175 } |
176 | 176 |
177 /** | 177 /** |
178 * Updates the view to display data from the given snackbar. No-op if the vi
ew is already | 178 * Updates the view to display data from the given snackbar. No-op if the vi
ew is already |
179 * showing the given snackbar. | 179 * showing the given snackbar. |
180 * @param snackbar The snackbar to display | 180 * @param snackbar The snackbar to display |
181 * @return Whether update has actually been executed. | 181 * @return Whether update has actually been executed. |
182 */ | 182 */ |
183 boolean update(Snackbar snackbar) { | 183 boolean update(Snackbar snackbar) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 view.animate().cancel(); | 279 view.animate().cancel(); |
280 if (animate) { | 280 if (animate) { |
281 view.setAlpha(0.0f); | 281 view.setAlpha(0.0f); |
282 view.setText(text); | 282 view.setText(text); |
283 view.animate().alpha(1.f).setDuration(mAnimationDuration).setListene
r(null); | 283 view.animate().alpha(1.f).setDuration(mAnimationDuration).setListene
r(null); |
284 } else { | 284 } else { |
285 view.setText(text); | 285 view.setText(text); |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
OLD | NEW |