Fix issue #59 - Issue with lists

This commit is contained in:
Thomas 2022-05-17 13:22:23 +02:00
parent 5f8685db32
commit 9c64ff054c

View file

@ -222,9 +222,12 @@ public class MastodonListActivity extends BaseActivity implements MastodonListAd
mastodonListList.remove(position); mastodonListList.remove(position);
mastodonListAdapter.notifyItemRemoved(position); mastodonListAdapter.notifyItemRemoved(position);
ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.recyclerView, () -> { ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.recyclerView, () -> {
canGoBack = false;
if (fragmentMastodonTimeline != null) { if (fragmentMastodonTimeline != null) {
fragmentMastodonTimeline.onDestroyView(); fragmentMastodonTimeline.onDestroyView();
} }
invalidateOptionsMenu();
setTitle(R.string.action_lists);
}); });
if (mastodonListList.size() == 0) { if (mastodonListList.size() == 0) {
binding.notContent.setVisibility(View.VISIBLE); binding.notContent.setVisibility(View.VISIBLE);
@ -292,19 +295,17 @@ public class MastodonListActivity extends BaseActivity implements MastodonListAd
fragmentManager.beginTransaction(); fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragmentMastodonTimeline); fragmentTransaction.replace(R.id.fragment_container, fragmentMastodonTimeline);
fragmentTransaction.commit(); fragmentTransaction.commit();
});
invalidateOptionsMenu(); invalidateOptionsMenu();
});
} }
@Override @Override
public boolean onCreateOptionsMenu(@NonNull Menu menu) { public boolean onCreateOptionsMenu(@NonNull Menu menu) {
if (binding != null) { if (!canGoBack) {
if (binding.recyclerView.getVisibility() == View.VISIBLE) {
getMenuInflater().inflate(R.menu.menu_main_list, menu); getMenuInflater().inflate(R.menu.menu_main_list, menu);
} else { } else {
getMenuInflater().inflate(R.menu.menu_list, menu); getMenuInflater().inflate(R.menu.menu_list, menu);
} }
}
return true; return true;
} }