| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 * @param activity The activity that displays the snackbar. | 66 * @param activity The activity that displays the snackbar. |
| 67 * @param listener An {@link OnClickListener} that will be called when the a
ction button is | 67 * @param listener An {@link OnClickListener} that will be called when the a
ction button is |
| 68 * clicked. | 68 * clicked. |
| 69 * @param snackbar The snackbar to be displayed. | 69 * @param snackbar The snackbar to be displayed. |
| 70 * @param parentView The ViewGroup used to display this snackbar. If this is
null, this class | 70 * @param parentView The ViewGroup used to display this snackbar. If this is
null, this class |
| 71 * will determine where to attach the snackbar. | 71 * will determine where to attach the snackbar. |
| 72 */ | 72 */ |
| 73 SnackbarView(Activity activity, OnClickListener listener, Snackbar snackbar, | 73 SnackbarView(Activity activity, OnClickListener listener, Snackbar snackbar, |
| 74 @Nullable ViewGroup parentView) { | 74 @Nullable ViewGroup parentView) { |
| 75 mActivity = activity; | 75 mActivity = activity; |
| 76 mIsTablet = DeviceFormFactor.isTablet(activity); | 76 mIsTablet = DeviceFormFactor.isTablet(); |
| 77 | 77 |
| 78 if (parentView == null) { | 78 if (parentView == null) { |
| 79 mOriginalParent = findParentView(activity); | 79 mOriginalParent = findParentView(activity); |
| 80 if (activity instanceof ChromeActivity) mAnimateOverWebContent = tru
e; | 80 if (activity instanceof ChromeActivity) mAnimateOverWebContent = tru
e; |
| 81 } else { | 81 } else { |
| 82 mOriginalParent = parentView; | 82 mOriginalParent = parentView; |
| 83 } | 83 } |
| 84 | 84 |
| 85 mParent = mOriginalParent; | 85 mParent = mOriginalParent; |
| 86 mView = (ViewGroup) LayoutInflater.from(activity).inflate( | 86 mView = (ViewGroup) LayoutInflater.from(activity).inflate( |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 view.animate().cancel(); | 276 view.animate().cancel(); |
| 277 if (animate) { | 277 if (animate) { |
| 278 view.setAlpha(0.0f); | 278 view.setAlpha(0.0f); |
| 279 view.setText(text); | 279 view.setText(text); |
| 280 view.animate().alpha(1.f).setDuration(mAnimationDuration).setListene
r(null); | 280 view.animate().alpha(1.f).setDuration(mAnimationDuration).setListene
r(null); |
| 281 } else { | 281 } else { |
| 282 view.setText(text); | 282 view.setText(text); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 } | 285 } |
| OLD | NEW |