Commit c49bdc57 authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Fix progress dialog after onSaveInstanceState.

parent 913cbf0f
......@@ -13,11 +13,23 @@ private const val PROGRESS_TAG = "bf_progress"
abstract class BaseFragment : MvpAppCompatFragment() {
abstract val layoutRes: Int
private var instanceStateSaved: Boolean = false
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) =
inflater.inflate(layoutRes, container, false)
override fun onResume() {
super.onResume()
instanceStateSaved = false
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
instanceStateSaved = true
}
protected fun showProgressDialog(progress: Boolean) {
if (!isAdded) return
if (!isAdded || instanceStateSaved) return
val fragment = childFragmentManager.findFragmentByTag(PROGRESS_TAG)
if (fragment != null && !progress) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment