diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 1235b92d5..5af69a4ca 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -265,7 +265,6 @@ public class ItemFragment extends Fragment { Log.d(TAG, "updateAppearance item is null"); return; } - getActivity().supportInvalidateOptionsMenu(); txtvPodcast.setText(item.getFeed().getTitle()); txtvTitle.setText(item.getTitle()); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java index 98cb93e7a..74530e424 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java @@ -9,6 +9,7 @@ import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.view.ViewCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.viewpager.widget.ViewPager; @@ -78,6 +79,12 @@ public class ItemPagerFragment extends Fragment { View layout = inflater.inflate(R.layout.feeditem_pager_fragment, container, false); ViewPager pager = layout.findViewById(R.id.pager); + // FragmentStatePagerAdapter documentation: + // > When using FragmentStatePagerAdapter the host ViewPager must have a valid ID set. + // When opening multiple ItemPagerFragments by clicking "item" -> "visit podcast" -> "item" -> etc, + // the ID is no longer unique and FragmentStatePagerAdapter does not display any pages. + int newId = ViewCompat.generateViewId(); + pager.setId(newId); pager.setAdapter(new ItemPagerAdapter()); pager.setCurrentItem(feedItemPos); loadItem(feedItems[feedItemPos]);