diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 36ef96b18..f94bd388b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -50,29 +50,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mIsGetAnyIntent = getBooleanExtra(GET_ANY_INTENT, false) } + handleZooming() media_holder.setOnRefreshListener({ getMedia() }) mPath = intent.getStringExtra(DIRECTORY) mMedia = ArrayList() mShowAll = mConfig.showAll if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) - - val layoutManager = media_grid.layoutManager as GridLayoutManager - MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener { - override fun zoomIn() { - if (layoutManager.spanCount > 1) { - layoutManager.spanCount-- - MediaAdapter.actMode?.finish() - } - } - - override fun zoomOut() { - if (layoutManager.spanCount < 10) { - layoutManager.spanCount++ - MediaAdapter.actMode?.finish() - } - } - } } override fun onResume() { @@ -217,6 +201,25 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { false } + private fun handleZooming() { + val layoutManager = media_grid.layoutManager as GridLayoutManager + MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener { + override fun zoomIn() { + if (layoutManager.spanCount > 1) { + layoutManager.spanCount-- + MediaAdapter.actMode?.finish() + } + } + + override fun zoomOut() { + if (layoutManager.spanCount < 10) { + layoutManager.spanCount++ + MediaAdapter.actMode?.finish() + } + } + } + } + override fun deleteFiles(files: ArrayList) { files.filter { it.exists() && it.isImageVideoGif() } .forEach {