@@ -113,7 +113,11 @@ public void onCreate(Bundle savedInstanceState) {
113
113
setTitle (getString (R .string .explore_tab_title_mobile ));
114
114
setUpLoggedOutPager ();
115
115
} else {
116
- setTitle (getString (R .string .contributions_fragment ));
116
+ if (savedInstanceState == null ){
117
+ //starting a fresh fragment.
118
+ setTitle (getString (R .string .contributions_fragment ));
119
+ loadFragment (ContributionsFragment .newInstance (),false );
120
+ }
117
121
setUpPager ();
118
122
initMain ();
119
123
}
@@ -124,30 +128,31 @@ public void setSelectedItemId(int id) {
124
128
}
125
129
126
130
private void setUpPager () {
127
- loadFragment (ContributionsFragment .newInstance ());
128
131
tabLayout .setOnNavigationItemSelectedListener (item -> {
129
132
if (!item .getTitle ().equals ("More" )) {
130
133
// do not change title for more fragment
131
134
setTitle (item .getTitle ());
132
135
}
133
136
Fragment fragment = NavTab .of (item .getOrder ()).newInstance ();
134
- return loadFragment (fragment );
137
+ return loadFragment (fragment , true );
135
138
});
136
139
}
137
140
138
141
private void setUpLoggedOutPager () {
139
- loadFragment (ExploreFragment .newInstance ());
142
+ loadFragment (ExploreFragment .newInstance (), false );
140
143
tabLayout .setOnNavigationItemSelectedListener (item -> {
141
144
if (!item .getTitle ().equals ("More" )) {
142
145
// do not change title for more fragment
143
146
setTitle (item .getTitle ());
144
147
}
145
148
Fragment fragment = NavTabLoggedOut .of (item .getOrder ()).newInstance ();
146
- return loadFragment (fragment );
149
+ return loadFragment (fragment , true );
147
150
});
148
151
}
149
152
150
- private boolean loadFragment (Fragment fragment ) {
153
+ private boolean loadFragment (Fragment fragment ,boolean showBottom ) {
154
+ //showBottom so that we do not show the bottom tray again when constructing
155
+ //from the saved instance state.
151
156
if (fragment instanceof ContributionsFragment ) {
152
157
if (activeFragment == ActiveFragment .CONTRIBUTIONS ) { // Do nothing if same tab
153
158
return true ;
@@ -172,7 +177,7 @@ private boolean loadFragment(Fragment fragment) {
172
177
}
173
178
bookmarkFragment = (BookmarkFragment ) fragment ;
174
179
activeFragment = ActiveFragment .BOOKMARK ;
175
- } else if (fragment == null ) {
180
+ } else if (fragment == null && showBottom ) {
176
181
if (applicationKvStore .getBoolean ("login_skipped" ) == true ) { // If logged out, more sheet is different
177
182
MoreBottomSheetLoggedOutFragment bottomSheet = new MoreBottomSheetLoggedOutFragment ();
178
183
bottomSheet .show (getSupportFragmentManager (),
0 commit comments