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

Proper OnResume Behavior Suggestions? #34

Closed
rayliverified opened this issue Nov 8, 2017 · 4 comments
Closed

Proper OnResume Behavior Suggestions? #34

rayliverified opened this issue Nov 8, 2017 · 4 comments

Comments

@rayliverified
Copy link

I love this library so much! ❤️

A quick question on the proper way to handle SlidingRootNav's lifecycle. When an activity using SlidingRootNav is recreated (resumed from sleep), should the menu be recreated? I have noticed that if the menu is open and the app is put to sleep and then resumed, the menu stays open but the sliding mechanism no longer works.

Thank you for your suggestions!

@yarolegovich
Copy link
Owner

Honestly, I'm confused. What exactly leads to this? Do you turn the screen off and on, or do you restore activity from activity stack, does it happen after orientation changes?

@rayliverified
Copy link
Author

Sorry about the confusion. The navigation menu gets stuck in the open position when the activity is resumed.
Steps to reproduce:

  1. Open SlidingRootNav.
  2. Switch to other apps. Open enough apps so that Android puts your app to sleep.
  3. Open your app from the recents drawer. When your app is resumed, the menu is open and cannot be closed.

I initialize SlidingRootNav in onCreate. Should it also be initialized in onResume too?

@abhimuktheeswarar
Copy link

override fun onResume() {
        super.onResume()
        if (slidingRootNav.isMenuOpened) slidingRootNav.closeMenu()
    }

@rayliverified
Copy link
Author

Closing the sliding menu is the right way to go. I think closing it on pause is better than hiding it on resume.

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

No branches or pull requests

3 participants