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 057204f94..fcd16fc48 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 @@ -61,8 +61,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mLoadedInitialPhotos = false private var mIsSearchOpen = false private var mLastSearchedText = "" - private var mDateFormat = "" - private var mTimeFormat = "" private var mLatestMediaId = 0L private var mLatestMediaDateId = 0L private var mLastMediaHandler = Handler() @@ -125,9 +123,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { override fun onResume() { super.onResume() - mDateFormat = config.dateFormat - mTimeFormat = getTimeFormat() - if (mStoredAnimateGifs != config.animateGifs) { getMediaAdapter()?.updateAnimateGifs(config.animateGifs) } @@ -167,6 +162,11 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_fastscroller.updateColors(adjustedPrimaryColor) media_refresh_layout.isEnabled = config.enablePullToRefresh + getMediaAdapter()?.apply { + dateFormat = config.dateFormat + timeFormat = getTimeFormat() + } + media_empty_text_placeholder.setTextColor(config.textColor) media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor()) @@ -459,15 +459,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { }*/ } - private fun getBubbleTextItem(index: Int, sorting: Int): String { - var realIndex = index - val mediaAdapter = getMediaAdapter() - if (mediaAdapter?.isASectionTitle(index) == true) { - realIndex++ - } - return mediaAdapter?.getItemBubbleText(realIndex, sorting, mDateFormat, mTimeFormat) ?: "" - } - private fun checkLastMediaChanged() { if (isDestroyed || config.getFolderSorting(mPath) and SORT_BY_RANDOM != 0) { return @@ -688,7 +679,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 @@ -712,7 +703,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { 1 } } - } + }*/ } private fun measureRecyclerViewContent(media: ArrayList) { @@ -810,7 +801,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } private fun setupListLayoutManager() { - val layoutManager = media_grid.layoutManager as MyGridLayoutManager + /*val layoutManager = media_grid.layoutManager as MyGridLayoutManager layoutManager.spanCount = 1 layoutManager.orientation = RecyclerView.VERTICAL media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) @@ -821,7 +812,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { bottomMargin = smallMargin } - mZoomListener = null + mZoomListener = null*/ } private fun increaseColumnCount() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt index 905ad988c..5b6856be6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt @@ -248,15 +248,6 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { }*/ } - private fun getBubbleTextItem(index: Int, sorting: Int): String { - var realIndex = index - val mediaAdapter = getMediaAdapter() - if (mediaAdapter?.isASectionTitle(index) == true) { - realIndex++ - } - return mediaAdapter?.getItemBubbleText(realIndex, sorting, mDateFormat, mTimeFormat) ?: "" - } - private fun measureRecyclerViewContent(media: ArrayList) { media_grid.onGlobalLayout { if (config.scrollHorizontally) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 9bd5e308b..124982dd4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -12,6 +12,7 @@ import android.view.View import android.view.ViewGroup import android.widget.Toast import com.bumptech.glide.Glide +import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.PropertiesDialog @@ -43,7 +44,7 @@ class MediaAdapter( activity: BaseSimpleActivity, var media: ArrayList, val listener: MediaOperationsListener?, val isAGetIntent: Boolean, val allowMultiplePicks: Boolean, val path: String, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit ) : - MyRecyclerViewAdapter(activity, recyclerView, itemClick) { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), RecyclerViewFastScroller.OnPopupTextUpdate { private val INSTANT_LOAD_DURATION = 2000L private val IMAGE_LOAD_DELAY = 100L @@ -67,6 +68,10 @@ class MediaAdapter( private var displayFilenames = config.displayFileNames private var showFileTypes = config.showThumbnailFileTypes + var sorting = config.getFolderSorting(if (config.showAll) SHOW_ALL else path) + var dateFormat = config.dateFormat + var timeFormat = activity.getTimeFormat() + init { setupDragListener(true) enableInstantLoad() @@ -508,10 +513,6 @@ class MediaAdapter( }, INSTANT_LOAD_DURATION) } - fun getItemBubbleText(position: Int, sorting: Int, dateFormat: String, timeFormat: String): String { - return (media[position] as? Medium)?.getBubbleText(sorting, activity, dateFormat, timeFormat) ?: "" - } - private fun setupThumbnail(view: View, medium: Medium) { val isSelected = selectedKeys.contains(medium.path.hashCode()) view.apply { @@ -608,4 +609,13 @@ class MediaAdapter( thumbnail_section.setTextColor(textColor) } } + + override fun onChange(position: Int): String { + var realIndex = position + if (isASectionTitle(position)) { + realIndex++ + } + + return (media[realIndex] as? Medium)?.getBubbleText(sorting, activity, dateFormat, timeFormat) ?: "" + } } diff --git a/app/src/main/res/layout/activity_media.xml b/app/src/main/res/layout/activity_media.xml index 8532644ff..45fb409b1 100644 --- a/app/src/main/res/layout/activity_media.xml +++ b/app/src/main/res/layout/activity_media.xml @@ -1,41 +1,41 @@ - - + + + + - - - - - - + +