| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.bottomsheet; | 5 package org.chromium.chrome.browser.widget.bottomsheet; |
| 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 List<Animator> animators = new ArrayList<>(); | 671 List<Animator> animators = new ArrayList<>(); |
| 672 mContentSwapAnimatorSet = new AnimatorSet(); | 672 mContentSwapAnimatorSet = new AnimatorSet(); |
| 673 mContentSwapAnimatorSet.addListener(new AnimatorListenerAdapter() { | 673 mContentSwapAnimatorSet.addListener(new AnimatorListenerAdapter() { |
| 674 @Override | 674 @Override |
| 675 public void onAnimationEnd(Animator animation) { | 675 public void onAnimationEnd(Animator animation) { |
| 676 mSheetContent = content; | 676 mSheetContent = content; |
| 677 for (BottomSheetObserver o : mObservers) { | 677 for (BottomSheetObserver o : mObservers) { |
| 678 o.onSheetContentChanged(content); | 678 o.onSheetContentChanged(content); |
| 679 } | 679 } |
| 680 updateHandleTint(); | 680 updateHandleTint(); |
| 681 mToolbarHolder.setBackgroundColor(Color.TRANSPARENT); |
| 681 mContentSwapAnimatorSet = null; | 682 mContentSwapAnimatorSet = null; |
| 682 } | 683 } |
| 683 }); | 684 }); |
| 684 | 685 |
| 685 // For the toolbar transition, make sure we don't detach the default too
lbar view. | 686 // For the toolbar transition, make sure we don't detach the default too
lbar view. |
| 686 animators.add(getViewTransitionAnimator( | 687 animators.add(getViewTransitionAnimator( |
| 687 newToolbar, oldToolbar, mToolbarHolder, mDefaultToolbarView != o
ldToolbar)); | 688 newToolbar, oldToolbar, mToolbarHolder, mDefaultToolbarView != o
ldToolbar)); |
| 688 animators.add(getViewTransitionAnimator( | 689 animators.add(getViewTransitionAnimator( |
| 689 content.getContentView(), oldContent, mBottomSheetContentContain
er, true)); | 690 content.getContentView(), oldContent, mBottomSheetContentContain
er, true)); |
| 690 | 691 |
| 692 // Temporarily make the background of the toolbar holder a solid color s
o the transition |
| 693 // doesn't appear to show a hole in the toolbar. |
| 694 mToolbarHolder.setBackgroundColor( |
| 695 ApiCompatibilityUtils.getColor(getResources(), R.color.default_p
rimary_color)); |
| 691 mContentSwapAnimatorSet.playTogether(animators); | 696 mContentSwapAnimatorSet.playTogether(animators); |
| 692 mContentSwapAnimatorSet.start(); | 697 mContentSwapAnimatorSet.start(); |
| 693 | 698 |
| 694 // If the existing content is null, end the animation immediately. | 699 // If the existing content is null, end the animation immediately. |
| 695 if (mSheetContent == null) mContentSwapAnimatorSet.end(); | 700 if (mSheetContent == null) mContentSwapAnimatorSet.end(); |
| 696 } | 701 } |
| 697 | 702 |
| 698 /** | 703 /** |
| 699 * Creates a transition animation between two views. The old view is faded o
ut completely | 704 * Creates a transition animation between two views. The old view is faded o
ut completely |
| 700 * before the new view is faded in. There is an option to detach the old vie
w or not. | 705 * before the new view is faded in. There is an option to detach the old vie
w or not. |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 getContext(), mControlContainer, R.string.bottom_sheet_help_bubb
le_message); | 1159 getContext(), mControlContainer, R.string.bottom_sheet_help_bubb
le_message); |
| 1155 int inset = getContext().getResources().getDimensionPixelSize( | 1160 int inset = getContext().getResources().getDimensionPixelSize( |
| 1156 R.dimen.bottom_sheet_help_bubble_inset); | 1161 R.dimen.bottom_sheet_help_bubble_inset); |
| 1157 helpBubble.setInsetPx(0, inset, 0, inset); | 1162 helpBubble.setInsetPx(0, inset, 0, inset); |
| 1158 helpBubble.setDismissOnTouchInteraction(true); | 1163 helpBubble.setDismissOnTouchInteraction(true); |
| 1159 helpBubble.show(); | 1164 helpBubble.show(); |
| 1160 | 1165 |
| 1161 preferences.edit().putBoolean(BOTTOM_SHEET_HELP_BUBBLE_SHOWN, true).appl
y(); | 1166 preferences.edit().putBoolean(BOTTOM_SHEET_HELP_BUBBLE_SHOWN, true).appl
y(); |
| 1162 } | 1167 } |
| 1163 } | 1168 } |
| OLD | NEW |