summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoraurimas <aurimas@chromium.org>2015-09-02 18:02:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-03 01:04:07 +0000
commit6b715aeb152c6c922c4355a8779691470cf160db (patch)
tree61b6f04a9f192f048d7c35871808e4baaa326439 /base
parent233fa64d514bd37db474246a851a5f4ccd0fc295 (diff)
downloadchromium_src-6b715aeb152c6c922c4355a8779691470cf160db.zip
chromium_src-6b715aeb152c6c922c4355a8779691470cf160db.tar.gz
chromium_src-6b715aeb152c6c922c4355a8779691470cf160db.tar.bz2
Update getColorStateList calls that were deprecated in M.
BUG=503148 Review URL: https://codereview.chromium.org/1328743003 Cr-Commit-Position: refs/heads/master@{#347087}
Diffstat (limited to 'base')
-rw-r--r--base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index 3ddf18a..a119acb 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -12,6 +12,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
@@ -441,4 +442,16 @@ public class ApiCompatibilityUtils {
return res.getColor(id);
}
}
+
+ /**
+ * @see android.content.res.Resources#getColorStateList(int id).
+ */
+ @SuppressWarnings("deprecation")
+ public static ColorStateList getColorStateList(Resources res, int id) throws NotFoundException {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ return res.getColorStateList(id, null);
+ } else {
+ return res.getColorStateList(id);
+ }
+ }
}