More core-ktx usages
This commit is contained in:
@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.view.forEach
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
|
||||
/**
|
||||
@@ -14,13 +15,11 @@ class MaxHeightViewPager(context: Context, attrs: AttributeSet?) : ViewPager(con
|
||||
var measuredHeight = heightMeasureSpec
|
||||
|
||||
var height = 0
|
||||
for (i in 0 until childCount) {
|
||||
val child = getChildAt(i)
|
||||
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED))
|
||||
val h = child.measuredHeight
|
||||
forEach {
|
||||
it.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED))
|
||||
val h = it.measuredHeight
|
||||
if (h > height) height = h
|
||||
}
|
||||
|
||||
if (height != 0) {
|
||||
measuredHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user