-
Notifications
You must be signed in to change notification settings - Fork 551
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
feat: Navigation icon clicked scroll to top #1391
feat: Navigation icon clicked scroll to top #1391
Conversation
@iamareebjamal please review |
Ask for peer reviews first, please |
@iamareebjamal Oh sorry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -208,4 +209,6 @@ class EventsFragment : Fragment() { | |||
rootView.swiperefresh?.setOnRefreshListener(null) | |||
super.onStop() | |||
} | |||
|
|||
fun scrollToTop() = rootView.eventsNestedScrollView.smoothScrollTo(1, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an interface with this function
val hostFragment = supportFragmentManager.findFragmentById(R.id.frameContainer) | ||
if (hostFragment is NavHostFragment) { | ||
val currentFragment = hostFragment.childFragmentManager.fragments.first() | ||
when (item.itemId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just check if the fragment is implementing the interface and call the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have followed your guidelines and made the changes
Details: ScrollToTop interface is created so that appropriate fragments will implement. In the MainActivity, bottom navigation callback on actionReselectedListener is called to handle scroll link to the top of the current fragment (EventsFragment and OrdersUnderUserFragment) Fixes #1387
Details:
Fixes #1387
Screenshots for the change: