diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java index b27a85892..df53fc825 100644 --- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java @@ -1537,7 +1537,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt } popup.setOnDismissListener(menu1 -> { if (binding.viewPager.getAdapter() != null) { - Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, binding.tabLayout.getSelectedTabPosition()); + int tabPosition = binding.tabLayout.getSelectedTabPosition(); + Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, Math.max(tabPosition, 0)); if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) { FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment); fragmentMastodonTimeline.refreshAllAdapters(); @@ -1634,7 +1635,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt public void refreshFragment() { if (binding.viewPager.getAdapter() != null) { - Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, binding.tabLayout.getSelectedTabPosition()); + int position = binding.tabLayout.getSelectedTabPosition(); + Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, Math.max(position, 0)); if (fragment instanceof FragmentNotificationContainer) { FragmentTransaction fragTransaction = getSupportFragmentManager().beginTransaction(); fragTransaction.detach(fragment).commit(); diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java index 86e026984..50dfa83a0 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/media/FragmentMedia.java @@ -105,13 +105,9 @@ public class FragmentMedia extends Fragment { enableSliding(true); } }); - binding.mediaPicture.setOnClickListener(v -> { - ((MediaActivity) requireActivity()).toogleFullScreen(); - }); + binding.mediaPicture.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen()); - binding.mediaVideo.setOnClickListener(v -> { - ((MediaActivity) requireActivity()).toogleFullScreen(); - }); + binding.mediaVideo.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen()); String type = attachment.type; String preview_url = attachment.preview_url;