mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-12-04 18:28:01 +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 {
|
} else {
|
||||||
setupListLayoutManager()
|
setupListLayoutManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirectoryAdapter()?.apply {
|
|
||||||
setupZoomListener(mZoomListener)
|
|
||||||
setupDragListener(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupGridLayoutManager() {
|
private fun setupGridLayoutManager() {
|
||||||
|
@ -360,6 +355,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutManager.spanCount = config.dirColumnCnt
|
layoutManager.spanCount = config.dirColumnCnt
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initZoomListener() {
|
||||||
|
if (config.viewTypeFolders == VIEW_TYPE_GRID) {
|
||||||
|
val layoutManager = directories_grid.layoutManager as GridLayoutManager
|
||||||
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
||||||
override fun zoomIn() {
|
override fun zoomIn() {
|
||||||
if (layoutManager.spanCount > 1) {
|
if (layoutManager.spanCount > 1) {
|
||||||
|
@ -375,6 +375,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mZoomListener = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListLayoutManager() {
|
private fun setupListLayoutManager() {
|
||||||
|
@ -554,12 +557,18 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
private fun setupAdapter() {
|
private fun setupAdapter() {
|
||||||
val currAdapter = directories_grid.adapter
|
val currAdapter = directories_grid.adapter
|
||||||
if (currAdapter == null) {
|
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)
|
itemClicked((it as Directory).path)
|
||||||
|
}.apply {
|
||||||
|
setupZoomListener(mZoomListener)
|
||||||
|
setupDragListener(true)
|
||||||
|
directories_grid.adapter = this
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(currAdapter as DirectoryAdapter).updateDirs(mDirs)
|
(currAdapter as DirectoryAdapter).updateDirs(mDirs)
|
||||||
}
|
}
|
||||||
|
|
||||||
setupScrollDirection()
|
setupScrollDirection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
|
|
||||||
val currAdapter = media_grid.adapter
|
val currAdapter = media_grid.adapter
|
||||||
if (currAdapter == null) {
|
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)
|
itemClicked((it as Medium).path)
|
||||||
|
}.apply {
|
||||||
|
setupZoomListener(mZoomListener)
|
||||||
|
setupDragListener(true)
|
||||||
|
media_grid.adapter = this
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(currAdapter as MediaAdapter).updateMedia(mMedia)
|
(currAdapter as MediaAdapter).updateMedia(mMedia)
|
||||||
|
@ -402,11 +407,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
} else {
|
} else {
|
||||||
setupListLayoutManager()
|
setupListLayoutManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
getMediaAdapter()?.apply {
|
|
||||||
setupZoomListener(mZoomListener)
|
|
||||||
setupDragListener(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupGridLayoutManager() {
|
private fun setupGridLayoutManager() {
|
||||||
|
@ -420,6 +420,11 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutManager.spanCount = config.mediaColumnCnt
|
layoutManager.spanCount = config.mediaColumnCnt
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initZoomListener() {
|
||||||
|
if (config.viewTypeFiles == VIEW_TYPE_GRID) {
|
||||||
|
val layoutManager = media_grid.layoutManager as GridLayoutManager
|
||||||
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
mZoomListener = object : MyRecyclerView.MyZoomListener {
|
||||||
override fun zoomIn() {
|
override fun zoomIn() {
|
||||||
if (layoutManager.spanCount > 1) {
|
if (layoutManager.spanCount > 1) {
|
||||||
|
@ -435,6 +440,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mZoomListener = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListLayoutManager() {
|
private fun setupListLayoutManager() {
|
||||||
|
|
Loading…
Reference in a new issue