From 69e0de5162c4954c2a0ff5ee4afef3b20d48e950 Mon Sep 17 00:00:00 2001 From: Amanpal Singh <87360222+aman-alfresco@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:06:09 +0530 Subject: [PATCH] fixed progress running infinite issue --- .../kotlin/com/alfresco/content/viewer/ViewerFragment.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/viewer/src/main/kotlin/com/alfresco/content/viewer/ViewerFragment.kt b/viewer/src/main/kotlin/com/alfresco/content/viewer/ViewerFragment.kt index a180aa409..999f3de95 100644 --- a/viewer/src/main/kotlin/com/alfresco/content/viewer/ViewerFragment.kt +++ b/viewer/src/main/kotlin/com/alfresco/content/viewer/ViewerFragment.kt @@ -57,6 +57,7 @@ class ViewerFragment : Fragment(), MavericksView { private val viewModel: ViewerViewModel by fragmentViewModelWithArgs { args } private lateinit var binding: ViewerBinding private var childFragment: ChildViewerFragment? = null + private var hasLoadingStatus: Boolean = false private val viewerLoadingListener = object : LoadingListener { override fun onContentLoaded() { @@ -119,7 +120,9 @@ class ViewerFragment : Fragment(), MavericksView { state.viewerUri, state.viewerMimeType, ) - show(Status.LoadingPreview) + if (!hasLoadingStatus) { + show(Status.LoadingPreview) + } } else { show(Status.NotSupported) } @@ -158,6 +161,7 @@ class ViewerFragment : Fragment(), MavericksView { } private fun show(s: Status) { + println("ViewerFragment.show ${s.name}") binding.apply { when (s) { Status.LoadingMetadata -> { @@ -179,12 +183,14 @@ class ViewerFragment : Fragment(), MavericksView { } Status.PreviewLoaded -> { + hasLoadingStatus = true info.isVisible = childFragment?.showInfoWhenLoaded() == true loading.isVisible = false status.text = "" } Status.NotSupported -> { + hasLoadingStatus = true info.isVisible = true loading.isVisible = false status.text = getString(R.string.error_preview_not_available)