From 9c64ff054c0d0b1290ab1b0da72095791018f225 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 17 May 2022 13:22:23 +0200 Subject: [PATCH] Fix issue #59 - Issue with lists --- .../android/activities/MastodonListActivity.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/MastodonListActivity.java b/app/src/main/java/app/fedilab/android/activities/MastodonListActivity.java index c4527da4..d3ef6eae 100644 --- a/app/src/main/java/app/fedilab/android/activities/MastodonListActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/MastodonListActivity.java @@ -222,9 +222,12 @@ public class MastodonListActivity extends BaseActivity implements MastodonListAd mastodonListList.remove(position); mastodonListAdapter.notifyItemRemoved(position); ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.recyclerView, () -> { + canGoBack = false; if (fragmentMastodonTimeline != null) { fragmentMastodonTimeline.onDestroyView(); } + invalidateOptionsMenu(); + setTitle(R.string.action_lists); }); if (mastodonListList.size() == 0) { binding.notContent.setVisibility(View.VISIBLE); @@ -292,18 +295,16 @@ public class MastodonListActivity extends BaseActivity implements MastodonListAd fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragmentMastodonTimeline); fragmentTransaction.commit(); + invalidateOptionsMenu(); }); - invalidateOptionsMenu(); } @Override public boolean onCreateOptionsMenu(@NonNull Menu menu) { - if (binding != null) { - if (binding.recyclerView.getVisibility() == View.VISIBLE) { - getMenuInflater().inflate(R.menu.menu_main_list, menu); - } else { - getMenuInflater().inflate(R.menu.menu_list, menu); - } + if (!canGoBack) { + getMenuInflater().inflate(R.menu.menu_main_list, menu); + } else { + getMenuInflater().inflate(R.menu.menu_list, menu); } return true; }