1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-01-31 19:42:44 +01:00

Fix clearing no existing dialog fragment (#1242)

This commit is contained in:
Rafał Borcz 2021-03-28 08:18:07 +02:00 committed by GitHub
parent d0869b235a
commit e6247d4428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,9 +324,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
}
override fun showAccountPicker(studentWithSemesters: List<StudentWithSemesters>) {
if (supportFragmentManager.isStateSaved) return
navController.showDialogFragment(AccountQuickDialog.newInstance(studentWithSemesters))
showDialogFragment(AccountQuickDialog.newInstance(studentWithSemesters))
}
override fun showActionBarElevation(show: Boolean) {
@ -342,9 +340,18 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
(navController.currentStack?.getOrNull(0) as? MainView.MainChildView)?.onFragmentChanged()
}
@Suppress("DEPRECATION")
fun showDialogFragment(dialog: DialogFragment) {
if (supportFragmentManager.isStateSaved) return
//Deprecated method is used here to avoid fragnav bug
if (navController.currentDialogFrag?.fragmentManager == null) {
FragNavController::class.java.getDeclaredField("mCurrentDialogFrag").apply {
isAccessible = true
set(navController, null)
}
}
navController.showDialogFragment(dialog)
}