Zhuinden / simple-stack

[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).
Apache License 2.0
1.36k stars 75 forks source link

Up navigation examples are hard to find #283

Open LeafyLappa opened 10 months ago

LeafyLappa commented 10 months ago

It seems that all examples for "up" back arrow navigation are in the "legacy-architecture-samples". A bit hard to find especially as they are "legacy" and written in java.

By up navigation I mean this:

https://github.com/Zhuinden/simple-stack/blob/842bfc781fa16568af956c4985c1f8ca02da0a6c/samples/legacy-architecture-samples/simple-stack-example-mvvm-fragments/src/main/java/com/zhuinden/simplestackexamplemvvm/application/BaseKey.java#L65

Zhuinden commented 10 months ago

Heyo, it's primarily because the icon being "back" is typically encoded in either the screen itself, or can be evaluated with shouldBeUpArrow = stateChange.getNewKeys().size > 1 in the SimpleStateChanger.

But I haven't worked on app with a design that actually shares the toolbar across the entire app in a very long time, which is why you only saw that in the legacy example.

The title scared me for half a sec because goUp() and goUpChain() really aren't really used anywhere in any samples, even if the support is there.

LeafyLappa commented 10 months ago

Ahh, I see. I'm so used to Jetpack Navigation where up arrow seems to be handled via magic (once you call something like setupActionBarWithNavController) I did not realize I should simply put a toolbar in my fragments or main activity and define the navigation behavior myself, wew

shouldBeUpArrow = stateChange.getNewKeys().size > 1

It would be nice however to have something like a TLDR or recipes page for things like this.

Zhuinden commented 9 months ago

Technically it does exist in this sample: https://github.com/Zhuinden/simple-stack/blob/528fb852a7db94f54984bd6946ef7a0296679d09/tutorials/tutorial-sample/src/main/java/com/zhuinden/simplestacktutorials/steps/step_3/Step3Activity.kt#L52 but I'll try to think of a way

Zhuinden commented 3 weeks ago

Relevant https://github.com/Zhuinden/simple-stack/issues/287