animate column count changes

This commit is contained in:
tibbi 2021-01-16 23:47:02 +01:00
parent 8a13e32f84
commit ce6e3315c0
3 changed files with 8 additions and 6 deletions

View file

@ -761,9 +761,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private fun columnCountChanged() {
invalidateOptionsMenu()
directories_grid.adapter?.notifyDataSetChanged()
getRecyclerAdapter()?.dirs?.apply {
measureRecyclerViewContent(this)
getRecyclerAdapter()?.apply {
notifyItemRangeChanged(0, dirs.size)
measureRecyclerViewContent(dirs)
}
}

View file

@ -774,8 +774,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
private fun columnCountChanged() {
invalidateOptionsMenu()
media_grid.adapter?.notifyDataSetChanged()
measureRecyclerViewContent(mMedia)
getMediaAdapter()?.apply {
notifyItemRangeChanged(0, media.size)
measureRecyclerViewContent(media)
}
}
private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false)

View file

@ -35,7 +35,7 @@ import kotlinx.android.synthetic.main.photo_video_item_grid.view.*
import kotlinx.android.synthetic.main.thumbnail_section.view.*
import java.util.*
class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<ThumbnailItem>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailItem>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
val allowMultiplePicks: Boolean, val path: String, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) :
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {