Fixed toolbar state updates

Do not modify up arrow state of background fragments's toolbars.
They are invisible anyways and their state can be kept when resuming
later.
This commit is contained in:
ByteHamster 2020-11-01 11:54:54 +01:00
parent 8975b60ecd
commit 5f2b436ddc
4 changed files with 4 additions and 12 deletions

View File

@ -112,15 +112,6 @@ public class MainActivity extends CastEnabledActivity {
setNavDrawerSize();
final FragmentManager fm = getSupportFragmentManager();
fm.addOnBackStackChangedListener(() -> {
boolean showArrow = fm.getBackStackEntryCount() != 0;
if (drawerToggle != null) { // Tablet layout does not have a drawer
drawerToggle.setDrawerIndicatorEnabled(!showArrow);
} else if (getActionBar() != null) {
getActionBar().setDisplayHomeAsUpEnabled(showArrow);
}
});
if (fm.findFragmentByTag(MAIN_FRAGMENT_TAG) == null) {
String lastFragment = NavDrawerFragment.getLastNavFragment(this);
if (ArrayUtils.contains(NavDrawerFragment.NAV_DRAWER_TAGS, lastFragment)) {

View File

@ -292,7 +292,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
}
EpisodesApplyActionFragment fragment = EpisodesApplyActionFragment
.newInstance(feed.getItems(), actions);
((MainActivity)getActivity()).loadChildFragment(fragment);
((MainActivity) getActivity()).loadChildFragment(fragment);
return true;
case R.id.rename_item:
new RenameFeedDialog(getActivity(), feed).show();

View File

@ -273,7 +273,8 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi
return true;
case R.id.episode_actions:
((MainActivity) requireActivity()).loadChildFragment(
EpisodesApplyActionFragment.newInstance(queue, ACTION_DELETE | ACTION_REMOVE_FROM_QUEUE | ACTION_DOWNLOAD));
EpisodesApplyActionFragment.newInstance(queue,
ACTION_DELETE | ACTION_REMOVE_FROM_QUEUE | ACTION_DOWNLOAD));
return true;
case R.id.queue_sort_episode_title_asc:
setSortOrder(SortOrder.EPISODE_TITLE_A_Z);

View File

@ -154,7 +154,7 @@ public class SearchFragment extends Fragment {
private void setupToolbar(Toolbar toolbar) {
toolbar.setTitle(R.string.search_label);
toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack());
toolbar.inflateMenu(R.menu.gpodder_podcasts);
toolbar.inflateMenu(R.menu.search);
MenuItem item = toolbar.getMenu().findItem(R.id.action_search);
item.expandActionView();