adding bubble at folders fastscroller

This commit is contained in:
tibbi 2021-11-29 19:59:38 +01:00
parent 53eafb30c6
commit 45fe153d54
4 changed files with 61 additions and 53 deletions

View file

@ -197,6 +197,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
directories_fastscroller.updateColors(adjustedPrimaryColor)
directories_refresh_layout.isEnabled = config.enablePullToRefresh
getRecyclerAdapter()?.apply {
dateFormat = config.dateFormat
timeFormat = getTimeFormat()
}
directories_empty_placeholder.setTextColor(config.textColor)
directories_empty_placeholder_2.setTextColor(adjustedPrimaryColor)
@ -491,6 +495,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
gotDirectories(getCurrentlyDisplayedDirs())
}
}
getRecyclerAdapter()?.directorySorting = config.directorySorting
}
}
@ -625,7 +631,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,11 +645,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
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() {
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
/*val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
layoutManager.spanCount = 1
layoutManager.orientation = RecyclerView.VERTICAL
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
@ -654,7 +660,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
bottomMargin = smallMargin
}
mZoomListener = null
mZoomListener = null*/
}
private fun measureRecyclerViewContent(directories: ArrayList<Directory>) {
@ -1346,10 +1352,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
private fun getBubbleTextItem(index: Int) =
getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this, mDateFormat, mTimeFormat)
?: ""
private fun setupLatestMediaId() {
ensureBackgroundThread {
if (hasPermission(PERMISSION_READ_STORAGE)) {

View file

@ -769,7 +769,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
val spacing = config.thumbnailSpacing
val useGridPosition = media.firstOrNull() is ThumbnailSection
var currentGridDecoration: GridSpacingItemDecoration? = null
/*var currentGridDecoration: GridSpacingItemDecoration? = null
if (media_grid.itemDecorationCount > 0) {
currentGridDecoration = media_grid.getItemDecorationAt(0) as GridSpacingItemDecoration
currentGridDecoration.items = media
@ -781,7 +781,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
media_grid.removeItemDecoration(currentGridDecoration)
}
media_grid.addItemDecoration(newGridDecoration)
}
}*/
}
}

View file

@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.bumptech.glide.Glide
import com.google.gson.Gson
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.*
@ -57,7 +58,7 @@ class DirectoryAdapter(
activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
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 isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST
@ -74,6 +75,9 @@ class DirectoryAdapter(
private var showMediaCount = config.showFolderMediaCount
private var folderStyle = config.folderStyle
private var limitFolderTitle = config.limitFolderTitle
var directorySorting = config.directorySorting
var dateFormat = config.dateFormat
var timeFormat = activity.getTimeFormat()
init {
setupDragListener(true)
@ -879,4 +883,6 @@ class DirectoryAdapter(
override fun onRowClear(myViewHolder: ViewHolder?) {
swipeRefreshLayout?.isEnabled = activity.config.enablePullToRefresh
}
override fun onChange(position: Int) = dirs.getOrNull(position)?.getBubbleText(directorySorting, activity, dateFormat, timeFormat) ?: ""
}

View file

@ -1,11 +1,6 @@
<?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"
android:id="@+id/directories_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/directories_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -47,11 +42,16 @@
android:textSize="@dimen/bigger_text_size"
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
android:id="@+id/directories_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/directories_switch_searching"
app:supportSwipeToRefresh="true">
<com.simplemobiletools.commons.views.MyRecyclerView
@ -65,5 +65,5 @@
app:spanCount="@integer/directory_columns_vertical_scroll" />
</com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller>
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</RelativeLayout>