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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java

Issue 2408643002: Remove unused pre-material NTP styling. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
index 39e93a90ffabde11edb7987489b2e4f363270a11..3021078bf02264510b98dc608f0473746401dbc2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
@@ -37,9 +37,9 @@ public class NewTabPageLayout extends LinearLayout {
private final int mPeekingCardHeight;
private final int mTabStripHeight;
private final int mFieldTrialLayoutAdjustment;
+ private final int mSearchboxShadowWidth;
private int mParentViewportHeight;
- private int mSearchboxViewShadowWidth;
private boolean mCardsUiEnabled;
private View mTopSpacer; // Spacer above search logo.
@@ -74,6 +74,7 @@ public class NewTabPageLayout extends LinearLayout {
mTabStripHeight = res.getDimensionPixelSize(R.dimen.tab_strip_height);
mFieldTrialLayoutAdjustment = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
CardsVariationParameters.getFirstCardOffsetDp(), res.getDisplayMetrics());
+ mSearchboxShadowWidth = res.getDimensionPixelOffset(R.dimen.ntp_search_box_shadow_width);
}
@Override
@@ -88,7 +89,6 @@ public class NewTabPageLayout extends LinearLayout {
mSearchProviderLogoView = (LogoView) findViewById(R.id.search_provider_logo);
mSearchBoxView = findViewById(R.id.search_box);
mMostVisitedLayout = (MostVisitedLayout) findViewById(R.id.most_visited_layout);
- setSearchBoxStyle();
}
/**
@@ -223,7 +223,7 @@ public class NewTabPageLayout extends LinearLayout {
// Make the search box and logo as wide as the most visited items.
if (mMostVisitedLayout.getVisibility() != GONE) {
final int width = mMostVisitedLayout.getMeasuredWidth() - mMostVisitedLayoutBleed;
- measureExactly(mSearchBoxView, width + mSearchboxViewShadowWidth,
+ measureExactly(mSearchBoxView, width + mSearchboxShadowWidth,
mSearchBoxView.getMeasuredHeight());
measureExactly(
mSearchProviderLogoView, width, mSearchProviderLogoView.getMeasuredHeight());
@@ -251,35 +251,6 @@ public class NewTabPageLayout extends LinearLayout {
}
/**
- * Set the search box style, adding a shadow if required.
- */
- private void setSearchBoxStyle() {
- if (!NtpStyleUtils.shouldUseMaterialDesign()) return;
-
- Resources resources = getContext().getResources();
-
- // Adjust the margins to account for the bigger size due to the shadow.
- MarginLayoutParams layoutParams = (MarginLayoutParams) mSearchBoxView.getLayoutParams();
- layoutParams.setMargins(
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_margin_left),
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_margin_top),
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_margin_right),
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_margin_bottom));
- layoutParams.height = resources
- .getDimensionPixelSize(R.dimen.ntp_search_box_material_height);
- // Width will be adjusted in onMeasure();
- mSearchboxViewShadowWidth = resources
- .getDimensionPixelOffset(R.dimen.ntp_search_box_material_extra_width);
-
- mSearchBoxView.setBackgroundResource(R.drawable.textbox);
- mSearchBoxView.setPadding(
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_padding_left),
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_padding_top),
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_padding_right),
- resources.getDimensionPixelSize(R.dimen.ntp_search_box_material_padding_bottom));
- }
-
- /**
* Distribute extra vertical space between the three spacer views. Doing this here allows for
* more sophisticated constraints than in xml.
* @param extraHeight The amount of extra space, in pixels.

Powered by Google App Engine
This is Rietveld 408576698