Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new func for returns the given fragmentStackIndex #39

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

perihanimamoglu
Copy link

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Added new function for returns the given fragmentStackIndex

Motivation and Context

In the step-by-step flows, user can want to return to one of the previous steps. With new function, we can return to the stack index in the tab we want.

How Has This Been Tested?

Added button to MainActivity for testing.

Screenshots (if appropriate):

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@@ -158,6 +158,19 @@ open class MultipleStackNavigator(
initializeStackState()
}

override fun reset(tabIndex: Int, fragmentStackIndex: Int) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about targetStackIndex rather than fragmentStackIndex?

@@ -154,6 +154,13 @@ interface Navigator {
*/
fun initialize(savedState: Bundle?)

/**
* Returns the given fragmentStackIndex in the given tabIndex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please update the javadoc? I believe this was a copy paste mistake.

}
fragmentManagerController.commitAllowingStateLoss()
fragmentManagerController.enableFragment(getCurrentFragmentTag())
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should handle else case too. We can call reset(tabIndex: Int, resetRootFragment: Boolean = true) to reset the tab or throw an exception. Which one do you think would be appropriate for your usecase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants