diff --git a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftFragment.kt b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftFragment.kt index 28a05126..5c556fb5 100644 --- a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftFragment.kt +++ b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftFragment.kt @@ -13,7 +13,6 @@ import android.widget.Toast import androidx.activity.addCallback import androidx.core.content.FileProvider import androidx.core.os.bundleOf -import androidx.core.view.doOnNextLayout import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.setFragmentResult @@ -78,7 +77,7 @@ class GalleryUpliftFragment : Fragment() { .toList() as List, rootAndFav = requireArguments()[ROOT_AND_FAV_KEY] as RootAndFav, resourcesIds = requireArguments().getParcelableArray(RESOURCES_KEY)!! - .toList() as List, + .toList() as List ).apply { App.instance.appComponent.inject(this@GalleryUpliftFragment) } @@ -228,7 +227,7 @@ class GalleryUpliftFragment : Fragment() { statsStorage = statsStorage, rootAndFav = rootAndFav, index = index, - storage = storage, + storage = storage ) is GallerySideEffect.ShowInfoAlert -> showInfoAlert( @@ -305,7 +304,8 @@ class GalleryUpliftFragment : Fragment() { requireContext().startActivity(intent) } catch (e: ActivityNotFoundException) { Toast.makeText( - requireContext(), getString(R.string.no_app_found_to_open_this_file), + requireContext(), + getString(R.string.no_app_found_to_open_this_file), Toast.LENGTH_SHORT ).show() } @@ -702,7 +702,7 @@ class GalleryUpliftFragment : Fragment() { resources: List, startAt: Int, selectingEnabled: Boolean = false, - selectedResources: List = emptyList(), + selectedResources: List = emptyList() ) = GalleryUpliftFragment().apply { arguments = Bundle().apply { putParcelable(ROOT_AND_FAV_KEY, rootAndFav) diff --git a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModel.kt b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModel.kt index 7d789cdc..28e1076a 100644 --- a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModel.kt +++ b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModel.kt @@ -68,7 +68,7 @@ class GalleryUpliftViewModel( val tagsStorageRepo: TagsStorageRepo, val statsStorageRepo: StatsStorageRepo, val scoreStorageRepo: ScoreStorageRepo, - val analytics: GalleryAnalytics, + val analytics: GalleryAnalytics ) : ContainerHost, ViewModel() { private lateinit var index: ResourceIndex private lateinit var tagsStorage: TagStorage @@ -203,8 +203,8 @@ class GalleryUpliftViewModel( reduce { if (enabled) { state.copy( - selectedResources = state.selectedResources - + state.currentItem.id() + selectedResources = state.selectedResources + + state.currentItem.id() ) } else { state.copy(selectedResources = emptyList()) @@ -272,10 +272,10 @@ class GalleryUpliftViewModel( } } - fun onPageChanged(newPos: Int) = intent { - if (state.galleryItems.isEmpty()) + if (state.galleryItems.isEmpty()) { return@intent + } reduce { state.copy(currentPos = newPos) @@ -295,7 +295,8 @@ class GalleryUpliftViewModel( analytics.trackTagSelect() router.navigateTo( Screens.ResourcesScreenWithSelectedTag( - container.stateFlow.value.rootAndFav, tag + container.stateFlow.value.rootAndFav, + tag ) ) } @@ -311,7 +312,9 @@ class GalleryUpliftViewModel( } statsStorage.handleEvent( StatsEvent.TagsChanged( - id, tags, newTags + id, + tags, + newTags ) ) Timber.d( @@ -333,12 +336,11 @@ class GalleryUpliftViewModel( statsStorage = statsStorage, rootAndFav = state.rootAndFav, index = index, - storage = tagsStorage, + storage = tagsStorage ) ) } - private fun checkResourceChanges(pos: Int) = intent { if (state.galleryItems.isEmpty()) { diff --git a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModelFactory.kt b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModelFactory.kt index 4a185d4e..a682631b 100644 --- a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModelFactory.kt +++ b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/GalleryUpliftViewModelFactory.kt @@ -31,7 +31,7 @@ class GalleryUpliftViewModelFactory @AssistedInject constructor( val tagsStorageRepo: TagsStorageRepo, val statsStorageRepo: StatsStorageRepo, val scoreStorageRepo: ScoreStorageRepo, - val analytics: GalleryAnalytics, + val analytics: GalleryAnalytics ) : ViewModelProvider.Factory { override fun create(modelClass: Class): T { return GalleryUpliftViewModel( @@ -48,7 +48,7 @@ class GalleryUpliftViewModelFactory @AssistedInject constructor( tagsStorageRepo = tagsStorageRepo, statsStorageRepo = statsStorageRepo, scoreStorageRepo = scoreStorageRepo, - analytics = analytics, + analytics = analytics ) as T } @@ -59,7 +59,7 @@ class GalleryUpliftViewModelFactory @AssistedInject constructor( @Assisted selectingEnabled: Boolean, @Assisted rootAndFav: RootAndFav, @Assisted("all") resourcesIds: List, - @Assisted("selected") selectedResources: List, + @Assisted("selected") selectedResources: List ): GalleryUpliftViewModelFactory } } diff --git a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewImageViewHolderUplift.kt b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewImageViewHolderUplift.kt index d91452c4..a4b6260e 100644 --- a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewImageViewHolderUplift.kt +++ b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewImageViewHolderUplift.kt @@ -151,6 +151,7 @@ class PreviewImageViewHolderUplift( override fun onTileLoadError(e: Exception?) {} override fun onPreviewReleased() {} - }) + } + ) } } diff --git a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewsPagerUplift.kt b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewsPagerUplift.kt index 04d2ece0..28bbf238 100644 --- a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewsPagerUplift.kt +++ b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/PreviewsPagerUplift.kt @@ -26,13 +26,14 @@ import java.nio.file.Path class PreviewsPagerUplift( val lifecycleScope: CoroutineScope, val context: Context, - val viewModel: GalleryUpliftViewModel, + val viewModel: GalleryUpliftViewModel ) : RecyclerView.Adapter() { private var galleryItems = emptyList() fun dispatchUpdates(newItems: List) { - if (newItems == galleryItems) + if (newItems == galleryItems) { return + } val diff = DiffUtil.calculateDiff( ResourceDiffUtilCallback( galleryItems.map { it.resource.id }, @@ -107,8 +108,9 @@ class PreviewsPagerUplift( override fun onViewRecycled(holder: RecyclerView.ViewHolder) { super.onViewRecycled(holder) - if (holder is PreviewImageViewHolderUplift) + if (holder is PreviewImageViewHolderUplift) { holder.onRecycled() + } } private fun getGestureDetector(): GestureDetectorCompat { diff --git a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/domain/GalleryState.kt b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/domain/GalleryState.kt index 5a4eb6c1..cd51b296 100644 --- a/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/domain/GalleryState.kt +++ b/app/src/main/java/dev/arkbuilders/navigator/presentation/screen/gallery/galleryuplift/domain/GalleryState.kt @@ -70,7 +70,7 @@ sealed class GallerySideEffect { ) : GallerySideEffect() // workaround to not show checkbox select animation when we change page - data object AbortSelectAnimation: GallerySideEffect() + data object AbortSelectAnimation : GallerySideEffect() data object NotifyResourceChange : GallerySideEffect() data object NotifyCurrentItemChange : GallerySideEffect()