Skip to content

Commit

Permalink
fix(crash): 解决BaseTransFragment没有实现空参构造函数导致的崩溃问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hss01248 committed May 24, 2022
1 parent f49ec22 commit 59ae80a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public class GoOutOfAppForResultFragment extends BaseTransFragment<Intent> {
boolean startWaitingResult;
boolean consumed;

public GoOutOfAppForResultFragment() {
super();
}

public GoOutOfAppForResultFragment(FragmentActivity activity, Intent intent) {
super(activity, intent);
}
Expand All @@ -45,6 +49,22 @@ public void onStop() {
startWaitingResult = true;
}

//todo 一些半屏activity,只触发fragment的onPause, 不触发onStop
/* @Override
public void onPause() {
super.onPause();
startWaitingResult = true;
}
@Override
public void onResume() {
super.onResume();
if(startWaitingResult && !consumed){
onStartOfResultBack(requestCode,66,null);
startWaitingResult = false;
}
}*/


/**
* 如果真有,那么比onStart()先执行
Expand Down Expand Up @@ -79,6 +99,8 @@ public void onStart() {
}
}



protected void onStartOfResultBack(int requestCode, int resultCode, @Nullable Intent data) {
listener.onActivityResult(requestCode,resultCode,data);
if (StartActivityUtil.debugable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ public void setCallback(IEventCallback callback) {

protected IEventCallback callback;


public BaseTransFragment(){
super();
}

public BaseTransFragment(FragmentActivity activity, Bean bean) {
this();
this.activity = activity;
this.bean = bean;
startFragmentTransaction();
Expand Down

0 comments on commit 59ae80a

Please sign in to comment.