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

Side by Side Diff: android/java/src/org/chromium/base/ApiCompatibilityUtils.java

Issue 2050803003: Update to Chromium //base at Chromium commit e3a753f17bac62738b0dbf0b36510f767b081e4b. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.app.ActivityManager; 9 import android.app.ActivityManager;
10 import android.app.PendingIntent; 10 import android.app.PendingIntent;
11 import android.content.ContentResolver; 11 import android.content.ContentResolver;
12 import android.content.Context; 12 import android.content.Context;
13 import android.content.Intent; 13 import android.content.Intent;
14 import android.content.pm.PackageManager; 14 import android.content.pm.PackageManager;
15 import android.content.res.ColorStateList;
15 import android.content.res.Configuration; 16 import android.content.res.Configuration;
16 import android.content.res.Resources; 17 import android.content.res.Resources;
17 import android.content.res.Resources.NotFoundException; 18 import android.content.res.Resources.NotFoundException;
18 import android.graphics.Bitmap; 19 import android.graphics.Bitmap;
19 import android.graphics.Color; 20 import android.graphics.Color;
20 import android.graphics.drawable.Drawable; 21 import android.graphics.drawable.Drawable;
21 import android.os.Build; 22 import android.os.Build;
22 import android.os.PowerManager; 23 import android.os.PowerManager;
23 import android.os.Process; 24 import android.os.Process;
24 import android.provider.Settings; 25 import android.provider.Settings;
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 * @see android.content.pm.PackageManager#getUserBadgedIcon(Drawable, androi d.os.UserHandle). 423 * @see android.content.pm.PackageManager#getUserBadgedIcon(Drawable, androi d.os.UserHandle).
423 */ 424 */
424 public static Drawable getUserBadgedIcon(Context context, int id) { 425 public static Drawable getUserBadgedIcon(Context context, int id) {
425 Drawable drawable = getDrawable(context.getResources(), id); 426 Drawable drawable = getDrawable(context.getResources(), id);
426 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 427 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
427 PackageManager packageManager = context.getPackageManager(); 428 PackageManager packageManager = context.getPackageManager();
428 drawable = packageManager.getUserBadgedIcon(drawable, Process.myUser Handle()); 429 drawable = packageManager.getUserBadgedIcon(drawable, Process.myUser Handle());
429 } 430 }
430 return drawable; 431 return drawable;
431 } 432 }
433
434 /**
435 * @see android.content.res.Resources#getColor(int id).
436 */
437 @SuppressWarnings("deprecation")
438 public static int getColor(Resources res, int id) throws NotFoundException {
439 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
440 return res.getColor(id, null);
441 } else {
442 return res.getColor(id);
443 }
444 }
445
446 /**
447 * @see android.content.res.Resources#getColorStateList(int id).
448 */
449 @SuppressWarnings("deprecation")
450 public static ColorStateList getColorStateList(Resources res, int id) throws NotFoundException {
451 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
452 return res.getColorStateList(id, null);
453 } else {
454 return res.getColorStateList(id);
455 }
456 }
432 } 457 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698