Giter VIP home page Giter VIP logo

Comments (8)

mathemandy avatar mathemandy commented on May 24, 2024 1

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.

aartikov avatar aartikov commented on May 24, 2024

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.

mathemandy avatar mathemandy commented on May 24, 2024

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.

aartikov avatar aartikov commented on May 24, 2024

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.

mathemandy avatar mathemandy commented on May 24, 2024

screen shot 2018-11-01 at 5 52 34 pm

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.

aartikov avatar aartikov commented on May 24, 2024

It is hard to say what is a problem. Can you share the code?

from alligator.

mathemandy avatar mathemandy commented on May 24, 2024

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.

  1. How do i fix the back Button issue.
  2. Is there a way openinng the new fragment doesnt show the older onne thanks

from alligator.

aartikov avatar aartikov commented on May 24, 2024

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:

  1. Override onBackPressed like that
@Override
public void onBackPressed() {
	mNavigator.goBack();
}
  1. Unbind a navigation context in onPause
@Override
protected void onPause() {
	mNavigationContextBinder.unbind();
	super.onPause();
}
  1. Implement equals and hashCode for tab screens.

from alligator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.