android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.41k stars 8.29k forks source link

bugs NavigationAdvancedSample : screen white #778

Open fadibouteraa opened 4 years ago

fadibouteraa commented 4 years ago

I have tried navigation adventure (demo), it looks good and it is intuitive; however, It has come to my attention that after performing a stress test on the navigation buttons, it bugs: the screen whitens out

leaderboard

saharshpruthi commented 4 years ago

Duplicate of #773

RDSunhy commented 4 years ago

I solved the problem.The problem is the timing of the animation call. You just need to change it. fragmentManager.beginTransaction() .setCustomAnimations( R.anim.nav_default_enter_anim, R.anim.nav_default_exit_anim, R.anim.nav_default_pop_enter_anim, R.anim.nav_default_pop_exit_anim) .attach(selectedFragment) .setPrimaryNavigationFragment(selectedFragment) .apply { // Detach all other Fragments graphIdToTagMap.forEach { _, fragmentTagIter -> if (fragmentTagIter != newlySelectedItemTag) { detach(fragmentManager.findFragmentByTag(firstFragmentTag)!!) } } } .addToBackStack(firstFragmentTag) .setReorderingAllowed(true) .commit() after modification. fragmentManager.beginTransaction() .attach(selectedFragment) .setPrimaryNavigationFragment(selectedFragment) .apply { // Detach all other Fragments graphIdToTagMap.forEach { _, fragmentTagIter -> if (fragmentTagIter != newlySelectedItemTag) { detach(fragmentManager.findFragmentByTag(firstFragmentTag)!!) } } } .addToBackStack(firstFragmentTag) .setCustomAnimations( R.anim.nav_default_enter_anim, R.anim.nav_default_exit_anim, R.anim.nav_default_pop_enter_anim, R.anim.nav_default_pop_exit_anim) .setReorderingAllowed(true) .commit()

RDSunhy commented 4 years ago

@fadibouteraa In the NavigationAdvancedSample, navigation is 2.2.0-alpha01, modified to 2.1.0.And all beta versions will be corrected.