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

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: 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 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.chrome.R; 10 import org.chromium.chrome.R;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 private final TileGridLayout mLayout; 96 private final TileGridLayout mLayout;
97 97
98 public ViewHolder(ViewGroup parentView) { 98 public ViewHolder(ViewGroup parentView) {
99 super(LayoutInflater.from(parentView.getContext()) 99 super(LayoutInflater.from(parentView.getContext())
100 .inflate(R.layout.suggestions_site_tile_grid, parent View, false)); 100 .inflate(R.layout.suggestions_site_tile_grid, parent View, false));
101 mLayout = (TileGridLayout) itemView; 101 mLayout = (TileGridLayout) itemView;
102 } 102 }
103 103
104 public void onBindViewHolder(TileGroup tileGroup) { 104 public void onBindViewHolder(TileGroup tileGroup) {
105 mLayout.setMaxRows(getMaxTileRows()); 105 mLayout.setMaxRows(getMaxTileRows());
106 tileGroup.renderTileViews(mLayout, /* trackLoadTasks = */ false, get TileTitleLines()); 106 mLayout.setMaxColumns(MAX_TILE_COLUMNS);
107 tileGroup.renderTileViews(mLayout, /* trackLoadTasks = */ false, get TileTitleLines(),
108 /* condensed = */ false);
107 } 109 }
108 110
109 public void updateIconView(Tile tile) { 111 public void updateIconView(Tile tile) {
110 mLayout.updateIconView(tile); 112 mLayout.updateIconView(tile);
111 } 113 }
112 114
113 /** 115 /**
114 * Callback to update the icon view for the view holder. 116 * Callback to update the icon view for the view holder.
115 */ 117 */
116 public static class UpdateIconViewCallback extends PartialBindCallback { 118 public static class UpdateIconViewCallback extends PartialBindCallback {
117 private final Tile mTile; 119 private final Tile mTile;
118 120
119 public UpdateIconViewCallback(Tile tile) { 121 public UpdateIconViewCallback(Tile tile) {
120 mTile = tile; 122 mTile = tile;
121 } 123 }
122 124
123 @Override 125 @Override
124 public void onResult(NewTabPageViewHolder holder) { 126 public void onResult(NewTabPageViewHolder holder) {
125 assert holder instanceof ViewHolder; 127 assert holder instanceof ViewHolder;
126 ((ViewHolder) holder).updateIconView(mTile); 128 ((ViewHolder) holder).updateIconView(mTile);
127 } 129 }
128 } 130 }
129 } 131 }
130 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698