Commit 8a69c117 authored by Sinan Sahin's avatar Sinan Sahin Committed by Commit Bot

Fixing EOC snippets getting chopped

Bug: 935277
Change-Id: I5992ec261fa91dc2809451a19850c4ac6813228e
Reviewed-on: https://chromium-review.googlesource.com/c/1487178Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarBecky Zhou <huayinz@chromium.org>
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Cr-Commit-Position: refs/heads/master@{#635633}
parent 2057647e
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="vertical" android:scrollbars="vertical"
android:scrollbarStyle="outsideOverlay"
android:layout_marginTop="@dimen/bottom_sheet_peek_height" android:layout_marginTop="@dimen/bottom_sheet_peek_height"
android:background="@color/modern_primary_color" /> android:background="@color/modern_primary_color" />
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.contextual_suggestions; package org.chromium.chrome.browser.contextual_suggestions;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnScrollListener; import android.support.v7.widget.RecyclerView.OnScrollListener;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -17,6 +18,7 @@ import org.chromium.chrome.browser.profiles.Profile; ...@@ -17,6 +18,7 @@ import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.suggestions.SuggestionsRecyclerView; import org.chromium.chrome.browser.suggestions.SuggestionsRecyclerView;
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
import org.chromium.chrome.browser.widget.displaystyle.UiConfig; import org.chromium.chrome.browser.widget.displaystyle.UiConfig;
import org.chromium.chrome.browser.widget.displaystyle.ViewResizer;
import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.WindowAndroid;
/** /**
...@@ -31,6 +33,8 @@ class ContentCoordinator { ...@@ -31,6 +33,8 @@ class ContentCoordinator {
private WindowAndroid mWindowAndroid; private WindowAndroid mWindowAndroid;
private ContextMenuManager mContextMenuManager; private ContextMenuManager mContextMenuManager;
private ContextualSuggestionsAdapter mAdapter; private ContextualSuggestionsAdapter mAdapter;
private UiConfig mUiConfig;
private ViewResizer mRecyclerViewResizer;
/** /**
* Construct a new {@link ContentCoordinator}. * Construct a new {@link ContentCoordinator}.
...@@ -40,6 +44,7 @@ class ContentCoordinator { ...@@ -40,6 +44,7 @@ class ContentCoordinator {
ContentCoordinator(Context context, ViewGroup parentView) { ContentCoordinator(Context context, ViewGroup parentView) {
mRecyclerView = (SuggestionsRecyclerView) LayoutInflater.from(context).inflate( mRecyclerView = (SuggestionsRecyclerView) LayoutInflater.from(context).inflate(
R.layout.contextual_suggestions_layout, parentView, false); R.layout.contextual_suggestions_layout, parentView, false);
mUiConfig = new UiConfig(mRecyclerView);
} }
/** @return The content {@link View}. */ /** @return The content {@link View}. */
...@@ -76,8 +81,17 @@ class ContentCoordinator { ...@@ -76,8 +81,17 @@ class ContentCoordinator {
ClusterList clusterList = mModel.getClusterList(); ClusterList clusterList = mModel.getClusterList();
mAdapter = new ContextualSuggestionsAdapter( mAdapter = new ContextualSuggestionsAdapter(
profile, new UiConfig(mRecyclerView), uiDelegate, mContextMenuManager, clusterList); profile, mUiConfig, uiDelegate, mContextMenuManager, clusterList);
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
mRecyclerView.init(mUiConfig, mContextMenuManager);
Resources resources = context.getResources();
int defaultMargin =
resources.getDimensionPixelSize(R.dimen.content_suggestions_card_modern_margin);
int wideMargin = resources.getDimensionPixelSize(R.dimen.ntp_wide_card_lateral_margins);
mRecyclerViewResizer =
ViewResizer.createAndAttach(mRecyclerView, mUiConfig, defaultMargin, wideMargin);
// TODO(twellington): Should this be a proper model property, set by the mediator and bound // TODO(twellington): Should this be a proper model property, set by the mediator and bound
// to the RecyclerView? // to the RecyclerView?
...@@ -99,5 +113,10 @@ class ContentCoordinator { ...@@ -99,5 +113,10 @@ class ContentCoordinator {
if (mWindowAndroid != null) { if (mWindowAndroid != null) {
mWindowAndroid.removeContextMenuCloseListener(mContextMenuManager); mWindowAndroid.removeContextMenuCloseListener(mContextMenuManager);
} }
if (mRecyclerViewResizer != null) {
mRecyclerViewResizer.detach();
mRecyclerViewResizer = null;
}
} }
} }
e3e7f51bf6308dd22f6446f8e159adf2ce3c3523 5a29948d2502295ecbaa7440e57eefb2dd564a54
\ No newline at end of file \ No newline at end of file
e6374a3c3a2b52d4793d188214723bf2937d68a1 c1bd6a90fad5996afc35d8846e3fdbaea3942aa1
\ No newline at end of file \ No newline at end of file
0d3ea45c5a952ad5bb77439d97d54d8abfb2b595 2507acefe5b561eaccc2b4b4fdc1b48caee650a4
\ No newline at end of file \ No newline at end of file
12c360c912f3b59093860e686cb729171ced6252 c8da1bd3a44c191a84db94568953e20699928a2b
\ No newline at end of file \ No newline at end of file
a3ebe6112e63f02207c770863ba26d9dc8e6de7d 79510974572cb1abb6fd6c763854fecb4da0e38f
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment