|
10 | 10 | import android.util.AttributeSet; |
11 | 11 |
|
12 | 12 | import androidx.annotation.ColorInt; |
13 | | -import androidx.annotation.DrawableRes; |
14 | 13 | import androidx.annotation.NonNull; |
15 | 14 | import androidx.annotation.Nullable; |
16 | 15 | import androidx.appcompat.widget.AppCompatButton; |
@@ -83,16 +82,23 @@ private void updateDrawables() { |
83 | 82 | if (mTintColor != Color.TRANSPARENT) { |
84 | 83 | wrappedDrawable = getTintedDrawable(wrappedDrawable); |
85 | 84 | } |
86 | | - if (mDrawableSize != -1) { |
| 85 | + if (mDrawableSize > 0) { |
87 | 86 | wrappedDrawable = updateDrawableBounds(wrappedDrawable); |
88 | 87 | } |
89 | 88 | wrappedDrawables[i] = wrappedDrawable; |
90 | 89 | } |
91 | 90 | } |
92 | | - setCompoundDrawables(wrappedDrawables[DRAWABLE_LEFT_POSITION], |
93 | | - wrappedDrawables[DRAWABLE_TOP_POSITION], |
94 | | - wrappedDrawables[DRAWABLE_RIGHT_POSITION], |
95 | | - wrappedDrawables[DRAWABLE_BOTTOM_POSITION]); |
| 91 | + if (mDrawableSize > 0) { |
| 92 | + setCompoundDrawables(wrappedDrawables[DRAWABLE_LEFT_POSITION], |
| 93 | + wrappedDrawables[DRAWABLE_TOP_POSITION], |
| 94 | + wrappedDrawables[DRAWABLE_RIGHT_POSITION], |
| 95 | + wrappedDrawables[DRAWABLE_BOTTOM_POSITION]); |
| 96 | + } else { |
| 97 | + setCompoundDrawablesWithIntrinsicBounds(wrappedDrawables[DRAWABLE_LEFT_POSITION], |
| 98 | + wrappedDrawables[DRAWABLE_TOP_POSITION], |
| 99 | + wrappedDrawables[DRAWABLE_RIGHT_POSITION], |
| 100 | + wrappedDrawables[DRAWABLE_BOTTOM_POSITION]); |
| 101 | + } |
96 | 102 | } |
97 | 103 | } |
98 | 104 |
|
|
0 commit comments