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)
|
mIsGetAnyIntent = getBooleanExtra(GET_ANY_INTENT, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleZooming()
|
||||||
media_holder.setOnRefreshListener({ getMedia() })
|
media_holder.setOnRefreshListener({ getMedia() })
|
||||||
mPath = intent.getStringExtra(DIRECTORY)
|
mPath = intent.getStringExtra(DIRECTORY)
|
||||||
mMedia = ArrayList<Medium>()
|
mMedia = ArrayList<Medium>()
|
||||||
mShowAll = mConfig.showAll
|
mShowAll = mConfig.showAll
|
||||||
if (mShowAll)
|
if (mShowAll)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(false)
|
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() {
|
override fun onResume() {
|
||||||
|
@ -217,6 +201,25 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
false
|
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>) {
|
override fun deleteFiles(files: ArrayList<File>) {
|
||||||
files.filter { it.exists() && it.isImageVideoGif() }
|
files.filter { it.exists() && it.isImageVideoGif() }
|
||||||
.forEach {
|
.forEach {
|
||||||
|
|
Loading…
Reference in a new issue