Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileView.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileView.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileView.java |
| index 535489c8a532fe7009ca20d5fa0eab408fc33050..0b423e1407c78fbdba0891e06beed95e793b0379 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileView.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileView.java |
| @@ -5,6 +5,7 @@ |
| package org.chromium.chrome.browser.suggestions; |
| import android.content.Context; |
| +import android.content.res.Resources; |
| import android.util.AttributeSet; |
| import android.view.View; |
| import android.widget.FrameLayout; |
| @@ -36,8 +37,9 @@ public class TileView extends FrameLayout { |
| * after inflation. |
| * @param tile The tile that holds the data to populate this view. |
| * @param titleLines The number of text lines to use for the tile title. |
| + * @param condensed Whether to use a condensed layout. |
| */ |
| - public void initialize(Tile tile, int titleLines) { |
| + public void initialize(Tile tile, int titleLines, boolean condensed) { |
| mTile = tile; |
| TextView titleView = (TextView) findViewById(R.id.tile_view_title); |
| titleView.setLines(titleLines); |
| @@ -45,6 +47,32 @@ public class TileView extends FrameLayout { |
| renderIcon(); |
| findViewById(R.id.offline_badge) |
| .setVisibility(mTile.isOfflineAvailable() ? View.VISIBLE : View.GONE); |
| + |
| + if (!condensed) return; |
| + |
| + Resources res = getResources(); |
| + |
| + setPadding(0, 0, 0, 0); |
|
dgn
2017/02/23 15:17:44
it would be nice to have a todo with a bug to move
Michael van Ouwerkerk
2017/02/24 11:31:19
Done.
|
| + LayoutParams tileParams = (LayoutParams) getLayoutParams(); |
| + tileParams.width = res.getDimensionPixelOffset(R.dimen.tile_view_width_condensed); |
| + setLayoutParams(tileParams); |
| + |
| + View iconView = findViewById(R.id.tile_view_icon); |
| + LayoutParams iconParams = (LayoutParams) iconView.getLayoutParams(); |
| + iconParams.setMargins( |
|
dgn
2017/02/23 15:17:44
is it only the padding that gets reset when the im
Michael van Ouwerkerk
2017/02/24 11:31:19
I haven't seen any problems with this. Looking at
|
| + 0, res.getDimensionPixelOffset(R.dimen.tile_view_icon_margin_top_condensed), 0, 0); |
| + iconView.setLayoutParams(iconParams); |
| + |
| + View highlightView = findViewById(R.id.tile_view_highlight); |
| + LayoutParams highlightParams = (LayoutParams) highlightView.getLayoutParams(); |
| + highlightParams.setMargins( |
| + 0, res.getDimensionPixelOffset(R.dimen.tile_view_icon_margin_top_condensed), 0, 0); |
| + highlightView.setLayoutParams(highlightParams); |
| + |
| + LayoutParams titleParams = (LayoutParams) titleView.getLayoutParams(); |
| + titleParams.setMargins( |
| + 0, res.getDimensionPixelOffset(R.dimen.tile_view_title_margin_top_condensed), 0, 0); |
| + titleView.setLayoutParams(titleParams); |
| } |
| /** |