View Code? Open in Web Editor
NEW
Easy Bottom Tab Navigation with back stack history
Home Page: https://blog.f22labs.com/instagram-like-bottom-tab-fragment-transaction-android-389976fb8759
License: Other
instalikefragmenttransaction's People
Contributors
instalikefragmenttransaction's Issues
I wanted to set third TAB as Default on Activity create. But I could not. switchTab(2) is not working well
// transition animation
View view1 = view.findViewById(R.id.tv_title);
List<Pair<View, String>> val = new ArrayList<>();
val.add(Pair.create(view1, Utils.getTransitionName(view1)));
FragNavTransactionOptions transaction = FragNavTransactionOptions
.newBuilder()
.sharedElements(val)
.build();
if (mFragmentNavigation != null) {
mFragmentNavigation.pushFragment(MessageDetailsFragment.newInstance(1, bundle), transaction);
}
I used this library but when I press hardware back button, the previous View disappears and onCreateView function is called again.?
When I try to change the tab, pages with more views take longer time to load( like 200 - 500 miliseconds). Is there a fix?
It feels like it's making the fragment over and over each time.
After sample starts:
Select NewsFragment (showing properly)
Press back(coming back to home)
Press NewsFragment again(not working)
1- select search fragment work
2- and select news fragment work
3- and again select search fragment it's work
4- Now press back first press back not working and second press back it's back to Home fragment but it's should back to news fragment in first press back and in second press it's back to Home.
@ Override
public void pushFragment (Fragment fragment ) {
if (mNavController != null ) {
FragNavTransactionOptions transaction = FragNavTransactionOptions
.newBuilder ()
.customAnimations (
R .anim .enter_from_right ,
R .anim .exit_to_left ,
R .anim .enter_from_left ,
R .anim .exit_to_right )
.build ();
mNavController .pushFragment (fragment , transaction );
}
}
This is my code block and it's working nicely but the problem is popFragment().
popFragment has no transaction effect when I try to press back button.
I tried;
mNavController .popFragment ();
mNavController .popFragment (transaction );
// And both of them is not working