From cd73d6eb89a29386562e69ea9b243d4748ca3c7e Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Mon, 9 Dec 2024 12:51:13 +0530 Subject: [PATCH 1/4] Moved `free space` to IO thread. --- app/build.gradle.kts | 1 + .../library/CopyMoveFileHandler.kt | 18 ++- .../library/LocalLibraryFragment.kt | 123 +++++++++--------- .../localLibrary/CopyMoveFileHandlerTest.kt | 22 ++-- .../core/extensions/FileExtensions.kt | 7 +- .../SetPreferredStorageWithMostSpace.kt | 2 +- 6 files changed, 86 insertions(+), 87 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3ce7bbb88..e59ec060b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -106,6 +106,7 @@ androidComponents { } dependencies { + implementation(Libs.kotlinx_coroutines_rx3) androidTestImplementation(Libs.leakcanary_android_instrumentation) testImplementation(Libs.kotlinx_coroutines_test) } diff --git a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/CopyMoveFileHandler.kt b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/CopyMoveFileHandler.kt index fd990f04c..9ba5df0a4 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/CopyMoveFileHandler.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/CopyMoveFileHandler.kt @@ -208,7 +208,7 @@ class CopyMoveFileHandler @Inject constructor( } } - fun handleDetectingFileSystemState() { + suspend fun handleDetectingFileSystemState() { if (isBookLessThan4GB()) { performCopyMoveOperationIfSufficientSpaceAvailable() } else { @@ -217,7 +217,7 @@ class CopyMoveFileHandler @Inject constructor( } } - fun handleCannotWrite4GbFileState() { + suspend fun handleCannotWrite4GbFileState() { if (isBookLessThan4GB()) { performCopyMoveOperationIfSufficientSpaceAvailable() } else { @@ -240,14 +240,12 @@ class CopyMoveFileHandler @Inject constructor( } } - fun performCopyMoveOperationIfSufficientSpaceAvailable() { - lifecycleScope?.launch { - val availableSpace = storageCalculator.availableBytes(File(sharedPreferenceUtil.prefStorage)) - if (hasNotSufficientStorageSpace(availableSpace)) { - fileCopyMoveCallback?.insufficientSpaceInStorage(availableSpace) - } else { - performCopyMoveOperation() - } + suspend fun performCopyMoveOperationIfSufficientSpaceAvailable() { + val availableSpace = storageCalculator.availableBytes(File(sharedPreferenceUtil.prefStorage)) + if (hasNotSufficientStorageSpace(availableSpace)) { + fileCopyMoveCallback?.insufficientSpaceInStorage(availableSpace) + } else { + performCopyMoveOperation() } } diff --git a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt index f2e8abbbc..c182e6ffe 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt @@ -244,69 +244,72 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal ) } + @Suppress("LongMethod") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - setUpSwipeRefreshLayout() - copyMoveFileHandler?.apply { - setFileCopyMoveCallback(this@LocalLibraryFragment) - setLifeCycleScope(lifecycleScope) - } - fragmentDestinationLibraryBinding?.zimfilelist?.run { - adapter = booksOnDiskAdapter - layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false) - setHasFixedSize(true) - visibility = GONE - } - zimManageViewModel.fileSelectListStates.observe(viewLifecycleOwner, Observer(::render)) - .also { - coreMainActivity.navHostContainer - .setBottomMarginToFragmentContainerView(0) + lifecycleScope.launch { + setUpSwipeRefreshLayout() + copyMoveFileHandler?.apply { + setFileCopyMoveCallback(this@LocalLibraryFragment) + setLifeCycleScope(lifecycleScope) + } + fragmentDestinationLibraryBinding?.zimfilelist?.run { + adapter = booksOnDiskAdapter + layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false) + setHasFixedSize(true) + visibility = GONE + } + zimManageViewModel.fileSelectListStates.observe(viewLifecycleOwner, Observer(::render)) + .also { + coreMainActivity.navHostContainer + .setBottomMarginToFragmentContainerView(0) - getBottomNavigationView()?.let { - setBottomMarginToSwipeRefreshLayout(it.measuredHeight) + getBottomNavigationView()?.let { + setBottomMarginToSwipeRefreshLayout(it.measuredHeight) + } + } + disposable.add(sideEffects()) + disposable.add(fileSelectActions()) + zimManageViewModel.deviceListScanningProgress.observe(viewLifecycleOwner) { + fragmentDestinationLibraryBinding?.scanningProgressView?.apply { + progress = it + // hide this progress bar when scanning is complete. + visibility = if (it == MAX_PROGRESS) GONE else VISIBLE + // enable if the previous scanning is completes. + fragmentDestinationLibraryBinding?.zimSwiperefresh?.isEnabled = it == MAX_PROGRESS } } - disposable.add(sideEffects()) - disposable.add(fileSelectActions()) - zimManageViewModel.deviceListScanningProgress.observe(viewLifecycleOwner) { - fragmentDestinationLibraryBinding?.scanningProgressView?.apply { - progress = it - // hide this progress bar when scanning is complete. - visibility = if (it == MAX_PROGRESS) GONE else VISIBLE - // enable if the previous scanning is completes. - fragmentDestinationLibraryBinding?.zimSwiperefresh?.isEnabled = it == MAX_PROGRESS + if (savedInstanceState != null && savedInstanceState.getBoolean(WAS_IN_ACTION_MODE)) { + zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode) } - } - if (savedInstanceState != null && savedInstanceState.getBoolean(WAS_IN_ACTION_MODE)) { - zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode) - } - fragmentDestinationLibraryBinding?.goToDownloadsButtonNoFiles?.setOnClickListener { - if (permissionDeniedLayoutShowing) { - permissionDeniedLayoutShowing = false - requireActivity().navigateToAppSettings() - } else { - offerAction(FileSelectActions.UserClickedDownloadBooksButton) + fragmentDestinationLibraryBinding?.goToDownloadsButtonNoFiles?.setOnClickListener { + if (permissionDeniedLayoutShowing) { + permissionDeniedLayoutShowing = false + requireActivity().navigateToAppSettings() + } else { + offerAction(FileSelectActions.UserClickedDownloadBooksButton) + } } - } - setUpFilePickerButton() + setUpFilePickerButton() - fragmentDestinationLibraryBinding?.zimfilelist?.addOnScrollListener( - SimpleRecyclerViewScrollListener { _, newState -> - when (newState) { - SCROLL_DOWN -> { - setBottomMarginToSwipeRefreshLayout(0) - } + fragmentDestinationLibraryBinding?.zimfilelist?.addOnScrollListener( + SimpleRecyclerViewScrollListener { _, newState -> + when (newState) { + SCROLL_DOWN -> { + setBottomMarginToSwipeRefreshLayout(0) + } - SCROLL_UP -> { - getBottomNavigationView()?.let { - setBottomMarginToSwipeRefreshLayout(it.measuredHeight) + SCROLL_UP -> { + getBottomNavigationView()?.let { + setBottomMarginToSwipeRefreshLayout(it.measuredHeight) + } } } } - } - ) - showCopyMoveDialogForOpenedZimFileFromStorage() + ) + showCopyMoveDialogForOpenedZimFileFromStorage() + } } private fun showCopyMoveDialogForOpenedZimFileFromStorage() { @@ -680,14 +683,16 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal private fun storeDeviceInPreferences( storageDevice: StorageDevice ) { - sharedPreferenceUtil.putPrefStorage( - sharedPreferenceUtil.getPublicDirectoryPath(storageDevice.name) - ) - sharedPreferenceUtil.putStoragePosition( - if (storageDevice.isInternal) INTERNAL_SELECT_POSITION - else EXTERNAL_SELECT_POSITION - ) - // after selecting the storage try to copy/move the zim file. - copyMoveFileHandler?.copyMoveZIMFileInSelectedStorage(storageDevice) + lifecycleScope.launch { + sharedPreferenceUtil.putPrefStorage( + sharedPreferenceUtil.getPublicDirectoryPath(storageDevice.name) + ) + sharedPreferenceUtil.putStoragePosition( + if (storageDevice.isInternal) INTERNAL_SELECT_POSITION + else EXTERNAL_SELECT_POSITION + ) + // after selecting the storage try to copy/move the zim file. + copyMoveFileHandler?.copyMoveZIMFileInSelectedStorage(storageDevice) + } } } diff --git a/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt b/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt index a8875e183..e472005f7 100644 --- a/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt +++ b/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt @@ -136,11 +136,11 @@ class CopyMoveFileHandlerTest { val result = fileHandler.validateZimFileCanCopyOrMove(storageFile) assertFalse(result) - verify { fileHandler.handleDetectingFileSystemState() } + coVerify { fileHandler.handleDetectingFileSystemState() } } @Test - fun validateZimFileCanCopyOrMoveShouldReturnFalseWhenCannotWrite4GbFile() = runBlocking { + fun validateZimFileCanCopyOrMoveShouldReturnFalseWhenCannotWrite4GbFile() = runTest { every { fileHandler.isBookLessThan4GB() } returns true every { fileHandler.showCopyMoveDialog() } just Runs every { @@ -151,23 +151,23 @@ class CopyMoveFileHandlerTest { val result = fileHandler.validateZimFileCanCopyOrMove(storageFile) assertFalse(result) - verify { fileHandler.handleCannotWrite4GbFileState() } + coVerify { fileHandler.handleCannotWrite4GbFileState() } } @Test - fun handleDetectingFileSystemStateShouldPerformCopyMoveOperationIfBookLessThan4GB() { + fun handleDetectingFileSystemStateShouldPerformCopyMoveOperationIfBookLessThan4GB() = runTest { fileHandler = spyk(fileHandler) prepareFileSystemAndFileForMockk() every { fileHandler.isBookLessThan4GB() } returns true - every { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } just Runs + coEvery { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } just Runs fileHandler.handleDetectingFileSystemState() - verify { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } + coVerify { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } } @Test - fun handleDetectingFileSystemStateShouldObserveFileSystemStateIfBookGreaterThan4GB() { + fun handleDetectingFileSystemStateShouldObserveFileSystemStateIfBookGreaterThan4GB() = runTest { fileHandler = spyk(fileHandler) prepareFileSystemAndFileForMockk(fileSystemState = DetectingFileSystem) every { fileHandler.isBookLessThan4GB() } returns false @@ -178,19 +178,19 @@ class CopyMoveFileHandlerTest { } @Test - fun handleCannotWrite4GbFileStateShouldPerformCopyMoveOperationIfBookLessThan4GB() { + fun handleCannotWrite4GbFileStateShouldPerformCopyMoveOperationIfBookLessThan4GB() = runTest { fileHandler = spyk(fileHandler) prepareFileSystemAndFileForMockk() every { fileHandler.isBookLessThan4GB() } returns true - every { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } just Runs + coEvery { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } just Runs fileHandler.handleCannotWrite4GbFileState() - verify { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } + coVerify { fileHandler.performCopyMoveOperationIfSufficientSpaceAvailable() } } @Test - fun handleCannotWrite4GbFileStateShouldCallCallbackIfBookGreaterThan4GB() { + fun handleCannotWrite4GbFileStateShouldCallCallbackIfBookGreaterThan4GB() = runTest { fileHandler = spyk(fileHandler) prepareFileSystemAndFileForMockk() every { fileHandler.isBookLessThan4GB() } returns false diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FileExtensions.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FileExtensions.kt index 8db3cd0f8..203c83e00 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FileExtensions.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/extensions/FileExtensions.kt @@ -19,17 +19,12 @@ package org.kiwix.kiwixmobile.core.extensions import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import java.io.File suspend fun File.isFileExist(): Boolean = withContext(Dispatchers.IO) { exists() } -fun File.freeSpace(): Long = runBlocking { - withContext(Dispatchers.IO) { - freeSpace - } -} +suspend fun File.freeSpace(): Long = withContext(Dispatchers.IO) { freeSpace } suspend fun File.totalSpace(): Long = withContext(Dispatchers.IO) { totalSpace } diff --git a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt index c7031a149..4924bd396 100644 --- a/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt +++ b/custom/src/main/java/org/kiwix/kiwixmobile/custom/download/effects/SetPreferredStorageWithMostSpace.kt @@ -28,7 +28,7 @@ import javax.inject.Inject class SetPreferredStorageWithMostSpace @Inject constructor( private val storageCalculator: StorageCalculator, - private val sharedPreferenceUtil: SharedPreferenceUtil + private val sharedPreferenceUtil: SharedPreferenceUtil, ) : SideEffect { override fun invokeWith(activity: AppCompatActivity) { activity.lifecycleScope.launch { From 9b64e5d815e470299e69b530c8c470f2fdb647a4 Mon Sep 17 00:00:00 2001 From: CalebK Date: Thu, 21 Nov 2024 13:45:21 +0300 Subject: [PATCH 2/4] Fixed failing test cases. --- .../localLibrary/CopyMoveFileHandlerTest.kt | 17 ++++++++--------- buildSrc/src/main/kotlin/Versions.kt | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt b/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt index e472005f7..f18c6102b 100644 --- a/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt +++ b/app/src/test/java/org/kiwix/kiwixmobile/localLibrary/CopyMoveFileHandlerTest.kt @@ -128,19 +128,18 @@ class CopyMoveFileHandlerTest { } @Test - fun validateZimFileCanCopyOrMoveShouldReturnFalseWhenDetectingFileSystem() = - runTest { - every { fileHandler.isBookLessThan4GB() } returns true - prepareFileSystemAndFileForMockk(fileSystemState = DetectingFileSystem) + fun validateZimFileCanCopyOrMoveShouldReturnFalseWhenDetectingFileSystem() = runTest { + every { fileHandler.isBookLessThan4GB() } returns true + prepareFileSystemAndFileForMockk(fileSystemState = DetectingFileSystem) - val result = fileHandler.validateZimFileCanCopyOrMove(storageFile) + val result = fileHandler.validateZimFileCanCopyOrMove(storageFile) - assertFalse(result) - coVerify { fileHandler.handleDetectingFileSystemState() } - } + assertFalse(result) + coVerify { fileHandler.handleDetectingFileSystemState() } + } @Test - fun validateZimFileCanCopyOrMoveShouldReturnFalseWhenCannotWrite4GbFile() = runTest { + fun validateZimFileCanCopyOrMoveShouldReturnFalseWhenCannotWrite4GbFile() = runBlocking { every { fileHandler.isBookLessThan4GB() } returns true every { fileHandler.showCopyMoveDialog() } just Runs every { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index aa59c8599..01ab5522e 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -42,7 +42,7 @@ object Versions { const val io_objectbox: String = "3.5.0" - const val io_mockk: String = "1.13.7" + const val io_mockk: String = "1.13.13" const val android_arch_lifecycle_extensions: String = "1.1.1" From 0be9244578fab79bbdfd8e626ad160361fb64c8a Mon Sep 17 00:00:00 2001 From: CalebK Date: Thu, 5 Dec 2024 10:51:17 +0300 Subject: [PATCH 3/4] Review fix. --- app/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e59ec060b..3ce7bbb88 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -106,7 +106,6 @@ androidComponents { } dependencies { - implementation(Libs.kotlinx_coroutines_rx3) androidTestImplementation(Libs.leakcanary_android_instrumentation) testImplementation(Libs.kotlinx_coroutines_test) } From ab1b7b19cd303b2331c62d743a97a5967907aeca Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Mon, 9 Dec 2024 12:57:47 +0530 Subject: [PATCH 4/4] Removed unused code. --- .../library/LocalLibraryFragment.kt | 123 +++++++++--------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt index c182e6ffe..4b44c8613 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt +++ b/app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt @@ -244,72 +244,69 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal ) } - @Suppress("LongMethod") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - lifecycleScope.launch { - setUpSwipeRefreshLayout() - copyMoveFileHandler?.apply { - setFileCopyMoveCallback(this@LocalLibraryFragment) - setLifeCycleScope(lifecycleScope) - } - fragmentDestinationLibraryBinding?.zimfilelist?.run { - adapter = booksOnDiskAdapter - layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false) - setHasFixedSize(true) - visibility = GONE - } - zimManageViewModel.fileSelectListStates.observe(viewLifecycleOwner, Observer(::render)) - .also { - coreMainActivity.navHostContainer - .setBottomMarginToFragmentContainerView(0) - - getBottomNavigationView()?.let { - setBottomMarginToSwipeRefreshLayout(it.measuredHeight) - } - } - disposable.add(sideEffects()) - disposable.add(fileSelectActions()) - zimManageViewModel.deviceListScanningProgress.observe(viewLifecycleOwner) { - fragmentDestinationLibraryBinding?.scanningProgressView?.apply { - progress = it - // hide this progress bar when scanning is complete. - visibility = if (it == MAX_PROGRESS) GONE else VISIBLE - // enable if the previous scanning is completes. - fragmentDestinationLibraryBinding?.zimSwiperefresh?.isEnabled = it == MAX_PROGRESS - } - } - if (savedInstanceState != null && savedInstanceState.getBoolean(WAS_IN_ACTION_MODE)) { - zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode) - } - - fragmentDestinationLibraryBinding?.goToDownloadsButtonNoFiles?.setOnClickListener { - if (permissionDeniedLayoutShowing) { - permissionDeniedLayoutShowing = false - requireActivity().navigateToAppSettings() - } else { - offerAction(FileSelectActions.UserClickedDownloadBooksButton) - } - } - setUpFilePickerButton() - - fragmentDestinationLibraryBinding?.zimfilelist?.addOnScrollListener( - SimpleRecyclerViewScrollListener { _, newState -> - when (newState) { - SCROLL_DOWN -> { - setBottomMarginToSwipeRefreshLayout(0) - } - - SCROLL_UP -> { - getBottomNavigationView()?.let { - setBottomMarginToSwipeRefreshLayout(it.measuredHeight) - } - } - } - } - ) - showCopyMoveDialogForOpenedZimFileFromStorage() + setUpSwipeRefreshLayout() + copyMoveFileHandler?.apply { + setFileCopyMoveCallback(this@LocalLibraryFragment) + setLifeCycleScope(lifecycleScope) } + fragmentDestinationLibraryBinding?.zimfilelist?.run { + adapter = booksOnDiskAdapter + layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false) + setHasFixedSize(true) + visibility = GONE + } + zimManageViewModel.fileSelectListStates.observe(viewLifecycleOwner, Observer(::render)) + .also { + coreMainActivity.navHostContainer + .setBottomMarginToFragmentContainerView(0) + + getBottomNavigationView()?.let { + setBottomMarginToSwipeRefreshLayout(it.measuredHeight) + } + } + disposable.add(sideEffects()) + disposable.add(fileSelectActions()) + zimManageViewModel.deviceListScanningProgress.observe(viewLifecycleOwner) { + fragmentDestinationLibraryBinding?.scanningProgressView?.apply { + progress = it + // hide this progress bar when scanning is complete. + visibility = if (it == MAX_PROGRESS) GONE else VISIBLE + // enable if the previous scanning is completes. + fragmentDestinationLibraryBinding?.zimSwiperefresh?.isEnabled = it == MAX_PROGRESS + } + } + if (savedInstanceState != null && savedInstanceState.getBoolean(WAS_IN_ACTION_MODE)) { + zimManageViewModel.fileSelectActions.offer(FileSelectActions.RestartActionMode) + } + + fragmentDestinationLibraryBinding?.goToDownloadsButtonNoFiles?.setOnClickListener { + if (permissionDeniedLayoutShowing) { + permissionDeniedLayoutShowing = false + requireActivity().navigateToAppSettings() + } else { + offerAction(FileSelectActions.UserClickedDownloadBooksButton) + } + } + setUpFilePickerButton() + + fragmentDestinationLibraryBinding?.zimfilelist?.addOnScrollListener( + SimpleRecyclerViewScrollListener { _, newState -> + when (newState) { + SCROLL_DOWN -> { + setBottomMarginToSwipeRefreshLayout(0) + } + + SCROLL_UP -> { + getBottomNavigationView()?.let { + setBottomMarginToSwipeRefreshLayout(it.measuredHeight) + } + } + } + } + ) + showCopyMoveDialogForOpenedZimFileFromStorage() } private fun showCopyMoveDialogForOpenedZimFileFromStorage() {