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

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

Issue 1947263003: Pin the snippets to the bottom of the page and introduce a peeking card to indicate to the user the… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 b1d3779bd2489a4c7ff8b07cc465c3f3193f1702..96ba81dd16459042658abdd180a40b4caa6eb585 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
@@ -6,10 +6,12 @@ package org.chromium.chrome.browser.ntp;
import android.content.Context;
import android.content.res.Resources;
+import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
+import org.chromium.base.Log;
import org.chromium.chrome.R;
/**
@@ -79,6 +81,7 @@ public class NewTabPageLayout extends LinearLayout {
* @param height The height of the scroll viewport containing this view.
*/
public void setParentScrollViewportHeight(int height) {
+ Log.i("NewTabPageLayout", "set mParentScrollViewportHeight: %s", height);
May 2016/05/05 16:28:21 Remove log
PEConn 2016/05/05 16:31:28 I think we can remove this?
Bernhard Bauer 2016/05/05 16:46:04 Make this Log.d(), so it can be removed in Debug b
mcwilliams 2016/05/05 17:39:46 Done.
mcwilliams 2016/05/05 17:39:46 Done.
mcwilliams 2016/05/05 17:39:46 Done.
mParentScrollViewportHeight = height;
}
@@ -86,6 +89,22 @@ public class NewTabPageLayout extends LinearLayout {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mScrollCompensationSpacer.getLayoutParams().height = 0;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ // Check if we are showing snippets. If Most Likely is fully rendered on the initial page
+ // load and has enough space for the peeking card, push snippets to the bottom of the page
+ // to show the peeking card.
+ if (NewTabPageView.isUseCardsUiEnabled()) {
Bernhard Bauer 2016/05/05 16:46:04 Aaaand now I see why you wanted to make this stati
mcwilliams 2016/05/05 17:39:46 Done.
+ int peekingCardHeight = getContext().getResources().getDimensionPixelSize(
+ R.dimen.snippets_padding_and_peeking_card_height);
+ if (mParentScrollViewportHeight >= getMeasuredHeight() + peekingCardHeight) {
+ RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) getLayoutParams();
+ params.height = mParentScrollViewportHeight - peekingCardHeight;
+ setLayoutParams(params);
Bernhard Bauer 2016/05/05 16:46:04 If you need to trigger a layout after changing the
mcwilliams 2016/05/05 17:39:46 Removed as not needed
+ }
+ }
+ // TODO(https://crbug.com/609487): Implement push snippets below the fold when most likely
Bernhard Bauer 2016/05/05 16:46:04 Nit: s/Implement //
mcwilliams 2016/05/05 17:39:46 Done.
+ // is not fully rendered.
+
distributeExtraSpace(mTopSpacer.getMeasuredHeight());
int minScrollAmountRequired = 0;

Powered by Google App Engine
This is Rietveld 408576698