Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpColorUtils.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/NtpColorUtils.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ecf375f17aa16af03f18b784ed6508c3f735bf26 |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NtpColorUtils.java |
@@ -0,0 +1,24 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.ntp; |
+ |
+import android.content.res.Resources; |
+ |
+import org.chromium.base.ApiCompatibilityUtils; |
+import org.chromium.chrome.R; |
+import org.chromium.chrome.browser.ChromeFeatureList; |
+ |
+/** |
+ * 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. |
+ */ |
+public class NtpColorUtils { |
Bernhard Bauer
2016/05/06 15:58:41
Add a private constructor to prevent instantiation
May
2016/05/06 16:04:21
Done.
|
+ public static int getBackgroundColorResource(Resources res) { |
+ return (ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SNIPPETS) |
+ || ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_MATERIAL_DESIGN)) |
+ ? ApiCompatibilityUtils.getColor(res, R.color.ntp_material_design_bg) |
+ : ApiCompatibilityUtils.getColor(res, R.color.ntp_bg); |
+ } |
+} |