diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 1cac18206..6e9ddcddf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -65,6 +65,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mCurrAsyncTask: GetMediaAsynctask? = null private var mZoomListener: MyRecyclerView.MyZoomListener? = null private var mSearchMenuItem: MenuItem? = null + private var mMedia = ArrayList() private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true @@ -74,7 +75,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mStoredPrimaryColor = 0 companion object { - var mMedia = ArrayList() + var mGroupedMedia = ArrayList() // basically mMedia items reordered depending on the grouping } override fun onCreate(savedInstanceState: Bundle?) { @@ -316,7 +317,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { return } + mGroupedMedia.clear() val groupedMedia = MediaFetcher(applicationContext).groupMedia(mMedia.clone() as ArrayList, mPath) + groupedMedia.filter { it is ThumbnailMedium }.forEach { + it as ThumbnailMedium + val medium = Medium(0L, it.name, it.path, it.parentPath, it.modified, it.taken, it.size, it.type, it.isFavorite) + mGroupedMedia.add(medium) + } + val currAdapter = media_grid.adapter if (currAdapter == null) { initZoomListener() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 4e0fadde2..c0fa82e95 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -84,7 +84,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_medium) - mMediaFiles = MediaActivity.mMedia.clone() as ArrayList + mMediaFiles = MediaActivity.mGroupedMedia.clone() as ArrayList + mIsShowingFavorites = intent.getBooleanExtra(SHOW_FAVORITES, false) handlePermission(PERMISSION_WRITE_STORAGE) {