| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 20a45a8 commit ec07a99
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ | |||
| 8 | 8 | import android.graphics.Color; | |
| 9 | 9 | import android.graphics.LinearGradient; | |
| 10 | 10 | import android.graphics.Matrix; | |
| 11 | + import android.graphics.Outline; | ||
| 11 | 12 | import android.graphics.Paint; | |
| 12 | 13 | import android.graphics.Path; | |
| 13 | 14 | import android.graphics.PointF; | |
@@ -16,6 +17,7 @@ | |||
| 16 | 17 | import android.graphics.drawable.ColorDrawable; | |
| 17 | 18 | import android.graphics.drawable.Drawable; | |
| 18 | 19 | import android.graphics.Shader; | |
| 20 | + import android.support.annotation.NonNull; | ||
| 19 | 21 | ||
| 20 | 22 | import org.nativescript.widgets.image.BitmapOwner; | |
| 21 | 23 | import org.nativescript.widgets.image.Fetcher; | |
@@ -804,6 +806,23 @@ public Drawable getDrawable() { | |||
| 804 | 806 | return drawable; | |
| 805 | 807 | } | |
| 806 | 808 | ||
| 809 | + @Override | ||
| 810 | + public void getOutline(@NonNull Outline outline) { | ||
| 811 | + if (android.os.Build.VERSION.SDK_INT >= 21) { | ||
| 812 | + Path backgroundPath = new Path(); | ||
| 813 | + float[] backgroundRadii = { | ||
| 814 | + Math.max(0, borderTopLeftRadius), Math.max(0, borderTopLeftRadius), | ||
| 815 | + Math.max(0, borderTopRightRadius), Math.max(0, borderTopRightRadius), | ||
| 816 | + Math.max(0, borderBottomRightRadius), Math.max(0, borderBottomRightRadius), | ||
| 817 | + Math.max(0, borderBottomLeftRadius), Math.max(0, borderBottomLeftRadius) | ||
| 818 | + }; | ||
| 819 | + backgroundPath.addRoundRect(new RectF(getBounds()), backgroundRadii, Path.Direction.CW); | ||
| 820 | + outline.setConvexPath(backgroundPath); | ||
| 821 | + } else { | ||
| 822 | + throw new IllegalStateException("Method supported on API 21 or higher"); | ||
| 823 | + } | ||
| 824 | + } | ||
| 825 | + | ||
| 807 | 826 | private class BackgroundDrawParams { | |
| 808 | 827 | private boolean repeatX = true; | |
| 809 | 828 | private boolean repeatY = true; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments