mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-24 16:02:13 +01:00
Fixed back button no longer closing app
This commit is contained in:
parent
c2734ecb7e
commit
096fb0d427
@ -101,6 +101,8 @@ public class MainActivityTest {
|
||||
solo.goBack();
|
||||
solo.goBack();
|
||||
assertEquals(solo.getString(R.string.subscriptions_label), getActionbarTitle());
|
||||
solo.goBack();
|
||||
assertThat(mActivityRule.getActivityResult(), hasResultCode(Activity.RESULT_CANCELED));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -367,6 +367,7 @@ public class MainActivity extends CastEnabledActivity {
|
||||
super.onBackPressed();
|
||||
} else {
|
||||
loadFragment(UserPreferences.getBackButtonGoToPage(), null);
|
||||
NavDrawerFragment.saveLastNavFragment(this, UserPreferences.getBackButtonGoToPage());
|
||||
}
|
||||
break;
|
||||
default: super.onBackPressed();
|
||||
|
@ -192,7 +192,7 @@ public class NavDrawerFragment extends Fragment implements AdapterView.OnItemCli
|
||||
} else {
|
||||
showMainActivity(EpisodesFragment.TAG);
|
||||
}
|
||||
saveLastNavFragment(EpisodesFragment.TAG);
|
||||
saveLastNavFragment(getContext(), EpisodesFragment.TAG);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -371,7 +371,7 @@ public class NavDrawerFragment extends Fragment implements AdapterView.OnItemCli
|
||||
} else {
|
||||
showMainActivity(tag);
|
||||
}
|
||||
saveLastNavFragment(tag);
|
||||
saveLastNavFragment(getContext(), tag);
|
||||
} else {
|
||||
int pos = position - navAdapter.getSubscriptionOffset();
|
||||
long feedId = navDrawerData.feeds.get(pos).getId();
|
||||
@ -382,7 +382,7 @@ public class NavDrawerFragment extends Fragment implements AdapterView.OnItemCli
|
||||
intent.putExtra(MainActivity.EXTRA_FEED_ID, feedId);
|
||||
startActivity(intent);
|
||||
}
|
||||
saveLastNavFragment(String.valueOf(feedId));
|
||||
saveLastNavFragment(getContext(), String.valueOf(feedId));
|
||||
}
|
||||
selectedNavListIndex = position;
|
||||
navAdapter.notifyDataSetChanged();
|
||||
@ -400,9 +400,9 @@ public class NavDrawerFragment extends Fragment implements AdapterView.OnItemCli
|
||||
}
|
||||
}
|
||||
|
||||
private void saveLastNavFragment(String tag) {
|
||||
public static void saveLastNavFragment(Context context, String tag) {
|
||||
Log.d(TAG, "saveLastNavFragment(tag: " + tag + ")");
|
||||
SharedPreferences prefs = getContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
if (tag != null) {
|
||||
edit.putString(PREF_LAST_FRAGMENT_TAG, tag);
|
||||
|
Loading…
Reference in New Issue
Block a user