Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/firstrun/ImageCarousel.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ImageCarousel.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ImageCarousel.java |
| index df5a61f7a456b7fccc045f36258de5f03fb01d21..4fb92ef555e1b9fb6b4f26ba6e96a7f6b70673ce 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ImageCarousel.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ImageCarousel.java |
| @@ -220,25 +220,38 @@ public class ImageCarousel extends FrameLayout implements GestureDetector.OnGest |
| updateImageViews(); |
| } |
| + ImageView mCheckmark; |
|
newt (away)
2016/02/03 17:57:29
Make this private and put it with the other member
PEConn
2016/02/04 19:26:10
Done.
|
| /** |
| - * Sets the ImageCarousel to signed in mode that disables scrolling, animates away the |
| - * background images, and displays a checkmark next to the account image that was chosen. |
| + * Sets whether the ImageCarousel is in signed in mode. This mode disables scrolling, animates |
| + * away the background images, and displays a checkmark next to the chosen account image. |
| + * @param isSignedIn Whether the ImageCarousel should in signed in mode or not. |
| */ |
| - public void setSignedInMode() { |
| - mScrollingDisabled = true; |
| - mAccountSelected = true; |
| + public void setSignedInMode(boolean isSignedIn) { |
| + mScrollingDisabled = isSignedIn; |
| + mAccountSelected = isSignedIn; |
| setPosition(getCenterPosition()); |
| - ImageView checkmark = new ImageView(getContext()); |
| - checkmark.setImageResource(R.drawable.verify_checkmark); |
| - setLayoutParamsForCheckmark(checkmark); |
| - addView(checkmark); |
| + if (mCheckmark == null) { |
| + // If the checkmark hasn't been created and we don't want to show it, exit early. |
| + if (!isSignedIn) { |
| + return; |
|
newt (away)
2016/02/03 17:57:29
Early returns hidden in the middle of a method can
PEConn
2016/02/04 19:26:10
Done.
|
| + } |
| + |
| + mCheckmark = new ImageView(getContext()); |
| + mCheckmark.setImageResource(R.drawable.verify_checkmark); |
| + setLayoutParamsForCheckmark(mCheckmark); |
| + addView(mCheckmark); |
| + } |
| if (mFadeInOutAnimator != null) mFadeInOutAnimator.cancel(); |
| AnimatorSet animatorSet = new AnimatorSet(); |
| - animatorSet.playTogether( |
| - ObjectAnimator.ofFloat(this, BACKGROUND_IMAGE_ALPHA, 0), |
| - ObjectAnimator.ofFloat(checkmark, View.ALPHA, 0.0f, 1.0f)); |
| + if (isSignedIn) { |
| + animatorSet.playTogether(ObjectAnimator.ofFloat(this, BACKGROUND_IMAGE_ALPHA, 0), |
| + ObjectAnimator.ofFloat(mCheckmark, View.ALPHA, 0.0f, 1.0f)); |
| + } else { |
| + animatorSet.playTogether(ObjectAnimator.ofFloat(this, BACKGROUND_IMAGE_ALPHA, 1), |
| + ObjectAnimator.ofFloat(mCheckmark, View.ALPHA, 1.0f, 0.0f)); |
| + } |
| mFadeInOutAnimator = animatorSet; |
| mFadeInOutAnimator.setDuration(ACCOUNT_SIGNED_IN_ANIMATION_DURATION_MS); |
| mFadeInOutAnimator.start(); |