mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
fetch properly grouped and sorted items by ViewPager
This commit is contained in:
parent
698f9b0c76
commit
2decc73e39
2 changed files with 11 additions and 2 deletions
|
@ -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<Medium>()
|
||||
|
||||
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<Medium>()
|
||||
var mGroupedMedia = ArrayList<Medium>() // 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<Medium>, 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()
|
||||
|
|
|
@ -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<Medium>
|
||||
mMediaFiles = MediaActivity.mGroupedMedia.clone() as ArrayList<Medium>
|
||||
|
||||
mIsShowingFavorites = intent.getBooleanExtra(SHOW_FAVORITES, false)
|
||||
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
|
|
Loading…
Reference in a new issue