Fixes #6408: Pop stack to homeFragment when opening bookmarks from homeFragment

When bookmark fragment is opened from homeFragment, libraryFragment does not
exists so the popBackStack(R.id.libraryFragment, true) would have failed. So
the solution for this was to pop back stack to homeFragment when the
bookmarks/history fragments are opened from homeFragment.
This commit is contained in:
ValentinTimisica 2019-11-07 12:42:23 +02:00 committed by Emily Kager
parent 40047315c2
commit e1f3611fdd

View File

@ -16,7 +16,9 @@ abstract class LibraryPageFragment<T> : Fragment() {
abstract val selectedItems: Set<T>
protected fun close() {
findNavController().popBackStack(R.id.libraryFragment, true)
if (!findNavController().popBackStack(R.id.libraryFragment, true)) {
findNavController().popBackStack(R.id.homeFragment, false)
}
}
protected fun openItemsInNewTab(private: Boolean = false, toUrl: (T) -> String?) {