@@ -126,18 +126,15 @@ protected void onCreate(Bundle savedInstanceState) {
126
126
setContentView (R .layout .activity_contributions );
127
127
ButterKnife .bind (this );
128
128
129
- // Activity can call methods in the fragment by acquiring a reference to the Fragment from FragmentManager, using findFragmentById()
130
- contributionsList = (ContributionsListFragment )getSupportFragmentManager ().findFragmentById (R .id .contributionsListFragment );
129
+ // Activity can call methods in the fragment by acquiring a
130
+ // reference to the Fragment from FragmentManager, using findFragmentById()
131
+ contributionsList = (ContributionsListFragment )getSupportFragmentManager ()
132
+ .findFragmentById (R .id .contributionsListFragment );
131
133
132
134
getSupportFragmentManager ().addOnBackStackChangedListener (this );
133
135
if (savedInstanceState != null ) {
134
- mediaDetails = (MediaDetailPagerFragment )getSupportFragmentManager ().findFragmentById (R .id .contributionsFragmentContainer );
135
- // onBackStackChanged uses mediaDetails.isVisible() but this returns false now.
136
- // Use the saved value from before pause or orientation change.
137
- if (mediaDetails != null && savedInstanceState .getBoolean ("mediaDetailsVisible" )) {
138
- // Feels awful that we have to reset this manually!
139
- getSupportActionBar ().setDisplayHomeAsUpEnabled (true );
140
- }
136
+ mediaDetails = (MediaDetailPagerFragment )getSupportFragmentManager ()
137
+ .findFragmentById (R .id .contributionsFragmentContainer );
141
138
}
142
139
requestAuthToken ();
143
140
initDrawer ();
@@ -241,7 +238,10 @@ public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
241
238
getSupportActionBar ().setSubtitle (getResources ()
242
239
.getString (R .string .contributions_subtitle_zero ));
243
240
} else {
244
- getSupportActionBar ().setSubtitle (getResources ().getQuantityString (R .plurals .contributions_subtitle , cursor .getCount (), cursor .getCount ()));
241
+ getSupportActionBar ().setSubtitle (getResources ()
242
+ .getQuantityString (R .plurals .contributions_subtitle ,
243
+ cursor .getCount (),
244
+ cursor .getCount ()));
245
245
}
246
246
247
247
contributionsList .clearSyncMessage ();
@@ -314,11 +314,7 @@ public void unregisterDataSetObserver(DataSetObserver observer) {
314
314
315
315
@ Override
316
316
public void onBackStackChanged () {
317
- if (mediaDetails != null && mediaDetails .isVisible ()) {
318
- getSupportActionBar ().setDisplayHomeAsUpEnabled (true );
319
- } else {
320
- getSupportActionBar ().setDisplayHomeAsUpEnabled (false );
321
- }
317
+ initBackButton ();
322
318
}
323
319
324
320
@ Override
0 commit comments