mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 22:52:44 +01:00
Fix clearing no existing dialog fragment (#1242)
This commit is contained in:
parent
d0869b235a
commit
e6247d4428
@ -324,9 +324,7 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun showAccountPicker(studentWithSemesters: List<StudentWithSemesters>) {
|
override fun showAccountPicker(studentWithSemesters: List<StudentWithSemesters>) {
|
||||||
if (supportFragmentManager.isStateSaved) return
|
showDialogFragment(AccountQuickDialog.newInstance(studentWithSemesters))
|
||||||
|
|
||||||
navController.showDialogFragment(AccountQuickDialog.newInstance(studentWithSemesters))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showActionBarElevation(show: Boolean) {
|
override fun showActionBarElevation(show: Boolean) {
|
||||||
@ -342,9 +340,18 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
|||||||
(navController.currentStack?.getOrNull(0) as? MainView.MainChildView)?.onFragmentChanged()
|
(navController.currentStack?.getOrNull(0) as? MainView.MainChildView)?.onFragmentChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
fun showDialogFragment(dialog: DialogFragment) {
|
fun showDialogFragment(dialog: DialogFragment) {
|
||||||
if (supportFragmentManager.isStateSaved) return
|
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)
|
navController.showDialogFragment(dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user