Improved the selection and deselection of ZIM files for deletion.

* Fixed: A memory leak in `HelpFragment` which is showing after migrating the localLibrary fragment to compose.
This commit is contained in:
MohitMaliFtechiz 2025-03-24 19:48:49 +05:30
parent 4205fc41b7
commit 00f79df953
6 changed files with 13 additions and 2 deletions

View File

@ -17,6 +17,7 @@
*/
package org.kiwix.kiwixmobile.download
import android.os.Build
import android.util.Log
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.core.content.edit
@ -158,7 +159,9 @@ class DownloadTest : BaseActivityTest() {
"Couldn't find downloaded file\n Original Exception: ${e.message}"
)
}
LeakAssertions.assertNoLeaks()
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
LeakAssertions.assertNoLeaks()
}
}
private fun getOnlineLibraryList(): List<LibraryListItem> {

View File

@ -17,6 +17,7 @@
*/
package org.kiwix.kiwixmobile.main
import android.os.Build
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.core.content.edit
import androidx.lifecycle.Lifecycle
@ -131,6 +132,8 @@ class TopLevelDestinationTest : BaseActivityTest() {
clickSupportKiwixOnSideNav()
pressBack()
}
LeakAssertions.assertNoLeaks()
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
LeakAssertions.assertNoLeaks()
}
}
}

View File

@ -563,6 +563,8 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal
// Force recomposition by first setting an empty list before assigning the updated list.
// This is necessary because modifying an object's property doesn't trigger recomposition,
// as Compose still considers the list unchanged.
updateLibraryScreenState(fileSelectListState = FileSelectListState(emptyList()))
// Update the real state for UI.
updateLibraryScreenState(
fileSelectListState = state,
noFilesViewItem = Triple(

View File

@ -133,6 +133,7 @@ class StorageSelectDialog : DialogFragment() {
override fun onDestroyView() {
super.onDestroyView()
storageSelectDialogViewBinding?.root?.removeAllViews()
storageSelectDialogViewBinding = null
}
}

View File

@ -95,6 +95,7 @@ abstract class HelpFragment : BaseFragment() {
override fun onDestroyView() {
super.onDestroyView()
fragmentHelpBinding?.root?.removeAllViews()
fragmentHelpBinding = null
}
}

View File

@ -159,6 +159,7 @@ class CustomDownloadFragment : BaseFragment(), FragmentActivityExtensions {
override fun onDestroyView() {
super.onDestroyView()
fragmentCustomDownloadBinding?.root?.removeAllViews()
fragmentCustomDownloadBinding = null
}
}