Commit 38881e37 authored by newt@chromium.org's avatar newt@chromium.org

Make InfobarContainer scrollable.

If only this were simple.

BUG=393999
CQ_TRYBOTS=tryserver.chromium.linux:android_aosp,android_clang_dbg,android_dbg

Review URL: https://codereview.chromium.org/487273004

Cr-Commit-Position: refs/heads/master@{#291275}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291275 0039d316-1c4b-4281-b951-d872f2087c98
parent 2a007701
...@@ -13,6 +13,7 @@ import android.os.Build; ...@@ -13,6 +13,7 @@ import android.os.Build;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.LinearLayout;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
...@@ -45,6 +46,7 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener ...@@ -45,6 +46,7 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
public static final int ANIMATION_TYPE_BOUNDARY = 3; public static final int ANIMATION_TYPE_BOUNDARY = 3;
private final InfoBarContainer mContainer; private final InfoBarContainer mContainer;
private final LinearLayout mLinearLayout;
private final InfoBar mInfoBar; private final InfoBar mInfoBar;
private final ContentWrapperView mTargetWrapperView; private final ContentWrapperView mTargetWrapperView;
private final AnimatorSet mAnimatorSet; private final AnimatorSet mAnimatorSet;
...@@ -66,12 +68,13 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener ...@@ -66,12 +68,13 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
public AnimationHelper(InfoBarContainer container, ContentWrapperView target, InfoBar infoBar, public AnimationHelper(InfoBarContainer container, ContentWrapperView target, InfoBar infoBar,
View toShow, int animationType) { View toShow, int animationType) {
mContainer = container; mContainer = container;
mLinearLayout = container.getLinearLayout();
mInfoBar = infoBar; mInfoBar = infoBar;
mTargetWrapperView = target; mTargetWrapperView = target;
mAnimatorSet = new AnimatorSet(); mAnimatorSet = new AnimatorSet();
mAnimationType = animationType; mAnimationType = animationType;
mToShow = toShow; mToShow = toShow;
assert mContainer.indexOfChild(mTargetWrapperView) != -1; assert mLinearLayout.indexOfChild(mTargetWrapperView) != -1;
} }
/** /**
...@@ -124,7 +127,7 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener ...@@ -124,7 +127,7 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
if (mAnimationStarted) return; if (mAnimationStarted) return;
mAnimationStarted = true; mAnimationStarted = true;
int indexOfWrapperView = mContainer.indexOfChild(mTargetWrapperView); int indexOfWrapperView = mLinearLayout.indexOfChild(mTargetWrapperView);
assert indexOfWrapperView != -1; assert indexOfWrapperView != -1;
ArrayList<Animator> animators = new ArrayList<Animator>(); ArrayList<Animator> animators = new ArrayList<Animator>();
...@@ -145,8 +148,8 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener ...@@ -145,8 +148,8 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
cumulativeTopEnd = -heightDifference; cumulativeTopEnd = -heightDifference;
} }
for (int i = 0; i < mContainer.getChildCount(); ++i) { for (int i = 0; i < mLinearLayout.getChildCount(); ++i) {
View view = mContainer.getChildAt(i); View view = mLinearLayout.getChildAt(i);
// At this point, the View being transitioned in shouldn't have been added to the // At this point, the View being transitioned in shouldn't have been added to the
// visible container, yet, and shouldn't affect calculations. // visible container, yet, and shouldn't affect calculations.
...@@ -200,10 +203,10 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener ...@@ -200,10 +203,10 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
// Lock the InfoBarContainer's size at its largest during the animation to avoid // Lock the InfoBarContainer's size at its largest during the animation to avoid
// clipping issues. // clipping issues.
int oldContainerTop = mContainer.getTop(); int oldContainerTop = mLinearLayout.getTop();
int newContainerTop = mContainer.getBottom() - cumulativeEndHeight; int newContainerTop = mLinearLayout.getBottom() - cumulativeEndHeight;
int biggestContainerTop = Math.min(oldContainerTop, newContainerTop); int biggestContainerTop = Math.min(oldContainerTop, newContainerTop);
mContainer.setTop(biggestContainerTop); mLinearLayout.setTop(biggestContainerTop);
// Set up and run all of the animations. // Set up and run all of the animations.
mAnimatorSet.addListener(new AnimatorListenerAdapter() { mAnimatorSet.addListener(new AnimatorListenerAdapter() {
......
...@@ -83,7 +83,7 @@ public class ContentWrapperView extends FrameLayout { ...@@ -83,7 +83,7 @@ public class ContentWrapperView extends FrameLayout {
* XHDPI devices and above get a double-tall boundary. * XHDPI devices and above get a double-tall boundary.
* @return The height of the boundary. * @return The height of the boundary.
*/ */
private int getBoundaryHeight(Context context) { static int getBoundaryHeight(Context context) {
float density = context.getResources().getDisplayMetrics().density; float density = context.getResources().getDisplayMetrics().density;
return density < 2.0f ? 1 : 2; return density < 2.0f ? 1 : 2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment