Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1021)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/ImageCarousel.java

Issue 1574273002: Unify and Improve the Sign-In and Sync Confirmation Screens on Clank. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.firstrun; 5 package org.chromium.chrome.browser.firstrun;
6 6
7 import android.animation.Animator; 7 import android.animation.Animator;
8 import android.animation.AnimatorSet; 8 import android.animation.AnimatorSet;
9 import android.animation.ObjectAnimator; 9 import android.animation.ObjectAnimator;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 default: 213 default:
214 // Enable scrolling only if no account has already been selected . 214 // Enable scrolling only if no account has already been selected .
215 mScrollingDisabled = mAccountSelected; 215 mScrollingDisabled = mAccountSelected;
216 mImages = Arrays.copyOf(images, images.length); 216 mImages = Arrays.copyOf(images, images.length);
217 break; 217 break;
218 } 218 }
219 219
220 updateImageViews(); 220 updateImageViews();
221 } 221 }
222 222
223 ImageView mCheckmark;
223 /** 224 /**
224 * Sets the ImageCarousel to signed in mode that disables scrolling, animate s away the 225 * Sets whether the ImageCarousel is in signed in mode. This mode disables s crolling, animates
225 * background images, and displays a checkmark next to the account image tha t was chosen. 226 * away the background images, and displays a checkmark next to the chosen a ccount image.
227 * @param isSignedIn Whether the ImageCarousel should in signed in mode or n ot.
226 */ 228 */
227 public void setSignedInMode() { 229 public void setSignedInMode(boolean isSignedIn) {
228 mScrollingDisabled = true; 230 mScrollingDisabled = isSignedIn;
229 mAccountSelected = true; 231 mAccountSelected = isSignedIn;
230 setPosition(getCenterPosition()); 232 setPosition(getCenterPosition());
231 233
232 ImageView checkmark = new ImageView(getContext()); 234 if (mCheckmark == null) {
233 checkmark.setImageResource(R.drawable.verify_checkmark); 235 // If the checkmark hasn't been created and we don't want to show it , exit early.
234 setLayoutParamsForCheckmark(checkmark); 236 if (!isSignedIn) {
235 addView(checkmark); 237 return;
238 }
239
240 mCheckmark = new ImageView(getContext());
241 mCheckmark.setImageResource(R.drawable.verify_checkmark);
242 setLayoutParamsForCheckmark(mCheckmark);
243 addView(mCheckmark);
244 }
236 245
237 if (mFadeInOutAnimator != null) mFadeInOutAnimator.cancel(); 246 if (mFadeInOutAnimator != null) mFadeInOutAnimator.cancel();
238 AnimatorSet animatorSet = new AnimatorSet(); 247 AnimatorSet animatorSet = new AnimatorSet();
239 animatorSet.playTogether( 248 if (isSignedIn) {
240 ObjectAnimator.ofFloat(this, BACKGROUND_IMAGE_ALPHA, 0), 249 animatorSet.playTogether(ObjectAnimator.ofFloat(this, BACKGROUND_IMA GE_ALPHA, 0),
241 ObjectAnimator.ofFloat(checkmark, View.ALPHA, 0.0f, 1.0f)); 250 ObjectAnimator.ofFloat(mCheckmark, View.ALPHA, 0.0f, 1.0f));
251 } else {
252 animatorSet.playTogether(ObjectAnimator.ofFloat(this, BACKGROUND_IMA GE_ALPHA, 1),
253 ObjectAnimator.ofFloat(mCheckmark, View.ALPHA, 1.0f, 0.0f));
254 }
242 mFadeInOutAnimator = animatorSet; 255 mFadeInOutAnimator = animatorSet;
243 mFadeInOutAnimator.setDuration(ACCOUNT_SIGNED_IN_ANIMATION_DURATION_MS); 256 mFadeInOutAnimator.setDuration(ACCOUNT_SIGNED_IN_ANIMATION_DURATION_MS);
244 mFadeInOutAnimator.start(); 257 mFadeInOutAnimator.start();
245 } 258 }
246 259
247 @Override 260 @Override
248 public void onFinishInflate() { 261 public void onFinishInflate() {
249 super.onFinishInflate(); 262 super.onFinishInflate();
250 263
251 mImageWidth = getResources().getDimensionPixelSize(R.dimen.fre_image_car ousel_height); 264 mImageWidth = getResources().getDimensionPixelSize(R.dimen.fre_image_car ousel_height);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 private void setLayoutParamsForCheckmark(View view) { 431 private void setLayoutParamsForCheckmark(View view) {
419 int size = getResources().getDimensionPixelSize(R.dimen.fre_checkmark_si ze); 432 int size = getResources().getDimensionPixelSize(R.dimen.fre_checkmark_si ze);
420 FrameLayout.LayoutParams params = 433 FrameLayout.LayoutParams params =
421 new FrameLayout.LayoutParams(size, size); 434 new FrameLayout.LayoutParams(size, size);
422 params.gravity = Gravity.CENTER; 435 params.gravity = Gravity.CENTER;
423 view.setLayoutParams(params); 436 view.setLayoutParams(params);
424 view.setTranslationX((mImageWidth - size) / 2f); 437 view.setTranslationX((mImageWidth - size) / 2f);
425 view.setTranslationY((mImageWidth - size) / 2f); 438 view.setTranslationY((mImageWidth - size) / 2f);
426 } 439 }
427 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698