From 7b0a75be43f86111a100382b3aade0f8003af6d8 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 2 Aug 2024 11:02:32 +0200 Subject: [PATCH] use onStart for provide same behaviour when app is on background and on foreground Signed-off-by: alperozturk --- .../com/owncloud/android/ui/preview/PreviewMediaFragment.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt index 2f2ee0c7d80b..f939dbf8ecfc 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.kt @@ -156,7 +156,6 @@ class PreviewMediaFragment : FileFragment(), OnTouchListener, Injectable { toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_LOCKED_CLOSED) addMenuHost() - prepareMedia() } private fun checkArgumentsAfterViewCreation(savedInstanceState: Bundle?) { @@ -276,6 +275,11 @@ class PreviewMediaFragment : FileFragment(), OnTouchListener, Injectable { } } + override fun onStart() { + super.onStart() + prepareMedia() + } + private fun prepareMedia() { if (file == null || !isAdded) { Log_OC.d(TAG, "File is null or fragment not attached to a context.")