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

Commit

Permalink
* [android] Add try catch for FlatGUI
Browse files Browse the repository at this point in the history
  • Loading branch information
YorkShen committed Sep 13, 2017
1 parent 94b4d41 commit 942d032
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.taobao.weex.ui.flat.widget.Widget;
import com.taobao.weex.ui.view.gesture.WXGesture;
import com.taobao.weex.ui.view.gesture.WXGestureObservable;
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXViewUtils;
import java.lang.ref.WeakReference;
import java.util.List;
Expand Down Expand Up @@ -95,16 +96,20 @@ protected boolean verifyDrawable(@NonNull Drawable who) {

@Override
protected void dispatchDraw(Canvas canvas) {
if (mWidgets != null) {
canvas.save();
canvas.translate(getPaddingLeft(), getPaddingTop());
for (Widget widget : mWidgets) {
widget.draw(canvas);
try {
if (mWidgets != null) {
canvas.save();
canvas.translate(getPaddingLeft(), getPaddingTop());
for (Widget widget : mWidgets) {
widget.draw(canvas);
}
canvas.restore();
} else {
WXViewUtils.clipCanvasWithinBorderBox(this, canvas);
super.dispatchDraw(canvas);
}
canvas.restore();
} else {
WXViewUtils.clipCanvasWithinBorderBox(this, canvas);
super.dispatchDraw(canvas);
}catch (Throwable e){
WXLogUtils.e("FlatGUI Crashed when dispatchDraw", WXLogUtils.getStackTrace(e));
}
}
}

0 comments on commit 942d032

Please sign in to comment.