From 42e86347750803cbb9177aca4044914a513c8c70 Mon Sep 17 00:00:00 2001 From: MiMoHo <37556964+MiMoHo@users.noreply.github.com> Date: Fri, 3 Jul 2026 20:59:29 +0200 Subject: [PATCH] fix: refresh Files tab after decompressing ZIP from preview screen When a ZIP is opened from the Files tab, its contents are shown in DecompressActivity, which is launched via an implicit ACTION_VIEW intent rather than startActivityForResult. On successful extraction the activity only toasted and finished, so MainActivity had no way to learn that new content was written and its onResume never re-read the current directory. The extracted folder therefore only appeared after a manual swipe-to-refresh. DecompressActivity now records the extracted folder path in a plain-String companion field (no Activity reference, so no leak) and MainActivity consumes it on resume, navigating the Files tab into the freshly extracted folder. Both the write and read happen on the main thread, so no synchronization is needed. Closes #194 --- CHANGELOG.md | 2 ++ .../filemanager/activities/DecompressActivity.kt | 11 +++++++++-- .../fossify/filemanager/activities/MainActivity.kt | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd08943f..5b52cf23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - Fixed the modification of the original timestamp when decompressing folders ([#190]) +- Fixed the Files tab not refreshing after decompressing a ZIP archive from the file preview screen ([#194]) ## [1.6.1] - 2026-02-14 ### Changed @@ -130,6 +131,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#149]: https://github.com/FossifyOrg/File-Manager/issues/149 [#150]: https://github.com/FossifyOrg/File-Manager/issues/150 [#176]: https://github.com/FossifyOrg/File-Manager/issues/176 +[#194]: https://github.com/FossifyOrg/File-Manager/issues/194 [#217]: https://github.com/FossifyOrg/File-Manager/issues/217 [#224]: https://github.com/FossifyOrg/File-Manager/issues/224 [#250]: https://github.com/FossifyOrg/File-Manager/issues/250 diff --git a/app/src/main/kotlin/org/fossify/filemanager/activities/DecompressActivity.kt b/app/src/main/kotlin/org/fossify/filemanager/activities/DecompressActivity.kt index 350c9c5b..eb7ce847 100644 --- a/app/src/main/kotlin/org/fossify/filemanager/activities/DecompressActivity.kt +++ b/app/src/main/kotlin/org/fossify/filemanager/activities/DecompressActivity.kt @@ -34,6 +34,9 @@ import java.io.File class DecompressActivity : SimpleActivity() { companion object { private const val PASSWORD = "password" + + // set on successful extraction so MainActivity can open the extracted folder on resume + var extractedFolderPath: String? = null } private val binding by viewBinding(ActivityDecompressBinding::inflate) @@ -202,8 +205,12 @@ class DecompressActivity : SimpleActivity() { for ((outputFile, entry) in foldersTimestamp.asReversed()) { outputFile.setLastModified(entry) } - toast(R.string.decompression_successful) - finish() + val extractedFolder = "$destination/${filename.substringBeforeLast(".")}" + runOnUiThread { + toast(R.string.decompression_successful) + extractedFolderPath = extractedFolder + finish() + } } } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/org/fossify/filemanager/activities/MainActivity.kt b/app/src/main/kotlin/org/fossify/filemanager/activities/MainActivity.kt index 4a6e4be7..86eeb05c 100644 --- a/app/src/main/kotlin/org/fossify/filemanager/activities/MainActivity.kt +++ b/app/src/main/kotlin/org/fossify/filemanager/activities/MainActivity.kt @@ -153,6 +153,11 @@ class MainActivity : SimpleActivity() { if (binding.mainViewPager.adapter == null) { initFragments() } + + DecompressActivity.extractedFolderPath?.let { path -> + DecompressActivity.extractedFolderPath = null + openPath(path, true) + } } override fun onPause() {