Prevent SweetAlert to be closed on clicking outside the popup window

前端 未结 13 1152
不知归路
不知归路 2021-02-01 04:40

I am using Sweet Alert for a popup on my product view in an E-commerce Application with two buttons: one for going on cart View and another for reloading the vi

13条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-01 05:08

    I had the same problem and here's how I solved it: setCanceledOnTouchOutside(false)

    var dialog = SweetAlertDialog(context, SweetAlertDialog.ERROR_TYPE);
    dialog.setTitleText(getString(R.string.session_expired));
    dialog.setConfirmClickListener { sDialog ->
        sDialog.dismissWithAnimation()
        Utils.signOut(context!!)
        Handler().postDelayed({
        startActivity(getLoginIntent(context!!))
        AcTrans.Builder(context!!).performFade()
        }, 500)};
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    

提交回复
热议问题