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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGrid.java

Issue 2714723002: Add feature for condensed NTP tiles. (Closed)
Patch Set: Cleanups. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.suggestions; 5 package org.chromium.chrome.browser.suggestions;
6 6
7 import android.view.LayoutInflater; 7 import android.view.LayoutInflater;
8 import android.view.ViewGroup; 8 import android.view.ViewGroup;
9 9
10 import org.chromium.base.ContextUtils; 10 import org.chromium.base.ContextUtils;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 /** 100 /**
101 * The {@code ViewHolder} for the {@link TileGrid}. 101 * The {@code ViewHolder} for the {@link TileGrid}.
102 */ 102 */
103 public static class ViewHolder extends NewTabPageViewHolder { 103 public static class ViewHolder extends NewTabPageViewHolder {
104 private final TileGridLayout mLayout; 104 private final TileGridLayout mLayout;
105 105
106 public ViewHolder(ViewGroup parentView) { 106 public ViewHolder(ViewGroup parentView) {
107 super(LayoutInflater.from(parentView.getContext()) 107 super(LayoutInflater.from(parentView.getContext())
108 .inflate(R.layout.suggestions_site_tile_grid, parent View, false)); 108 .inflate(R.layout.suggestions_site_tile_grid, parent View, false));
109 mLayout = (TileGridLayout) itemView; 109 mLayout = (TileGridLayout) itemView;
110 mLayout.setMaxRows(getMaxTileRows());
111 mLayout.setMaxColumns(MAX_TILE_COLUMNS);
110 } 112 }
111 113
112 public void onBindViewHolder(TileGroup tileGroup) { 114 public void onBindViewHolder(TileGroup tileGroup) {
113 mLayout.setMaxRows(getMaxTileRows()); 115 tileGroup.renderTileViews(mLayout, /* trackLoadTasks = */ false,
114 tileGroup.renderTileViews(mLayout, /* trackLoadTasks = */ false); 116 /* condensed = */ false);
115 } 117 }
116 118
117 public void updateIconView(Tile tile) { 119 public void updateIconView(Tile tile) {
118 mLayout.updateIconView(tile); 120 mLayout.updateIconView(tile);
119 } 121 }
120 122
121 public void updateOfflineBadge(Tile tile) { 123 public void updateOfflineBadge(Tile tile) {
122 mLayout.updateOfflineBadge(tile); 124 mLayout.updateOfflineBadge(tile);
123 } 125 }
124 126
(...skipping 25 matching lines...) Expand all
150 } 152 }
151 153
152 @Override 154 @Override
153 public void onResult(NewTabPageViewHolder holder) { 155 public void onResult(NewTabPageViewHolder holder) {
154 assert holder instanceof ViewHolder; 156 assert holder instanceof ViewHolder;
155 ((ViewHolder) holder).updateOfflineBadge(mTile); 157 ((ViewHolder) holder).updateOfflineBadge(mTile);
156 } 158 }
157 } 159 }
158 } 160 }
159 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698