优化对话框可能闪退的BUG
This commit is contained in:
parent
a489a6d00d
commit
f91a3f3fc1
@ -4,13 +4,16 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.yunbao.common.utils.ClickUtil;
|
||||
|
||||
@ -34,7 +37,7 @@ public abstract class AbsDialogFragment extends DialogFragment {
|
||||
} else {
|
||||
mRootView = LayoutInflater.from(mContext).inflate(getLayoutId(), null);
|
||||
}
|
||||
final Dialog dialog = new Dialog(mContext, getDialogStyle());
|
||||
Dialog dialog = new Dialog(mContext, getDialogStyle());
|
||||
dialog.setContentView(mRootView);
|
||||
dialog.setCancelable(canCancel());
|
||||
dialog.setCanceledOnTouchOutside(canCancel());
|
||||
@ -74,4 +77,12 @@ public abstract class AbsDialogFragment extends DialogFragment {
|
||||
return ClickUtil.canClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
|
||||
try {
|
||||
super.show(manager, tag);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user