aartikov / alligator Goto Github PK
View Code? Open in Web Editor NEWAlligator is Android navigation library that will help to organize your navigation code in clean and testable way.
License: MIT License
Alligator is Android navigation library that will help to organize your navigation code in clean and testable way.
License: MIT License
I tested the advanceSwitcher sample and noticed that when the stacks for a tab are emptied, it closes the app, while other stacks are still on other stab.
Question 1. Can i make just one entry point to the app - (this way all stacks can end inn this tab)
Question 2. Can all stacks be emptied before closing the App
Hi,
Would this lib allow a result to be passed across multiple activities like :
A need result D produce result But B is destroyed by android
A -> B (destroyed) -> C -> D
Hi, Artur!
Do you plan to migrate the lib to use AndroidX?
Is there possibility to know what current screen is now?
It can be useful for example for knowing which screen is being displayed when receiving a notification, to know if you must resume that activity in case is already on the stack or if you need to recreate that screen.
And another question, there are plans to implement some sort of navigation stack using screens? Like the one you can create on a notification using intents, to preserve the navigation stack when navigating to a hierarchically deep screen.
I have activity A that is calling switchTo() to load a fragment, but the command is queued because I have a LockActivity that shows a pin lock screen when "onStart()" is called from any Activity.
That makes the switchTo() command to wait in the queue because the navigation to the lock activity is being executed. Then when the navigation context is set on that lock activity the switchTo command is executed, but on that activity I don't have a ScreenSwitcher set because I don't need to load any fragment there. That throws a NavigationException.
I propose to give access to the command queue to be able to manage that weird cases, but maybe there's a more elegant or more robust solution for that.
EDIT: I added a flag on the command interface meaning if the command can be discarded if no screen switcher is present, by default is always false, I'll make a pull request if you want to accept it.
Please assist me as the expected generated class is not generating. I have annnotated all the fragments and activities with The @Register
annotation :(
@aartikov Thanks
What would be the best approach to solve case as described below:
I have fragments/screens [A
, B
, C
, D
] in backstack. D
is currently active.
Given, that I don't know what fragments are currently in backstack I want to navigate to E
, but also remove from backstack D
, C
, B
if they are there.
So that end result would be [A
, E
]
Intention is that user shouldn't see some flow that is no longer relevant to him. And so, that he wouldn't be able to navigate to it via goBack()
I imagine something that. Does it make sense?
fun goToScreenE() {
[`D`, `C`, `B`].each { screen ->
if (getCurrentTopScreen() is screen) {
navigator.goBack()
}
}
navigator.goForward(E())
}
fun getCurrentTopScreen() {
???
}
Is it possible to implement nested FragmentScreenSwitcher
?
One of my fragments(let's call it HostFragment
) has a bottom navigation implemented, and I want to use switchTo
to switch betweed child fragments of HostFragment
.
Furthermore, I have AnotherHostFragment
with different set of fragments.
I want to solve this problem without additional activities, in a single activity app setup.
Thank you in advance
Hi ๐,
Thank you for this great lib!
I have a problem when I try to get a the current activity Screen in the onCreate()
of it. The screenResolver
returns a null for the .getScreen()
call curiously.
I have registered my Activity and it's corresponding Screen in the NavigationFactory.
Here is my Activity and Screen declaration :
class LoginActivity : BaseActivity() {
...
data class Screen(
val myString: String? = null
): me.aartikov.alligator.Screen, Serializable
}
override fun onCreate(savedInstanceState: Bundle?) {
screenResolver.getScreen(this) //returns null
}
Note that because I haven't migrate my app to AndroidX, I am currently on the version 2.2.0. That's why the #16 issue didn't help me a lot for the moment.
Have you any suggestion for me ?
Thank you in advance ๐
I've been searching how to get the activity result from a Fragment on the docs and on the examples but I cannot find how to do it. I've successfully retrieved the activity result from an activity, but I don't see the way to get it directly from a fragment.
Is possible to get the result from a fragment instead of its parent activity? Can you give me some hints to do it?
Thanks.
In current implementation I only see possibility to register one screen result listener when building NavigationContext
.
I need to pass result from one fragment to another. It is possible using setTargetFragment(fragment, requestCode)
Is there a way, that I can't find, to achieve such behaviour?
Do you have plans to migrate this project to Kotlin?
Can you explain this Part of the code
Fragment fragment = mScreenSwitcher.getCurrentFragment(); if (fragment != null && fragment instanceof ContainerIdProvider) { builder.containerId(((ContainerIdProvider) fragment).getContainerId()) .fragmentManager(fragment.getChildFragmentManager()); // Use child fragment manager for nested navigation }
I am trying to play with nested screens but cannot get them to work when i press the back button
Is there a way to use switchTo() or other command on a fragment view pager?
Or a way to imitate the ViewPager behavior using animations without losing the swipe functionality?
Artur, thanks for your library! I'm happy to use it since ver.1.0.
May be you'd met with this case and know how to solve it.
For example application have complex screens structure.
A -> B -> ะก
|
v
D -> E
Current activity is C. Then application gets push-notification, user tap on it and application should open activity E. I.e. it goes from C to E. BUT when user tap on back from current activity (now it is E) it should go to D, and on next back - to A. Is it possible to solve the issue with your lib?
Hi, as part of the new JetPack along with android architecture components Google released a navigation component (https://developer.android.com/topic/libraries/architecture/navigation/). While the java part seems quite close to what Alligator does, there is a XML/UI integration with features like deep links. (I don't care much about the XML thing but the way it's allow you to build flows with deep links is convenient)
So I'm wondering :
Hi, I have android:windowIsTranslucent
activity which should return result, but it happens only if rotate screen after call FinishWithResult
.
Open ForegroundActivity from BackgroundActivity
unbind BackgroundActivity
bind ForegroundActivity
Call FinishWithResult in ForegroundActivity
unbind ForegroundActivity
bind BackgroundActivity
Now we stay in the BackgroundActivity
Open ForegroundActivity from BackgroundActivity
unbind BackgroundActivity
bind ForegroundActivity
Rotate 1
unbind ForegroundActivity
bind ForegroundActivity
bind BackgroundActivity
unbind BackgroundActivity
Call FinishWithResult, bat nothing happens. We stay at ForegroundActivity, but need BackgroundActivity
Rotate 2
unbind ForegroundActivity
bind ForegroundActivity
bind BackgroundActivity
unbind BackgroundActivity
unbind ForegroundActivity
bind BackgroundActivity
Now we stay in the BackgroundActivity
I think lifecycle for BackgroundActivity if we use android:windowIsTranslucent
is not typical:
https://tech.pic-collage.com/something-about-android-windowistranslucent-641cc02ff66f
I have the same problem when test sample app from this repository. Is library knows about it ?
Hello, Im trying to understand how can I achieve the fragment backstack handling. Im running the sample advancedscreenswitchersample but when I go though fragments and touch on back button it closes the app.
Im running on Nexus 5x - Android 8.1.0
Thanks.
Hi, first of all thanks for this great lib!
It's too difficult to add a new navigation method that checks if a fragment is already loaded instead replacing it everytime?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.