Prevent DialogFragment.show crash

This commit is contained in:
Mygod
2020-01-23 09:29:51 +08:00
parent 09238462d1
commit 2298f7858f
4 changed files with 13 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ import android.os.Parcelable
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.fragment.app.Fragment
import be.mygod.vpnhotspot.util.showAllowingStateLoss
import kotlinx.android.parcel.Parcelize
/**
@@ -42,7 +43,7 @@ abstract class AlertDialogFragment<Arg : Parcelable, Ret : Parcelable> :
fun show(target: Fragment, requestCode: Int = 0, tag: String = javaClass.simpleName) {
setTargetFragment(target, requestCode)
show(target.parentFragmentManager, tag)
showAllowingStateLoss(target.parentFragmentManager, tag)
}
}