From 3d79053aeb2aa535ef6070fb13f67ee7b346ccb1 Mon Sep 17 00:00:00 2001 From: Aitorbp Date: Thu, 2 Nov 2023 11:27:28 +0000 Subject: [PATCH] Added functionality lastUsage in Open in web and Open with --- .../android/presentation/files/details/FileDetailsFragment.kt | 2 ++ .../android/presentation/files/filelist/MainFileListFragment.kt | 1 + .../com/owncloud/android/ui/activity/FileDisplayActivity.kt | 1 + 3 files changed, 4 insertions(+) diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/files/details/FileDetailsFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/files/details/FileDetailsFragment.kt index c7789ed2316..c32ec1d407e 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/files/details/FileDetailsFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/files/details/FileDetailsFragment.kt @@ -228,6 +228,7 @@ class FileDetailsFragment : FileFragment() { openInWebProviders.forEach { (openInWebProviderName, menuItemId) -> if (menuItemId == item.itemId) { fileDetailsViewModel.openInWeb(safeFile.file.remoteId!!, openInWebProviderName) + fileOperationsViewModel.setLastUsageFile(safeFile.file) return true } } @@ -244,6 +245,7 @@ class FileDetailsFragment : FileFragment() { fileDetailsViewModel.updateActionInDetailsView(SYNC_AND_OPEN_WITH) } else { // Already downloaded -> Open it requireActivity().openOCFile(safeFile.file) + fileOperationsViewModel.setLastUsageFile(safeFile.file) } true } diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt index aa996518464..c0126845de2 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt @@ -525,6 +525,7 @@ class MainFileListFragment : Fragment(), itemIcon = ResourcesCompat.getDrawable(resources, R.drawable.ic_open_in_web, null) setOnClickListener { mainFileListViewModel.openInWeb(file.remoteId!!, appRegistryProvider.name) + fileOperationsViewModel.setLastUsageFile(file) } } fileOptionsBottomSheetSingleFileLayout!!.addView(appProviderItemView, 1) diff --git a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt index 09281d59b5b..10365cf30d7 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.kt @@ -899,6 +899,7 @@ class FileDisplayActivity : FileActivity(), override fun openFile(file: OCFile) { if (file.isAvailableLocally) { fileOperationsHelper.openFile(file) + fileOperationsViewModel.setLastUsageFile(file) } else { startDownloadForOpening(file) }