some code style edits

This commit is contained in:
tibbi 2016-11-17 19:47:54 +01:00
parent accf45bc83
commit 47d111c642
2 changed files with 8 additions and 20 deletions

View file

@ -60,17 +60,11 @@ class MediaAdapter(private val context: Context, private val media: MutableList<
notifyDataSetChanged()
}
override fun getCount(): Int {
return media.size
}
override fun getCount() = media.size
override fun getItem(position: Int): Any {
return media[position]
}
override fun getItem(position: Int) = media[position]
override fun getItemId(position: Int): Long {
return 0
}
override fun getItemId(position: Int) = 0L
fun updateItems(newPhotos: List<Medium>) {
media.clear()

View file

@ -19,9 +19,7 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
mFragments = SparseArray<ViewPagerFragment>()
}
override fun getCount(): Int {
return media.size
}
override fun getCount() = media.size
override fun getItem(position: Int): Fragment {
val medium = media[position]
@ -46,17 +44,13 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
}
fun updateUiVisibility(isFullscreen: Boolean, pos: Int) {
for (i in -1..1) {
val fragment = mFragments[pos + i]
fragment?.systemUiVisibilityChanged(isFullscreen)
}
(-1..1).map { mFragments[pos + it] }
.forEach { it?.systemUiVisibilityChanged(isFullscreen) }
}
fun updateItems(pos: Int) {
for (i in -1..1) {
val fragment = mFragments[pos + i]
fragment?.updateItem()
}
(-1..1).map { mFragments[pos + it] }
.forEach { it?.updateItem() }
}
fun updateItems(newPaths: List<Medium>) {