Skip to content

Commit

Permalink
Fix tint-drawable below api 21
Browse files Browse the repository at this point in the history
  • Loading branch information
woxingxiao committed Jan 10, 2018
1 parent 3fbc832 commit 1c73de6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions vectorcompattextview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 27
versionCode 12
versionName "2.4"
versionCode 13
versionName "2.5"

}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ public void onGlobalLayout() {

private void tintDrawable(Drawable drawable) {
if (drawable != null) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
drawable = DrawableCompat.wrap(drawable).mutate();
}
if (isTintDrawableInTextColor) {
DrawableCompat.setTint(drawable.mutate(), getCurrentTextColor());
DrawableCompat.setTint(drawable, getCurrentTextColor());
} else if (mDrawableCompatColor != 0) {
DrawableCompat.setTint(drawable.mutate(), mDrawableCompatColor);
DrawableCompat.setTint(drawable, mDrawableCompatColor);
}
}
}
Expand Down

0 comments on commit 1c73de6

Please sign in to comment.