| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpStyleUtils.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpColorUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpStyleUtils.java
|
| similarity index 59%
|
| rename from chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpColorUtils.java
|
| rename to chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpStyleUtils.java
|
| index d2e7269d753f3c8cae73935028a1e57223109d2e..e91a02f7807e22ab575d190852cfd81cd11accc2 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpColorUtils.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpStyleUtils.java
|
| @@ -12,29 +12,33 @@ import org.chromium.chrome.browser.ChromeFeatureList;
|
| import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig;
|
|
|
| /**
|
| - * Utility class for figuring out which colors to use for the NTP. This class is needed while we
|
| - * transition the NTP to the new material design spec.
|
| + * Utility class for figuring out which colors and dimensions to use for the NTP. This class is
|
| + * needed while we transition the NTP to the new material design spec.
|
| */
|
| -public final class NtpColorUtils {
|
| - private NtpColorUtils() {}
|
| +public final class NtpStyleUtils {
|
| + private NtpStyleUtils() {}
|
|
|
| public static int getBackgroundColorResource(Resources res, boolean isIncognito) {
|
| - if (isIncognito) {
|
| - return ApiCompatibilityUtils.getColor(res, R.color.ntp_bg_incognito);
|
| - }
|
| + if (isIncognito) return ApiCompatibilityUtils.getColor(res, R.color.ntp_bg_incognito);
|
|
|
| - return shouldUseMaterialColors()
|
| + return shouldUseMaterialDesign()
|
| ? ApiCompatibilityUtils.getColor(res, R.color.ntp_material_design_bg)
|
| : ApiCompatibilityUtils.getColor(res, R.color.ntp_bg);
|
| }
|
|
|
| public static int getToolbarBackgroundColorResource(Resources res) {
|
| - return shouldUseMaterialColors()
|
| + return shouldUseMaterialDesign()
|
| ? ApiCompatibilityUtils.getColor(res, R.color.ntp_material_design_bg)
|
| : ApiCompatibilityUtils.getColor(res, R.color.ntp_bg);
|
| }
|
|
|
| - public static boolean shouldUseMaterialColors() {
|
| + public static int getSearchBoxHeight(Resources res) {
|
| + return shouldUseMaterialDesign()
|
| + ? res.getDimensionPixelSize(R.dimen.ntp_search_box_material_height)
|
| + : res.getDimensionPixelSize(R.dimen.ntp_search_box_height);
|
| + }
|
| +
|
| + public static boolean shouldUseMaterialDesign() {
|
| return SnippetsConfig.isEnabled()
|
| || ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_MATERIAL_DESIGN);
|
| }
|
|
|