Slide 70
Slide 70 text
Navigate
case 1:
within the same menu
if (currentMenuId == nextMenuId) {
stack.push(screenId, currentMenuId)
fragmentManager.replace(currentMenuId, nextScreen.clazz, arguments)
} else {
stack.moveToTop(nextMenuId)
stack.push(screenId, nextMenuId)
fragmentManager.saveBackStack(currentMenuId.toString())
fragmentManager.restoreBackStack(nextMenuId.toString())
fragmentManager.replace(nextMenuId, nextScreen.clazz, arguments)
}
fragmentManager.commit {
setReorderingAllowed(true)
replace(requireNotNull(containerId),
clazz.newInstance().apply { arguments = args })
addToBackStack(menuId.toString())
}