From 05af0f786210a120daa688c08e3d3bb426e4be88 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 14 Jun 2016 12:42:11 +0200 Subject: [PATCH] setup a fragment listener after orientation change if theres none --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.java | 3 +++ .../com/simplemobiletools/gallery/fragments/VideoFragment.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/src/main/java/com/simplemobiletools/gallery/fragments/PhotoFragment.java b/app/src/main/java/com/simplemobiletools/gallery/fragments/PhotoFragment.java index 06086e010..68a7357d4 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/fragments/PhotoFragment.java +++ b/app/src/main/java/com/simplemobiletools/gallery/fragments/PhotoFragment.java @@ -37,6 +37,9 @@ public class PhotoFragment extends ViewPagerFragment implements View.OnClickList @Override public void onClick(View v) { + if (listener == null) + listener = (FragmentClickListener) getActivity(); + listener.fragmentClicked(); } diff --git a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java index ab7cde613..c66ab3f55 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java +++ b/app/src/main/java/com/simplemobiletools/gallery/fragments/VideoFragment.java @@ -156,6 +156,9 @@ public class VideoFragment extends ViewPagerFragment default: isFullscreen = !isFullscreen; checkFullscreen(); + + if (listener == null) + listener = (FragmentClickListener) getActivity(); listener.fragmentClicked(); break; }