| Index: chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemView.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemView.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemView.java
|
| index c716ed41350a1a2fe29b630fb4cdceb03dc3c7da..0cd3250cad1335ba40b0d0b656e816ee8dc46bdd 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemView.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableItemView.java
|
| @@ -9,12 +9,13 @@ import android.util.AttributeSet;
|
| import android.view.View;
|
| import android.view.View.OnClickListener;
|
| import android.view.View.OnLongClickListener;
|
| -import android.view.ViewGroup.MarginLayoutParams;
|
| import android.widget.Checkable;
|
| import android.widget.FrameLayout;
|
|
|
| -import org.chromium.base.ApiCompatibilityUtils;
|
| import org.chromium.chrome.R;
|
| +import org.chromium.chrome.browser.widget.displaystyle.HorizontalDisplayStyle;
|
| +import org.chromium.chrome.browser.widget.displaystyle.MarginResizer;
|
| +import org.chromium.chrome.browser.widget.displaystyle.UiConfig;
|
| import org.chromium.chrome.browser.widget.selection.SelectionDelegate.SelectionObserver;
|
|
|
| import java.util.List;
|
| @@ -62,6 +63,19 @@ public abstract class SelectableItemView<E> extends FrameLayout implements Check
|
| }
|
|
|
| /**
|
| + * Sets the lateral margins used in {@link HorizontalDisplayStyle#WIDE} and
|
| + * {@link HorizontalDisplayStyle#REGULAR}. This should be called when the item uses the
|
| + * list_item* 9-patches as a background and the SelectableListLayout that contains the item
|
| + * is width constrained.
|
| + *
|
| + * @param uiConfig The UiConfig used to observe display style changes.
|
| + */
|
| + public void setHasWideDisplayStyle(UiConfig uiConfig) {
|
| + MarginResizer.createWithViewAdapter(this, uiConfig,
|
| + SelectableListLayout.getDefaultListItemLateralMarginPx(getResources()), 0);
|
| + }
|
| +
|
| + /**
|
| * @param item The item associated with this SelectableItemView.
|
| */
|
| public void setItem(E item) {
|
| @@ -190,31 +204,4 @@ public abstract class SelectableItemView<E> extends FrameLayout implements Check
|
|
|
| setBackgroundResource(backgroundResource);
|
| }
|
| -
|
| - /**
|
| - * Sets lateral margins to effectively hide the lateral shadow and rounded corners on the
|
| - * list_item* 9-patches used as backgrounds.
|
| - * @param contentView The container view surrounding the list item content. Extra start and end
|
| - * padding will be added to this view to account for incorrect internal
|
| - * padding in the 9-patches.
|
| - */
|
| - public void setLateralMarginsForDefaultDisplay(View contentView) {
|
| - MarginLayoutParams layoutParams = (MarginLayoutParams) getLayoutParams();
|
| - layoutParams.setMargins(
|
| - SelectableListLayout.getDefaultListItemLateralMarginPx(getResources()),
|
| - layoutParams.topMargin,
|
| - SelectableListLayout.getDefaultListItemLateralMarginPx(getResources()),
|
| - layoutParams.bottomMargin);
|
| -
|
| - // TODO(twellington): remove this when new assets with the correct built in padding are
|
| - // available. This can move to XML once the bookmark and download layouts
|
| - // are width constrained to 600dp.
|
| - int lateralPaddingOffset =
|
| - getResources().getDimensionPixelSize(R.dimen.list_item_lateral_padding);
|
| - int startPadding = ApiCompatibilityUtils.getPaddingStart(contentView);
|
| - int endPadding = ApiCompatibilityUtils.getPaddingEnd(contentView);
|
| - ApiCompatibilityUtils.setPaddingRelative(contentView, startPadding + lateralPaddingOffset,
|
| - contentView.getPaddingTop(), endPadding + lateralPaddingOffset,
|
| - contentView.getPaddingBottom());
|
| - }
|
| }
|
|
|