mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
adding bubble at folders fastscroller
This commit is contained in:
parent
53eafb30c6
commit
45fe153d54
4 changed files with 61 additions and 53 deletions
|
@ -197,6 +197,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
|
|
||||||
directories_fastscroller.updateColors(adjustedPrimaryColor)
|
directories_fastscroller.updateColors(adjustedPrimaryColor)
|
||||||
directories_refresh_layout.isEnabled = config.enablePullToRefresh
|
directories_refresh_layout.isEnabled = config.enablePullToRefresh
|
||||||
|
getRecyclerAdapter()?.apply {
|
||||||
|
dateFormat = config.dateFormat
|
||||||
|
timeFormat = getTimeFormat()
|
||||||
|
}
|
||||||
|
|
||||||
directories_empty_placeholder.setTextColor(config.textColor)
|
directories_empty_placeholder.setTextColor(config.textColor)
|
||||||
directories_empty_placeholder_2.setTextColor(adjustedPrimaryColor)
|
directories_empty_placeholder_2.setTextColor(adjustedPrimaryColor)
|
||||||
|
@ -491,6 +495,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
gotDirectories(getCurrentlyDisplayedDirs())
|
gotDirectories(getCurrentlyDisplayedDirs())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRecyclerAdapter()?.directorySorting = config.directorySorting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +631,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupGridLayoutManager() {
|
private fun setupGridLayoutManager() {
|
||||||
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
/*val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
||||||
(directories_grid.layoutParams as RelativeLayout.LayoutParams).apply {
|
(directories_grid.layoutParams as RelativeLayout.LayoutParams).apply {
|
||||||
topMargin = 0
|
topMargin = 0
|
||||||
bottomMargin = 0
|
bottomMargin = 0
|
||||||
|
@ -639,11 +645,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutManager.spanCount = config.dirColumnCnt
|
layoutManager.spanCount = config.dirColumnCnt*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListLayoutManager() {
|
private fun setupListLayoutManager() {
|
||||||
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
/*val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
||||||
layoutManager.spanCount = 1
|
layoutManager.spanCount = 1
|
||||||
layoutManager.orientation = RecyclerView.VERTICAL
|
layoutManager.orientation = RecyclerView.VERTICAL
|
||||||
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
@ -654,7 +660,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
bottomMargin = smallMargin
|
bottomMargin = smallMargin
|
||||||
}
|
}
|
||||||
|
|
||||||
mZoomListener = null
|
mZoomListener = null*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun measureRecyclerViewContent(directories: ArrayList<Directory>) {
|
private fun measureRecyclerViewContent(directories: ArrayList<Directory>) {
|
||||||
|
@ -1346,10 +1352,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
|
|
||||||
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
||||||
|
|
||||||
private fun getBubbleTextItem(index: Int) =
|
|
||||||
getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this, mDateFormat, mTimeFormat)
|
|
||||||
?: ""
|
|
||||||
|
|
||||||
private fun setupLatestMediaId() {
|
private fun setupLatestMediaId() {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
if (hasPermission(PERMISSION_READ_STORAGE)) {
|
if (hasPermission(PERMISSION_READ_STORAGE)) {
|
||||||
|
|
|
@ -769,7 +769,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
val spacing = config.thumbnailSpacing
|
val spacing = config.thumbnailSpacing
|
||||||
val useGridPosition = media.firstOrNull() is ThumbnailSection
|
val useGridPosition = media.firstOrNull() is ThumbnailSection
|
||||||
|
|
||||||
var currentGridDecoration: GridSpacingItemDecoration? = null
|
/*var currentGridDecoration: GridSpacingItemDecoration? = null
|
||||||
if (media_grid.itemDecorationCount > 0) {
|
if (media_grid.itemDecorationCount > 0) {
|
||||||
currentGridDecoration = media_grid.getItemDecorationAt(0) as GridSpacingItemDecoration
|
currentGridDecoration = media_grid.getItemDecorationAt(0) as GridSpacingItemDecoration
|
||||||
currentGridDecoration.items = media
|
currentGridDecoration.items = media
|
||||||
|
@ -781,7 +781,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
media_grid.removeItemDecoration(currentGridDecoration)
|
media_grid.removeItemDecoration(currentGridDecoration)
|
||||||
}
|
}
|
||||||
media_grid.addItemDecoration(newGridDecoration)
|
media_grid.addItemDecoration(newGridDecoration)
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
|
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.dialogs.*
|
import com.simplemobiletools.commons.dialogs.*
|
||||||
|
@ -57,7 +58,7 @@ class DirectoryAdapter(
|
||||||
activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
|
activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
|
||||||
val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, itemClick: (Any) -> Unit
|
val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, itemClick: (Any) -> Unit
|
||||||
) :
|
) :
|
||||||
MyRecyclerViewAdapter(activity, recyclerView, itemClick), ItemTouchHelperContract {
|
MyRecyclerViewAdapter(activity, recyclerView, itemClick), ItemTouchHelperContract, RecyclerViewFastScroller.OnPopupTextUpdate {
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST
|
private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST
|
||||||
|
@ -74,6 +75,9 @@ class DirectoryAdapter(
|
||||||
private var showMediaCount = config.showFolderMediaCount
|
private var showMediaCount = config.showFolderMediaCount
|
||||||
private var folderStyle = config.folderStyle
|
private var folderStyle = config.folderStyle
|
||||||
private var limitFolderTitle = config.limitFolderTitle
|
private var limitFolderTitle = config.limitFolderTitle
|
||||||
|
var directorySorting = config.directorySorting
|
||||||
|
var dateFormat = config.dateFormat
|
||||||
|
var timeFormat = activity.getTimeFormat()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setupDragListener(true)
|
setupDragListener(true)
|
||||||
|
@ -879,4 +883,6 @@ class DirectoryAdapter(
|
||||||
override fun onRowClear(myViewHolder: ViewHolder?) {
|
override fun onRowClear(myViewHolder: ViewHolder?) {
|
||||||
swipeRefreshLayout?.isEnabled = activity.config.enablePullToRefresh
|
swipeRefreshLayout?.isEnabled = activity.config.enablePullToRefresh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onChange(position: Int) = dirs.getOrNull(position)?.getBubbleText(directorySorting, activity, dateFormat, timeFormat) ?: ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/directories_refresh_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/directories_holder"
|
android:id="@+id/directories_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
@ -47,11 +42,16 @@
|
||||||
android:textSize="@dimen/bigger_text_size"
|
android:textSize="@dimen/bigger_text_size"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/directories_refresh_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/directories_switch_searching">
|
||||||
|
|
||||||
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
||||||
android:id="@+id/directories_fastscroller"
|
android:id="@+id/directories_fastscroller"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/directories_switch_searching"
|
|
||||||
app:supportSwipeToRefresh="true">
|
app:supportSwipeToRefresh="true">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
|
@ -65,5 +65,5 @@
|
||||||
app:spanCount="@integer/directory_columns_vertical_scroll" />
|
app:spanCount="@integer/directory_columns_vertical_scroll" />
|
||||||
|
|
||||||
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
|
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
|
||||||
</RelativeLayout>
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
Loading…
Reference in a new issue