mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-12-03 17:57:59 +01:00
fix #480, make sure drag selection is always available
This commit is contained in:
parent
dbb1eee9c7
commit
7f596a3993
2 changed files with 51 additions and 34 deletions
|
@ -342,11 +342,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
} else {
|
||||
setupListLayoutManager()
|
||||
}
|
||||
|
||||
getDirectoryAdapter()?.apply {
|
||||
setupZoomListener(mZoomListener)
|
||||
setupDragListener(true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupGridLayoutManager() {
|
||||
|
@ -360,20 +355,28 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
|
||||
layoutManager.spanCount = config.dirColumnCnt
|
||||
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
||||
override fun zoomIn() {
|
||||
if (layoutManager.spanCount > 1) {
|
||||
reduceColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun zoomOut() {
|
||||
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
||||
increaseColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
private fun initZoomListener() {
|
||||
if (config.viewTypeFolders == VIEW_TYPE_GRID) {
|
||||
val layoutManager = directories_grid.layoutManager as GridLayoutManager
|
||||
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
||||
override fun zoomIn() {
|
||||
if (layoutManager.spanCount > 1) {
|
||||
reduceColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
}
|
||||
}
|
||||
|
||||
override fun zoomOut() {
|
||||
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
||||
increaseColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mZoomListener = null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,12 +557,18 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
private fun setupAdapter() {
|
||||
val currAdapter = directories_grid.adapter
|
||||
if (currAdapter == null) {
|
||||
directories_grid.adapter = DirectoryAdapter(this, mDirs, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent)) {
|
||||
initZoomListener()
|
||||
DirectoryAdapter(this, mDirs, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent)) {
|
||||
itemClicked((it as Directory).path)
|
||||
}.apply {
|
||||
setupZoomListener(mZoomListener)
|
||||
setupDragListener(true)
|
||||
directories_grid.adapter = this
|
||||
}
|
||||
} else {
|
||||
(currAdapter as DirectoryAdapter).updateDirs(mDirs)
|
||||
}
|
||||
|
||||
setupScrollDirection()
|
||||
}
|
||||
|
||||
|
|
|
@ -176,8 +176,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
|
||||
val currAdapter = media_grid.adapter
|
||||
if (currAdapter == null) {
|
||||
media_grid.adapter = MediaAdapter(this, mMedia, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, mAllowPickingMultiple, media_grid) {
|
||||
initZoomListener()
|
||||
MediaAdapter(this, mMedia, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, mAllowPickingMultiple, media_grid) {
|
||||
itemClicked((it as Medium).path)
|
||||
}.apply {
|
||||
setupZoomListener(mZoomListener)
|
||||
setupDragListener(true)
|
||||
media_grid.adapter = this
|
||||
}
|
||||
} else {
|
||||
(currAdapter as MediaAdapter).updateMedia(mMedia)
|
||||
|
@ -402,11 +407,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
} else {
|
||||
setupListLayoutManager()
|
||||
}
|
||||
|
||||
getMediaAdapter()?.apply {
|
||||
setupZoomListener(mZoomListener)
|
||||
setupDragListener(true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupGridLayoutManager() {
|
||||
|
@ -420,20 +420,28 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
}
|
||||
|
||||
layoutManager.spanCount = config.mediaColumnCnt
|
||||
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
||||
override fun zoomIn() {
|
||||
if (layoutManager.spanCount > 1) {
|
||||
reduceColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun zoomOut() {
|
||||
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
||||
increaseColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
private fun initZoomListener() {
|
||||
if (config.viewTypeFiles == VIEW_TYPE_GRID) {
|
||||
val layoutManager = media_grid.layoutManager as GridLayoutManager
|
||||
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
||||
override fun zoomIn() {
|
||||
if (layoutManager.spanCount > 1) {
|
||||
reduceColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
}
|
||||
}
|
||||
|
||||
override fun zoomOut() {
|
||||
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
||||
increaseColumnCount()
|
||||
getRecyclerAdapter().finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mZoomListener = null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue