some code style edits
This commit is contained in:
parent
accf45bc83
commit
47d111c642
2 changed files with 8 additions and 20 deletions
|
@ -60,17 +60,11 @@ class MediaAdapter(private val context: Context, private val media: MutableList<
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCount(): Int {
|
override fun getCount() = media.size
|
||||||
return media.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItem(position: Int): Any {
|
override fun getItem(position: Int) = media[position]
|
||||||
return media[position]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemId(position: Int): Long {
|
override fun getItemId(position: Int) = 0L
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateItems(newPhotos: List<Medium>) {
|
fun updateItems(newPhotos: List<Medium>) {
|
||||||
media.clear()
|
media.clear()
|
||||||
|
|
|
@ -19,9 +19,7 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
|
||||||
mFragments = SparseArray<ViewPagerFragment>()
|
mFragments = SparseArray<ViewPagerFragment>()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCount(): Int {
|
override fun getCount() = media.size
|
||||||
return media.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItem(position: Int): Fragment {
|
override fun getItem(position: Int): Fragment {
|
||||||
val medium = media[position]
|
val medium = media[position]
|
||||||
|
@ -46,17 +44,13 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateUiVisibility(isFullscreen: Boolean, pos: Int) {
|
fun updateUiVisibility(isFullscreen: Boolean, pos: Int) {
|
||||||
for (i in -1..1) {
|
(-1..1).map { mFragments[pos + it] }
|
||||||
val fragment = mFragments[pos + i]
|
.forEach { it?.systemUiVisibilityChanged(isFullscreen) }
|
||||||
fragment?.systemUiVisibilityChanged(isFullscreen)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems(pos: Int) {
|
fun updateItems(pos: Int) {
|
||||||
for (i in -1..1) {
|
(-1..1).map { mFragments[pos + it] }
|
||||||
val fragment = mFragments[pos + i]
|
.forEach { it?.updateItem() }
|
||||||
fragment?.updateItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems(newPaths: List<Medium>) {
|
fun updateItems(newPaths: List<Medium>) {
|
||||||
|
|
Loading…
Reference in a new issue