Skip to content

Commit

Permalink
Set the parent viewport on the NewTabPageScroll
Browse files Browse the repository at this point in the history
Introduced a bug on new tab page scroll where on measure is slightly different when recycler view is enabled. Reverting this change and cleaning it up slightly

BUG=610262

Review-Url: https://codereview.chromium.org/1965363002
Cr-Commit-Position: refs/heads/master@{#392953}
  • Loading branch information
mcwilliams authored and Commit bot committed May 11, 2016
1 parent 3e302bd commit 436aed1
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public interface OnScrollListener {
private GestureDetector mGestureDetector;
private OnScrollListener mOnScrollListener;

private NewTabPageLayout mNewTabPageLayout;

private FadingShadow mFadingShadow;

/**
Expand Down Expand Up @@ -74,6 +76,22 @@ public void enableBottomShadow(int shadowColor) {
setFadingEdgeLength(getResources().getDimensionPixelSize(R.dimen.ntp_shadow_height));
}

@Override
protected void onFinishInflate() {
super.onFinishInflate();

// Incognito also uses this scroll view but will not have the id so will return null.
mNewTabPageLayout = (NewTabPageLayout) findViewById(R.id.ntp_content);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mNewTabPageLayout != null) {
mNewTabPageLayout.setParentScrollViewportHeight(MeasureSpec.getSize(heightMeasureSpec));
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
mGestureDetector.onTouchEvent(ev);
Expand Down

0 comments on commit 436aed1

Please sign in to comment.