Navigator Debug Screen
The Navigator Debug Screen allows for:
- inspecting the backstack state
- going to an arbitrary screen (without passing in IncomingResult)
- Seeing if all nodes marked with
@AutoDiscover
are registered to theNavigator
- Seeing the current screen an a
toString()
representation of it’s incoming result - Picking a screen hotkey, which allows for going to a screen most often used for debug
AutoDiscover
As discussed in Navigator, all screens must be registered with the Navigator
so that the Navigation Node Traverser
can go to them. Some autogenerated code enumerates a set of all nodes marked with @AutoDiscover
. That set is compared with all the nodes registered in the Navigator, and if there’s anything that forgot to be registered, that result is printed in this debug window.
public class AutoDiscoveredNodesRegistry() {
public fun getAllDiscoveredNodeClasses() = setOf(
ca.stefanm.ibus.gui.audio.NowPlayingMenu::class.java,
ca.stefanm.ibus.gui.bluetoothPairing.BluetoothPairingMenu::class.java,
ca.stefanm.ibus.gui.bluetoothPairing.ui.BtEmptyMenu::class.java,
ca.stefanm.ibus.gui.bluetoothPairing.ui.CurrentDeviceChooser::class.java,
...
)
}
is Autogenerated by KotlinPoet at build-time.
At run-time, the comparison is made:
class HmiNavigatorDebugWindow @Inject constructor(
private val navigator: Provider<Navigator>,
private val navigationNodeTraverser: Provider<NavigationNodeTraverser>,
@Named(NavigationModule.ALL_NODES) private val allNodes : Provider<Set<NavigationNode<*>>>,
private val modalMenuService: ModalMenuService
) : WindowManager.E39Window {
override val tag: Any
get() = this
override val defaultPosition: WindowManager.E39Window.DefaultPosition
get() = WindowManager.E39Window.DefaultPosition.ANYWHERE
override val size = DpSize(600.dp, 1200.dp)
override val title = "HMI Navigator Debug"
override fun content(): @Composable WindowScope.() -> Unit = {
...
}
@Composable
private fun UnregisteredNodes() {
//List all nodes with AutoDiscover, but aren't manually put
//into the allNodes list.
NestingCardHeader("Unregistered Nodes")
val registeredNodes = allNodes.get().map { it.thisClass }.toSet()
val discoveredNodes = AutoDiscoveredNodesRegistry().getAllDiscoveredNodeClasses()
val nonRegisteredNodes = discoveredNodes - registeredNodes
if (nonRegisteredNodes.isEmpty()) {
Text(
"All nodes marked with @AutoDiscover are registered in Navigation DI Module",color = Color.Green)
} else {
Text("Nodes not registered in Navigation DI Module!!", color = Color.Red)
nonRegisteredNodes.forEach {
Text("Node: ${it.canonicalName}")
}
}
}
...
}
Screen Dropdown menu
A dropdown menu is provided so that the developer can jump to any registered screen.
Return to Top