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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/TintedDrawable.java

Issue 2951133003: Clean up tinted ImageView subclasses (Closed)
Patch Set: Comments Created 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.chrome.browser.widget; 5 package org.chromium.chrome.browser.widget;
6 6
7 import android.content.res.ColorStateList; 7 import android.content.res.ColorStateList;
8 import android.content.res.Resources; 8 import android.content.res.Resources;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.BitmapFactory; 10 import android.graphics.BitmapFactory;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 /** 62 /**
63 * Factory method for creating a {@link TintedDrawable} with a resource id a nd specific tint. 63 * Factory method for creating a {@link TintedDrawable} with a resource id a nd specific tint.
64 */ 64 */
65 public static TintedDrawable constructTintedDrawable( 65 public static TintedDrawable constructTintedDrawable(
66 Resources res, int drawableId, int tintColorId) { 66 Resources res, int drawableId, int tintColorId) {
67 TintedDrawable drawable = constructTintedDrawable(res, drawableId); 67 TintedDrawable drawable = constructTintedDrawable(res, drawableId);
68 drawable.setTint(ApiCompatibilityUtils.getColorStateList(res, tintColorI d)); 68 drawable.setTint(ApiCompatibilityUtils.getColorStateList(res, tintColorI d));
69 return drawable; 69 return drawable;
70 } 70 }
71 71
72 /**
73 * Factory method for creating a {@link TintedDrawable} with a {@link Bitmap } icon.
74 */
75 public static TintedDrawable constructTintedDrawable(Resources res, Bitmap i con) {
76 return new TintedDrawable(res, icon);
77 }
78
79 private boolean updateTintColor() { 72 private boolean updateTintColor() {
80 if (mTint == null) return false; 73 if (mTint == null) return false;
81 setColorFilter(mTint.getColorForState(getState(), 0), PorterDuff.Mode.SR C_IN); 74 setColorFilter(mTint.getColorForState(getState(), 0), PorterDuff.Mode.SR C_IN);
82 return true; 75 return true;
83 } 76 }
84 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698