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

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

Issue 2375023003: Ntp: experiment to initially scroll below the fold. (Closed)
Patch Set: Delete custom command line switch. Created 4 years, 3 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698