mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fixed the issue with blank screen after changing the theme. (#4220)
Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
parent
2a68181a90
commit
37c39ad55f
1 changed files with 20 additions and 0 deletions
|
|
@ -235,6 +235,26 @@ public class MainActivity extends BaseActivity
|
|||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt("viewPagerCurrentItem", viewPager.getCurrentItem());
|
||||
outState.putString("activeFragment", activeFragment.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
String currentFragmentName = savedInstanceState.getString("activeFragment");
|
||||
if(currentFragmentName == ActiveFragment.CONTRIBUTIONS.name()) {
|
||||
setTitle(getString(R.string.contributions_fragment));
|
||||
loadFragment(ContributionsFragment.newInstance(),false);
|
||||
}else if(currentFragmentName == ActiveFragment.NEARBY.name()) {
|
||||
setTitle(getString(R.string.nearby_fragment));
|
||||
loadFragment(NearbyParentFragment.newInstance(),false);
|
||||
}else if(currentFragmentName == ActiveFragment.EXPLORE.name()) {
|
||||
setTitle(getString(R.string.navigation_item_explore));
|
||||
loadFragment(ExploreFragment.newInstance(),false);
|
||||
}else if(currentFragmentName == ActiveFragment.BOOKMARK.name()) {
|
||||
setTitle(getString(R.string.favorites));
|
||||
loadFragment(BookmarkFragment.newInstance(),false);
|
||||
}
|
||||
}
|
||||
|
||||
private void initMain() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue