Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Attachment actions
Unintended behavior
View staffing
Description
Version used: 2.0.0
Devices/Android versions reproduced on: Android 8.1 on Zebra TC51 and TC52
==== MainActivity ====
override fun onCreate(savedInstanceState: Bundle?) {
val host = supportFragmentManager.findFragmentById(R.id.navigation_host_fragment)
val fragmentManager = host?.childFragmentManager
fragmentManager?.addOnBackStackChangedListener {
handleCurrentFragment()
}
handleCurrentFragment()
}
private fun handleCurrentFragment() {
val host = supportFragmentManager.findFragmentById(R.id.navigation_host_fragment)
val fragment = host?.childFragmentManager?.primaryNavigationFragment // This is null in the second case mentioned below
val enableRead = fragment is BarcodeListener && fragment.isScanningEnabled()
scanner.setScanningEnabled(enabled = enableRead)
scannerIndicatorCard.visibility = if (fragment is BarcodeListener) View.VISIBLE else View.GONE
}
=== Actions that work ====
- Start on <Fragment A>.
- Navigate from <Fragment A> to <Fragment B> using directions.
handleCurrentFragment() is called, primaryNavigationFragment is <Fragment B>
- Navigate from <Fragment B> to <Fragment C> using directions.
handleCurrentFragment() is called, primaryNavigationFragment is <Fragment C>
- Call navigateUp() from <Fragment C>
handleCurrentFragment() is called, primaryNavigationFragment is <Fragment B>
=== Actions that cause the issue ===
- Start on <Fragment A>.
- Navigate from <Fragment A> to <Fragment B> using directions.
handleCurrentFragment() is called, primaryNavigationFragment is <Fragment B>
- Navigate from <Fragment B> to <Fragment C> using directions.
handleCurrentFragment() is called, primaryNavigationFragment is <Fragment C>
- Navigate from <Fragment C> to <Fragment C> using directions (single top chosen in graph xml)
handleCurrentFragment() is called, primaryNavigationFragment is <Fragment C>
- Call navigateUp() from <Fragment C>
handleCurrentFragment() is called, primaryNavigationFragment is null
Attached are screenshots of a graph that would reproduce the issue and the graph discovered on.