minor code style update
This commit is contained in:
parent
687b8697c8
commit
615f32935c
2 changed files with 3 additions and 4 deletions
|
@ -46,10 +46,10 @@ class PortraitPhotosAdapter(val context: Context, val photos: ArrayList<String>,
|
||||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||||
fun bindView(photo: String, position: Int): View {
|
fun bindView(photo: String, position: Int): View {
|
||||||
itemView.apply {
|
itemView.apply {
|
||||||
if (position == 0 || position == photos.size - 1) {
|
portrait_photo_item_thumbnail.layoutParams.width = if (position == 0 || position == photos.size - 1) {
|
||||||
portrait_photo_item_thumbnail.layoutParams.width = sideElementWidth
|
sideElementWidth
|
||||||
} else {
|
} else {
|
||||||
portrait_photo_item_thumbnail.layoutParams.width = itemWidth
|
itemWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
portrait_photo_item_thumbnail.background = if (photo.isEmpty() || getCurrentPhoto() != photo) {
|
portrait_photo_item_thumbnail.background = if (photo.isEmpty() || getCurrentPhoto() != photo) {
|
||||||
|
|
|
@ -483,7 +483,6 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
val sideElementWidth = curWidth - screenWidth
|
val sideElementWidth = curWidth - screenWidth
|
||||||
val adapter = PortraitPhotosAdapter(context!!, paths, sideElementWidth) { position, x ->
|
val adapter = PortraitPhotosAdapter(context!!, paths, sideElementWidth) { position, x ->
|
||||||
mView.photo_portrait_stripe.smoothScrollBy((x + itemWidth / 2) - screenWidth / 2, 0)
|
mView.photo_portrait_stripe.smoothScrollBy((x + itemWidth / 2) - screenWidth / 2, 0)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mView.photo_portrait_stripe.adapter = adapter
|
mView.photo_portrait_stripe.adapter = adapter
|
||||||
|
|
Loading…
Reference in a new issue