Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Fix crash issue caused by box-shadow. (#2545)
Browse files Browse the repository at this point in the history
* Fix crash issue caused by box-shadow.

* Update box-shadow.
  • Loading branch information
YorkShen authored and Darin726 committed Jun 13, 2019
1 parent 20c034b commit 8aca648
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions android/sdk/src/main/java/com/taobao/weex/utils/BoxShadowUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,16 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.support.annotation.IntRange;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;

import com.taobao.weex.WXEnvironment;
import com.taobao.weex.common.WXThread;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -399,7 +398,16 @@ public void draw(Canvas canvas) {
Rect newRect = new Rect(bounds);
// Make the Canvas Rect bigger according to the padding.
newRect.inset(-paddingX * 2, -paddingY * 2);
canvas.clipRect(newRect, Region.Op.REPLACE);
try {
if(WXEnvironment.sApplication.getApplicationInfo().targetSdkVersion > VERSION_CODES.O){
canvas.clipRect(newRect);
}
else{
canvas.clipRect(newRect, Region.Op.REPLACE);
}
}catch (NullPointerException e) {
canvas.clipRect(newRect);
}

Path contentPath = new Path();
// the content area map must be aligned with bounds
Expand Down

0 comments on commit 8aca648

Please sign in to comment.