am 505c9d2c: am e910cc88: Merge "Implement alpha as documented for drawables" into lmp-dev

* commit '505c9d2ce0a8ed8dc27baf406f05f2ae4c265fe5':
  Implement alpha as documented for drawables
This commit is contained in:
Chris Craik
2014-10-01 00:58:48 +00:00
committed by Android Git Automerger
2 changed files with 8 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
package android.graphics.drawable;
import android.annotation.NonNull;
import android.graphics.*;
import android.graphics.PorterDuff.Mode;
import android.content.res.ColorStateList;
@@ -210,6 +211,12 @@ public class ColorDrawable extends Drawable {
return PixelFormat.TRANSLUCENT;
}
@Override
public void getOutline(@NonNull Outline outline) {
outline.setRect(getBounds());
outline.setAlpha(getAlpha() / 255.0f);
}
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
throws XmlPullParserException, IOException {

View File

@@ -895,7 +895,7 @@ public abstract class Drawable {
*/
public void getOutline(@NonNull Outline outline) {
outline.setRect(getBounds());
outline.setAlpha(getAlpha() / 255.0f);
outline.setAlpha(0);
}
/**