mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-27 06:57:59 +01:00
move zoom handling into an own function
This commit is contained in:
parent
b9d5c004e0
commit
f2074a4d16
1 changed files with 20 additions and 17 deletions
|
@ -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<Medium>()
|
||||
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<File>) {
|
||||
files.filter { it.exists() && it.isImageVideoGif() }
|
||||
.forEach {
|
||||
|
|
Loading…
Reference in a new issue