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_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)) {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) ?: ""
|
||||
}
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
<?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:id="@+id/directories_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/directories_holder"
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/directories_switch_searching"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:text="@string/switch_to_file_search"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/directories_switch_searching"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:text="@string/switch_to_file_search"
|
||||
android:visibility="gone" />
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/directories_empty_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/directories_switch_searching"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/no_media_with_filters"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/directories_empty_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/directories_switch_searching"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/no_media_with_filters"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone" />
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/directories_empty_placeholder_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/directories_empty_placeholder"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:text="@string/change_filters_underlined"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/directories_empty_placeholder_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/directories_empty_placeholder"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:text="@string/change_filters_underlined"
|
||||
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>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in a new issue