add toggling between horizontal and vertical scrolling

This commit is contained in:
tibbi 2021-11-29 21:10:29 +01:00
parent daf9834d39
commit 559469e7b8
4 changed files with 17 additions and 65 deletions

View file

@ -78,11 +78,11 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:2394310c39'
implementation 'com.github.SimpleMobileTools:Simple-Commons:eae0b416b8'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6'
implementation 'com.google.vr:sdk-panowidget:1.180.0'
implementation 'com.google.vr:sdk-videowidget:1.180.0'

View file

@ -14,7 +14,6 @@ import android.provider.MediaStore.Video
import android.view.Menu
import android.view.MenuItem
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.RelativeLayout
import android.widget.Toast
import androidx.appcompat.widget.SearchView
@ -631,7 +630,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
}
private fun setupGridLayoutManager() {
/*val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
(directories_grid.layoutParams as RelativeLayout.LayoutParams).apply {
topMargin = 0
bottomMargin = 0
@ -639,13 +638,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (config.scrollHorizontally) {
layoutManager.orientation = RecyclerView.HORIZONTAL
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
directories_refresh_layout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
} else {
layoutManager.orientation = RecyclerView.VERTICAL
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
directories_refresh_layout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
layoutManager.spanCount = config.dirColumnCnt*/
layoutManager.spanCount = config.dirColumnCnt
}
private fun setupListLayoutManager() {
@ -1285,22 +1284,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
}
private fun setupScrollDirection() {
val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID
/*directories_vertical_fastscroller.isHorizontal = false
directories_vertical_fastscroller.beGoneIf(allowHorizontalScroll)
directories_horizontal_fastscroller.isHorizontal = true
directories_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll)
if (allowHorizontalScroll) {
directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) {
directories_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it))
}
} else {
directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) {
directories_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it))
}
}*/
val scrollHorizontally = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID
directories_fastscroller.setScrollVertically(!scrollHorizontally)
}
private fun checkInvalidDirectories(dirs: ArrayList<Directory>) {

View file

@ -12,7 +12,6 @@ import android.os.Handler
import android.view.Menu
import android.view.MenuItem
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.RelativeLayout
import androidx.appcompat.widget.SearchView
import androidx.core.view.MenuItemCompat
@ -440,23 +439,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
private fun setupScrollDirection() {
val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath)
val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID
/*media_vertical_fastscroller.isHorizontal = false
media_vertical_fastscroller.beGoneIf(allowHorizontalScroll)
media_horizontal_fastscroller.isHorizontal = true
media_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll)
val sorting = config.getFolderSorting(if (mShowAll) SHOW_ALL else mPath)
if (allowHorizontalScroll) {
media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) {
media_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting))
}
} else {
media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) {
media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting))
}
}*/
val scrollHorizontally = config.scrollHorizontally && viewType == VIEW_TYPE_GRID
media_fastscroller.setScrollVertically(!scrollHorizontally)
}
private fun checkLastMediaChanged() {
@ -679,7 +663,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
}
private fun setupGridLayoutManager() {
/*val layoutManager = media_grid.layoutManager as MyGridLayoutManager
val layoutManager = media_grid.layoutManager as MyGridLayoutManager
(media_grid.layoutParams as RelativeLayout.LayoutParams).apply {
topMargin = 0
bottomMargin = 0
@ -687,10 +671,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
if (config.scrollHorizontally) {
layoutManager.orientation = RecyclerView.HORIZONTAL
media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
media_refresh_layout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
} else {
layoutManager.orientation = RecyclerView.VERTICAL
media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
media_refresh_layout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
layoutManager.spanCount = config.mediaColumnCnt
@ -703,7 +687,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
1
}
}
}*/
}
}
private fun measureRecyclerViewContent(media: ArrayList<ThumbnailItem>) {

View file

@ -26,10 +26,8 @@ import com.simplemobiletools.gallery.pro.interfaces.MediaOperationsListener
import com.simplemobiletools.gallery.pro.models.Medium
import com.simplemobiletools.gallery.pro.models.ThumbnailItem
import com.simplemobiletools.gallery.pro.models.ThumbnailSection
import kotlinx.android.synthetic.main.activity_media.*
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_search.*
import kotlinx.android.synthetic.main.activity_search.media_empty_text_placeholder
import kotlinx.android.synthetic.main.activity_search.media_grid
import java.io.File
class SearchActivity : SimpleActivity(), MediaOperationsListener {
@ -229,23 +227,8 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
private fun setupScrollDirection() {
val viewType = config.getFolderViewType(SHOW_ALL)
val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID
/*media_vertical_fastscroller.isHorizontal = false
media_vertical_fastscroller.beGoneIf(allowHorizontalScroll)
media_horizontal_fastscroller.isHorizontal = true
media_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll)
val sorting = config.getFolderSorting(SHOW_ALL)
if (allowHorizontalScroll) {
media_horizontal_fastscroller.setViews(media_grid) {
media_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting))
}
} else {
media_vertical_fastscroller.setViews(media_grid) {
media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting))
}
}*/
val scrollHorizontally = config.scrollHorizontally && viewType == VIEW_TYPE_GRID
media_fastscroller.setScrollVertically(!scrollHorizontally)
}
private fun measureRecyclerViewContent(media: ArrayList<ThumbnailItem>) {