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;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.LinearLayout;
import org.chromium.base.ApiCompatibilityUtils;
......@@ -45,6 +46,7 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
public static final int ANIMATION_TYPE_BOUNDARY = 3;
private final InfoBarContainer mContainer;
private final LinearLayout mLinearLayout;
private final InfoBar mInfoBar;
private final ContentWrapperView mTargetWrapperView;
private final AnimatorSet mAnimatorSet;
......@@ -66,12 +68,13 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
public AnimationHelper(InfoBarContainer container, ContentWrapperView target, InfoBar infoBar,
View toShow, int animationType) {
mContainer = container;
mLinearLayout = container.getLinearLayout();
mInfoBar = infoBar;
mTargetWrapperView = target;
mAnimatorSet = new AnimatorSet();
mAnimationType = animationType;
mToShow = toShow;
assert mContainer.indexOfChild(mTargetWrapperView) != -1;
assert mLinearLayout.indexOfChild(mTargetWrapperView) != -1;
}
/**
......@@ -124,7 +127,7 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
if (mAnimationStarted) return;
mAnimationStarted = true;
int indexOfWrapperView = mContainer.indexOfChild(mTargetWrapperView);
int indexOfWrapperView = mLinearLayout.indexOfChild(mTargetWrapperView);
assert indexOfWrapperView != -1;
ArrayList<Animator> animators = new ArrayList<Animator>();
......@@ -145,8 +148,8 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
cumulativeTopEnd = -heightDifference;
}
for (int i = 0; i < mContainer.getChildCount(); ++i) {
View view = mContainer.getChildAt(i);
for (int i = 0; i < mLinearLayout.getChildCount(); ++i) {
View view = mLinearLayout.getChildAt(i);
// At this point, the View being transitioned in shouldn't have been added to the
// visible container, yet, and shouldn't affect calculations.
......@@ -200,10 +203,10 @@ public class AnimationHelper implements ViewTreeObserver.OnGlobalLayoutListener
// Lock the InfoBarContainer's size at its largest during the animation to avoid
// clipping issues.
int oldContainerTop = mContainer.getTop();
int newContainerTop = mContainer.getBottom() - cumulativeEndHeight;
int oldContainerTop = mLinearLayout.getTop();
int newContainerTop = mLinearLayout.getBottom() - cumulativeEndHeight;
int biggestContainerTop = Math.min(oldContainerTop, newContainerTop);
mContainer.setTop(biggestContainerTop);
mLinearLayout.setTop(biggestContainerTop);
// Set up and run all of the animations.
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
......
......@@ -83,7 +83,7 @@ public class ContentWrapperView extends FrameLayout {
* XHDPI devices and above get a double-tall boundary.
* @return The height of the boundary.
*/
private int getBoundaryHeight(Context context) {
static int getBoundaryHeight(Context context) {
float density = context.getResources().getDisplayMetrics().density;
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