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

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

Issue 2673003003: Rename MostVisited ui bits to Tile(Grid). (Closed)
Patch Set: Rebase. Created 3 years, 10 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 184f52fecf6eb277b3165afa251a0aca70d46649..53fc6a5eb76c516fb55bdf28f3ed69cce0936b01 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
@@ -16,6 +16,7 @@ import org.chromium.chrome.browser.ntp.NewTabPageUma.NTPLayoutResult;
import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters;
import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView;
import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig;
+import org.chromium.chrome.browser.suggestions.TileGridLayout;
/**
* Layout for the new tab page. This positions the page elements in the correct vertical positions.
@@ -35,7 +36,7 @@ public class NewTabPageLayout extends LinearLayout {
private final int mMiddleSpacerIdealHeight;
private final int mBottomSpacerIdealHeight;
private final int mTotalSpacerIdealHeight;
- private final int mMostVisitedLayoutBleed;
+ private final int mTileGridLayoutBleed;
private final int mPeekingCardHeight;
private final int mTabStripHeight;
private final int mFieldTrialLayoutAdjustment;
@@ -52,7 +53,7 @@ public class NewTabPageLayout extends LinearLayout {
private LogoView mSearchProviderLogoView;
private View mSearchBoxView;
- private MostVisitedLayout mMostVisitedLayout;
+ private TileGridLayout mTileGridLayout;
private boolean mLayoutResultRecorded;
@@ -67,7 +68,7 @@ public class NewTabPageLayout extends LinearLayout {
mMiddleSpacerIdealHeight = Math.round(density * MIDDLE_SPACER_HEIGHT_DP);
mBottomSpacerIdealHeight = Math.round(density * BOTTOM_SPACER_HEIGHT_DP);
mTotalSpacerIdealHeight = Math.round(density * TOTAL_SPACER_HEIGHT_DP);
- mMostVisitedLayoutBleed = res.getDimensionPixelSize(R.dimen.most_visited_layout_bleed);
+ mTileGridLayoutBleed = res.getDimensionPixelSize(R.dimen.tile_grid_layout_bleed);
mPeekingCardHeight = SnippetsConfig.isIncreasedCardVisibilityEnabled()
? res.getDimensionPixelSize(R.dimen.snippets_peeking_card_peek_amount)
: res.getDimensionPixelSize(R.dimen.snippets_padding);
@@ -87,7 +88,7 @@ public class NewTabPageLayout extends LinearLayout {
mSearchBoxSpacer = findViewById(R.id.search_box_spacer);
mSearchProviderLogoView = (LogoView) findViewById(R.id.search_provider_logo);
mSearchBoxView = findViewById(R.id.search_box);
- mMostVisitedLayout = (MostVisitedLayout) findViewById(R.id.most_visited_layout);
+ mTileGridLayout = (TileGridLayout) findViewById(R.id.tile_grid_layout);
}
/**
@@ -120,7 +121,7 @@ public class NewTabPageLayout extends LinearLayout {
mSearchBoxSpacer.setVisibility(View.GONE);
// Remove the extra spacing before measuring because it might not be needed anymore.
- mMostVisitedLayout.setExtraVerticalSpacing(0);
+ mTileGridLayout.setExtraVerticalSpacing(0);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -133,20 +134,19 @@ public class NewTabPageLayout extends LinearLayout {
layoutResult = NewTabPageUma.NTP_LAYOUT_DOES_NOT_FIT;
// We don't have enough, we will push the peeking card completely below the fold
- // and let MostVisited get cut to make it clear that the page is scrollable.
- if (mMostVisitedLayout.getChildCount() > 0) {
+ // and let the tile grid get cut to make it clear that the page is scrollable.
+ if (mTileGridLayout.getChildCount() > 0) {
// Add some extra space if needed (the 'bleed' is the amount of the layout that
// will be cut off by the bottom of the screen).
int currentBleed = getMeasuredHeight() - mParentViewportHeight - mTabStripHeight;
- int minimumBleed =
- (int) (mMostVisitedLayout.getChildAt(0).getMeasuredHeight() * 0.44);
+ int minimumBleed = (int) (mTileGridLayout.getChildAt(0).getMeasuredHeight() * 0.44);
if (currentBleed < minimumBleed) {
int extraBleed = minimumBleed - currentBleed;
mLogoSpacer.getLayoutParams().height = (int) (extraBleed * 0.25);
mLogoSpacer.setVisibility(View.INVISIBLE);
mSearchBoxSpacer.getLayoutParams().height = (int) (extraBleed * 0.25);
mSearchBoxSpacer.setVisibility(View.INVISIBLE);
- mMostVisitedLayout.setExtraVerticalSpacing((int) (extraBleed * 0.5));
+ mTileGridLayout.setExtraVerticalSpacing((int) (extraBleed * 0.5));
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
layoutResult = NewTabPageUma.NTP_LAYOUT_DOES_NOT_FIT_PUSH_MOST_LIKELY;
@@ -185,9 +185,9 @@ public class NewTabPageLayout extends LinearLayout {
NewTabPageRecyclerView recyclerView = (NewTabPageRecyclerView) getParent();
recyclerView.setHasSpaceForPeekingCard(hasSpaceForPeekingCard);
- // The first few runs of this method occur before the Most Visited layout has loaded it's
+ // The first few runs of this method occur before the tile grid layout has loaded its
// contents. We want to record what the user sees when the layout has stabilized.
- if (mMostVisitedLayout.getChildCount() > 0 && !mLayoutResultRecorded) {
+ if (mTileGridLayout.getChildCount() > 0 && !mLayoutResultRecorded) {
mLayoutResultRecorded = true;
NewTabPageUma.recordNTPLayoutResult(layoutResult);
}
@@ -197,8 +197,8 @@ public class NewTabPageLayout extends LinearLayout {
* Makes the Search Box and Logo as wide as Most Visited.
*/
private void unifyElementWidths() {
- if (mMostVisitedLayout.getVisibility() != GONE) {
- final int width = mMostVisitedLayout.getMeasuredWidth() - mMostVisitedLayoutBleed;
+ if (mTileGridLayout.getVisibility() != GONE) {
+ final int width = mTileGridLayout.getMeasuredWidth() - mTileGridLayoutBleed;
measureExactly(mSearchBoxView,
width + mSearchboxShadowWidth, mSearchBoxView.getMeasuredHeight());
measureExactly(mSearchProviderLogoView,

Powered by Google App Engine
This is Rietveld 408576698