@@ -25,6 +25,8 @@ public class SwipeBackLayout extends FrameLayout {
25
25
26
26
private static final int DEFAULT_SCRIM_COLOR = 0x99000000 ;
27
27
28
+ private static final int FULL_ALPHA = 255 ;
29
+
28
30
/**
29
31
* Edge flag indicating that the left edge should be affected.
30
32
*/
@@ -397,11 +399,11 @@ public void requestLayout() {
397
399
@ Override
398
400
protected boolean drawChild (Canvas canvas , View child , long drawingTime ) {
399
401
final boolean drawContent = child == mContentView ;
400
- drawShadow (canvas , child );
401
402
402
403
boolean ret = super .drawChild (canvas , child , drawingTime );
403
404
if (mScrimOpacity > 0 && drawContent
404
405
&& mDragHelper .getViewDragState () != ViewDragHelper .STATE_IDLE ) {
406
+ drawShadow (canvas , child );
405
407
drawScrim (canvas , child );
406
408
}
407
409
return ret ;
@@ -429,18 +431,21 @@ private void drawShadow(Canvas canvas, View child) {
429
431
if ((mEdgeFlag & EDGE_LEFT ) != 0 ) {
430
432
mShadowLeft .setBounds (childRect .left - mShadowLeft .getIntrinsicWidth (), childRect .top ,
431
433
childRect .left , childRect .bottom );
434
+ mShadowLeft .setAlpha ((int ) (mScrimOpacity * FULL_ALPHA ));
432
435
mShadowLeft .draw (canvas );
433
436
}
434
437
435
438
if ((mEdgeFlag & EDGE_RIGHT ) != 0 ) {
436
439
mShadowRight .setBounds (childRect .right , childRect .top ,
437
440
childRect .right + mShadowRight .getIntrinsicWidth (), childRect .bottom );
441
+ mShadowRight .setAlpha ((int ) (mScrimOpacity * FULL_ALPHA ));
438
442
mShadowRight .draw (canvas );
439
443
}
440
444
441
445
if ((mEdgeFlag & EDGE_BOTTOM ) != 0 ) {
442
446
mShadowBottom .setBounds (childRect .left , childRect .bottom , childRect .right ,
443
447
childRect .bottom + mShadowBottom .getIntrinsicHeight ());
448
+ mShadowBottom .setAlpha ((int ) (mScrimOpacity * FULL_ALPHA ));
444
449
mShadowBottom .draw (canvas );
445
450
}
446
451
}
0 commit comments