Skip to content

Commit e910cc8

Browse files
ChrisCraikAndroid (Google) Code Review
authored andcommitted
Merge "Implement alpha as documented for drawables" into lmp-dev
2 parents df61d00 + 3f873d8 commit e910cc8

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

graphics/java/android/graphics/drawable/ColorDrawable.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package android.graphics.drawable;
1818

19+
import android.annotation.NonNull;
1920
import android.graphics.*;
2021
import android.graphics.PorterDuff.Mode;
2122
import android.content.res.ColorStateList;
@@ -210,6 +211,12 @@ public int getOpacity() {
210211
return PixelFormat.TRANSLUCENT;
211212
}
212213

214+
@Override
215+
public void getOutline(@NonNull Outline outline) {
216+
outline.setRect(getBounds());
217+
outline.setAlpha(getAlpha() / 255.0f);
218+
}
219+
213220
@Override
214221
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
215222
throws XmlPullParserException, IOException {

graphics/java/android/graphics/drawable/Drawable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ public Insets getOpticalInsets() {
895895
*/
896896
public void getOutline(@NonNull Outline outline) {
897897
outline.setRect(getBounds());
898-
outline.setAlpha(getAlpha() / 255.0f);
898+
outline.setAlpha(0);
899899
}
900900

901901
/**

0 commit comments

Comments
 (0)