diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index fbd23fc8f..a5811a7c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -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) { @@ -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)) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 04f49d4b2..057204f94 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -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) - } + }*/ } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 1bf6f07cc..c44684d85 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -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, 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) ?: "" } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d06c0a5f7..8821e6816 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,57 +1,57 @@ - - + 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" /> - + - + - + - - + +