Comments (8)
okay, i think i missed the part of the Container. if i get you correctly, i would have
mTabScreenMap.put(R.id.navigation_home, new HomeTabScreen1("home"));
mTabScreenMap.put(R.id.navigation_profile, new HomeTabScreen2("profile"));
mTabScreenMap.put(R.id.navigation_leader, new HomeTabScreen3("Leader"));
```
from alligator.
This is the trickiest part in advancedscreenswitchersample.
When you press tab buttons FragmentScreenSwitcher
switches instances of TabFragment
in main_container. Each TabFragment
has its own fragment stack. To configure a fragment stack you need to bind NavigationContext
with a correct fragment manager and containerId. There only one active stack at any given time, so binding of NavigationContext
is called after each screen switching.
What kind of nested screens do you need?
from alligator.
Before meeting this Library, i used a Single Activity with 5 tabs and host containerId parentPannel
.
i call fragmentmanager.replace
to put my fragments in the container. This way i have one back stack for the activity. Here the back button clears the BackStack one by one.
WHAT I WANT
TAB A ---> NEST A - - >NEST B --> NEST A2--> NEST A2-> NEST A2
ONBACKPRESS
NEST A2 --->NEST A2 --->NEST A2 ---> NEST B ---> NEST A --->TAB A - close APP
CHALLENGE I FACE:
I notice that the fragment has its own FrameLayout that houses the nested Fragment
Question is there a way to continue using my existingContainner
for the nested screens or they need their own Container.
Leading Question if i need a new container, does it need to be in the fragment layout or i can i just declare two containers in the Activity layout.
I observe from your code that every tab Fragment needs to have its own container, because thats how you keep track of it.
I would love to discuss more with you on how i can fully use the Library :)
from alligator.
It depends on what result you want to achieve.
You described a simple fragment stack. You can do the same thing with Alligator. Just set a container to NavigationContext
and use goForward
and goBack
methods to push and pop fragments.
In my sample I use ScreenSwitcher
to create three separate fragment stacks. It gives another behavior. A user can switch to Tab A, add screens A1 and A2, switch to Tab B, add screens B1 and B2, then return back to Tab A, add screen A3 after A2 and so on. In other words it is three independent stacks, not single one.
from alligator.
i do not know what i am not getting right, but even as far forward i go. when i press the back Button. It closes the app with returning to the last item.
Also I cannot seem to get the Screen from Navigator. It always returns null
from alligator.
It is hard to say what is a problem. Can you share the code?
from alligator.
I was able to replicate the issue in this Project as i am . unable to share the production code
https://github.com/mathemandy/Triviums.git
The app just shows you a list of items. when an item is selected, the new Fragment(newStageFragment)is show. ( but it shows with the old fragment.)
Clicking the back button in the seconnd Fragment opens the app.
- How do i fix the back Button issue.
- Is there a way openinng the new fragment doesnt show the older onne thanks
from alligator.
Your configuration differs from my sample. Take a closer look at it.
I use TabFragment
as a container for nested fragments. Try to do it in the same way.
Add HomeTabFragment
with just a FrameLayout. CategoryFragment
and newStageFragment
will be nested fragments.
There are also other fixes required:
- Override onBackPressed like that
@Override
public void onBackPressed() {
mNavigator.goBack();
}
- Unbind a navigation context in onPause
@Override
protected void onPause() {
mNavigationContextBinder.unbind();
super.onPause();
}
- Implement equals and hashCode for tab screens.
from alligator.
Related Issues (20)
- Question: How to get the activity result from a fragment? HOT 1
- Handle result if activity is destroyed HOT 10
- Nested fragment ScreenSwitcher HOT 1
- Integration with AAC Navigator HOT 1
- Fragment BackStack Handling HOT 4
- Navigation tree HOT 2
- In which case getScreen can return null ? HOT 5
- Kotlin HOT 2
- Translucent activity not finished with result HOT 4
- It makes sense to have a method returning the current screen (and maybe the activity/fragment) on AndroidNavigator? HOT 1
- AndroidX HOT 3
- Can an Instagram Like navigation be done with this Library HOT 2
- Cannot generate Class HOT 1
- screenResolver.getScreen() returns null HOT 4
- [Improvement] Make a new navigator method to keep already loaded Fragments. HOT 1
- Pop fragments/screens if HOT 2
- Fragments and ViewPager HOT 3
- Passing ScreenResult from one fragment to another fragment HOT 9
- "Race condition" when using switchTo() HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alligator.