Commit 63c287aa authored by twellington's avatar twellington Committed by Commit bot

[Home] Fix top-offset for native pages

BUG=706683

Review-Url: https://codereview.chromium.org/2855033002
Cr-Commit-Position: refs/heads/master@{#469396}
parent c84e3575
......@@ -11,6 +11,7 @@
android:paddingTop="@dimen/tab_strip_height" >
<org.chromium.chrome.browser.ntp.NativePageRootFrameLayout
android:id="@+id/recent_tabs_root"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingTop="@dimen/toolbar_height_no_shadow"
......
......@@ -36,6 +36,11 @@ public abstract class BasicNativePage implements NativePage {
Resources res = mActivity.getResources();
if (activity instanceof ChromeActivity
&& ((ChromeActivity) activity).getBottomSheet() != null) {
return;
}
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
layoutParams.setMargins(0,
......
......@@ -63,7 +63,7 @@ public class NativePageFactory {
return new HistoryPage(activity, new TabShim(tab));
}
protected NativePage buildRecentTabsPage(Activity activity, Tab tab) {
protected NativePage buildRecentTabsPage(ChromeActivity activity, Tab tab) {
RecentTabsManager recentTabsManager =
new RecentTabsManager(tab, tab.getProfile(), activity);
return new RecentTabsPage(activity, recentTabsManager);
......
......@@ -20,6 +20,7 @@ import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.NativePage;
import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareThumbnailProvider;
......@@ -78,7 +79,7 @@ public class RecentTabsPage
* @param activity The activity this view belongs to.
* @param recentTabsManager The RecentTabsManager which provides the model data.
*/
public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) {
public RecentTabsPage(ChromeActivity activity, RecentTabsManager recentTabsManager) {
mActivity = activity;
mRecentTabsManager = recentTabsManager;
......@@ -101,6 +102,14 @@ public class RecentTabsPage
ApplicationStatus.registerStateListenerForActivity(this, activity);
// {@link #mInForeground} will be updated once the view is attached to the window.
if (activity.getBottomSheet() != null) {
View recentTabsRoot = mView.findViewById(R.id.recent_tabs_root);
ApiCompatibilityUtils.setPaddingRelative(recentTabsRoot,
ApiCompatibilityUtils.getPaddingStart(recentTabsRoot), 0,
ApiCompatibilityUtils.getPaddingEnd(recentTabsRoot),
recentTabsRoot.getPaddingBottom());
}
onUpdated();
}
......
......@@ -7,6 +7,12 @@ package org.chromium.chrome.browser.ntp;
import android.app.Activity;
import android.view.View;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.NativePage;
import org.chromium.chrome.browser.UrlConstants;
......@@ -14,11 +20,6 @@ import org.chromium.chrome.browser.ntp.NativePageFactory.NativePageType;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.testing.local.LocalRobolectricTestRunner;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
/**
* Tests public methods in NativePageFactory.
......@@ -102,7 +103,7 @@ public class NativePageFactoryTest {
}
@Override
public NativePage buildRecentTabsPage(Activity activity, Tab tab) {
public NativePage buildRecentTabsPage(ChromeActivity activity, Tab tab) {
return new MockNativePage(NativePageType.RECENT_TABS);
}
}
......
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