| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
|
| index c5a2ef4e8e4ba590433cc31f6878ceba029fb3b4..f45eb14d1c7139e11ee8df8297b226937886bb35 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
|
| @@ -127,11 +127,23 @@ public class CardViewHolder extends NewTabPageViewHolder {
|
| viewportHeight - mMaxPeekPadding - itemView.getTop(), 0, mMaxPeekPadding));
|
| }
|
|
|
| - /** Returns whether the card is currently peeking. */
|
| + /**
|
| + * @return Whether the card is peeking.
|
| + */
|
| public boolean isPeeking() {
|
| return mPeekPadding < mMaxPeekPadding;
|
| }
|
|
|
| + /**
|
| + * @return Whether the card can peek.
|
| + */
|
| + public boolean canPeek() {
|
| + // Only allow the card to peek if the user has not scrolled on the page beyond the
|
| + // |mMaxPeekPadding| height. There will only ever be one peeking card on the page and only
|
| + // when there is enough space to show the peeking card on the first screen at the bottom.
|
| + return mRecyclerView.computeVerticalScrollOffset() <= itemView.getHeight();
|
| + }
|
| +
|
| @Override
|
| public void updateViewStateForDismiss(float dX) {
|
| float input = Math.abs(dX) / itemView.getMeasuredWidth();
|
| @@ -148,7 +160,7 @@ public class CardViewHolder extends NewTabPageViewHolder {
|
| private void setPeekingStateForPadding(int padding) {
|
| // TODO(mcwilliams): Change the 'padding' value to a percentage of what the transition
|
| // should be which can be used for alpha and bleed.
|
| - mPeekPadding = padding;
|
| + mPeekPadding = canPeek() ? padding : mMaxPeekPadding;
|
|
|
| // Modify the padding so as the margin increases, the padding decreases, keeping the card's
|
| // contents in the same position. The top and bottom remain the same.
|
|
|