Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1219)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java

Issue 2144413003: NTP, peeking card and heading hiding constraints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
index a4e1f4fa6697b98e31fda6a70947f4b0ef97f340..e64db2850951257c803fee607c4c30e91881352b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
@@ -107,31 +107,29 @@ public class NewTabPageLayout extends LinearLayout {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (getMeasuredHeight() > mParentViewportHeight) {
- // This layout is bigger than its parent's viewport, so the user will need to scroll
- // to see all of it. Extra spacing should be added at the bottom so the user can scroll
- // until Most Visited is at the top.
-
- // The top, middle, and bottom spacers should have a measured height of 0 at this point
- // since they use weights to set height, and there was no extra space.
- assert mTopSpacer.getMeasuredHeight() == 0;
- assert mMiddleSpacer.getMeasuredHeight() == 0;
- assert mBottomSpacer.getMeasuredHeight() == 0;
-
- final int topOfMostVisited = calculateTopOfMostVisited();
- final int belowTheFoldHeight = getMeasuredHeight() - mParentViewportHeight;
- if (belowTheFoldHeight < topOfMostVisited) {
- mScrollCompensationSpacer.getLayoutParams().height =
- topOfMostVisited - belowTheFoldHeight;
-
- if (mCardsUiEnabled) {
- // If we have a peeking card, allow that to show at the bottom of the screen.
- mScrollCompensationSpacer.getLayoutParams().height -= mPeekingCardHeight;
+ // No spacing needed when |mCardsUiEnabled| is enabled.
Michael van Ouwerkerk 2016/07/15 15:05:28 How about: "No scroll spacing needed when using th
mcwilliams 2016/07/18 15:11:45 Done.
+ if (!mCardsUiEnabled) {
+ // This layout is bigger than its parent's viewport, so the user will need to scroll
+ // to see all of it. Extra spacing should be added at the bottom so the user can
+ // scroll until Most Visited is at the top.
+
+ // The top, middle, and bottom spacers should have a measured height of 0 at this
+ // point since they use weights to set height, and there was no extra space.
+ assert mTopSpacer.getMeasuredHeight() == 0;
+ assert mMiddleSpacer.getMeasuredHeight() == 0;
+ assert mBottomSpacer.getMeasuredHeight() == 0;
+
+ final int topOfMostVisited = calculateTopOfMostVisited();
+ final int belowTheFoldHeight = getMeasuredHeight() - mParentViewportHeight;
+ if (belowTheFoldHeight < topOfMostVisited) {
+ // Include the scroll spacer in the layout and call super.onMeasure again so it
+ // is measured.
+ mScrollCompensationSpacer.getLayoutParams().height =
+ topOfMostVisited - belowTheFoldHeight;
+
+ mScrollCompensationSpacer.setVisibility(View.INVISIBLE);
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
-
- // Include the scroll spacer in the layout and call super.onMeasure again so it is
- // measured.
- mScrollCompensationSpacer.setVisibility(View.INVISIBLE);
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
} else {
// This layout is smaller than or equal to its parent viewport. Redistribute any

Powered by Google App Engine
This is Rietveld 408576698