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
avoid recreation of fragment #44
Comments
Hi @rajam1215, sorry for a bit late replay. Did you check the default BottomBarNavigation view? Does it behave in an expected way? Also, did I understand you correctly - double-clicking on the same item causes Fragment recreation? If you don't mind, it would be really cool, if you can record a small video, which reflects wrong behaviour. Looking forward to hearing from you |
Hello @st235 I am very glade to see you again, i know the default behavior of bottom navigation, this is used only for show activities or fragments, but in this library we move forward already, it have MVVM support, but default doesn't, we need to avoid the recreation of fragment, now please check what is happen right now. your qus - double-clicking on the same item causes Fragment recreation? i make one little video,it will clear your query Please check once. |
Hi @rajam1215, PS: However, it's always welcomed any kind of contribution here. So, if you have any ideas on how to solve this problem, do not hesitate, please, to create a pull request. Kind regards, |
Hello @st235 not an issue, please see on the issue end of the week, but i have one solution for that.
But this solution work with onItemselectedLinstner of bottom navigation. but not with MVVM Technique Refer to this for the official solution. Please check the official solution for MVVM support, the solution code work with kotlin, and expandable bottom bar project work with kotlin, so you can handle this Please look in to it. Regards |
@rajam1215, hi 👋 Hopefully, you are well. I took a look at the problem. I tried to reproduce similar behaviour with default android components, so I've changed <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:backgroundTint="#fff"
app:menu="@menu/navigation_menu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" /> and also used NavigationUI (an alternative for native android view). NavigationUI.setupWithNavController(bottomNavigation, navigationController) Unfortunately, the behaviour you mentioned below is not followed by material design components. As it's not a native behaviour, I cannot implement it in this library. The users will not expect such behaviour at this component. I've made a small video of PS: also, I looked at the provided sample. The main highlight here: they don't use Kind regards, |
@st235 hello I understand what you want to say, it is not necessary to add this functionality in the library, but in my suggestion this feature you can see in maximum apps, you can check from your side also, those who use bottom navigation in the app. coz some time user don't want to see the app screen again and again from start, user always want to use it from where he/she left (App User), i hope you can understand, you can add this functionality in your lib, if user want to use this functionality in app they can use, if not they can not use (Coder) Thanks and Regards |
Good morning, @rajam1215 👋 Thank you for provided information, I really appreciate it. However, as I wrote below - it's not a default behavior for alternative native android widget. Moreover, it looks like as an application layer responsibility to cache fragments. I can recommend you to look at fragmentFactory - probably, it will cover you case. Best wishes, |
hello @st235
sins the MVVM support it is awesome, but we need one more enhancement in the library, so Fragment not create every time when any bottom menu item clicked with MVVM
Thanks
The text was updated successfully, but these errors were encountered: