File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
java/com/sonsation/library Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ class ShadowLayout : FrameLayout {
122122 )
123123 } ? : BlurMaskFilter .Blur .NORMAL
124124 this .blur = a.getDimension(R .styleable.ShadowLayout_stroke_blur , 0f )
125+ this .drawAsOverlay = a.getBoolean(R .styleable.ShadowLayout_stroke_draw_as_overlay , false )
125126 }
126127
127128 val allRadius = a.getDimension(R .styleable.ShadowLayout_background_radius , 0f )
@@ -274,7 +275,20 @@ class ShadowLayout : FrameLayout {
274275 canvas.drawPath(backgroundPath, backgroundPaint)
275276
276277 if (stroke?.isEnable == true ) {
277- canvas.drawPath(outlinePath, outlinePaint)
278+
279+ if (stroke?.drawAsOverlay == true ) {
280+
281+ if (clipOutLine) {
282+ canvas.clipPath(outlinePath)
283+ }
284+
285+ super .dispatchDraw(canvas)
286+
287+ canvas.drawPath(outlinePath, outlinePaint)
288+ return
289+ } else {
290+ canvas.drawPath(outlinePath, outlinePaint)
291+ }
278292 }
279293
280294 if (clipOutLine) {
@@ -603,6 +617,11 @@ class ShadowLayout : FrameLayout {
603617 invalidate()
604618 }
605619
620+ fun updateStrokeDrawAsOverlay (drawAsOverlay : Boolean ) {
621+ this .stroke?.drawAsOverlay = drawAsOverlay
622+ invalidate()
623+ }
624+
606625 fun updateStrokeType (strokeType : StrokeType ) {
607626 this .stroke?.strokeType = strokeType
608627 if (autoAdjustPadding) {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class Stroke(var strokeWidth: Float = 0f,
1010 var strokeType : StrokeType = StrokeType .INSIDE
1111 ) {
1212
13+ var drawAsOverlay = false
1314 var blur: Float = 0f
1415 var blurType = BlurMaskFilter .Blur .NORMAL
1516 val isEnable: Boolean
Original file line number Diff line number Diff line change 4444 <enum name =" CENTER" value =" 1" />
4545 <enum name =" OUTSIDE" value =" 2" />
4646 </attr >
47+ <attr name =" stroke_draw_as_overlay" format =" boolean" />
4748
4849 <attr name =" shadow_color" format =" color" />
4950 <attr name =" shadow_offset_x" format =" dimension" />
You can’t perform that action at this time.
0 commit comments