From 06534d0a2339eb85bf9db488e99f5401e349d3cd Mon Sep 17 00:00:00 2001 From: ZetaTom <70907959+ZetaTom@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:36:13 +0100 Subject: [PATCH] Fix FileDetailFragment not starting - opens on specified tab - opens when launched from PreviewImageActivity Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com> --- .../android/ui/fragment/FileDetailFragment.java | 13 +++++++------ .../android/ui/preview/PreviewImageActivity.kt | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 2dc7fe4b10..59b5aaaa4c 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -351,12 +351,13 @@ public class FileDetailFragment extends FileFragment implements OnClickListener, } }); - // FIXME file detail not opening from Media tab - if (binding != null) { - TabLayout.Tab tab = binding.tabLayout.getTabAt(activeTab); - if (tab == null) return; - binding.tabLayout.selectTab(tab); - } + binding.tabLayout.post(() -> { + if (binding != null) { + TabLayout.Tab tab = binding.tabLayout.getTabAt(activeTab); + if (tab == null) return; + tab.select(); + } + }); } @Override diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.kt index ff6d81ded9..9ed0babe6a 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.kt @@ -357,7 +357,7 @@ class PreviewImageActivity : FileActivity(), FileFragment.ContainerActivity, OnR } startActivity(intent) - backToDisplayActivity() + finish() } override fun showDetails(file: OCFile, activeTab: Int) {