mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
parent
39b860f4c8
commit
c175219bb9
1 changed files with 3 additions and 3 deletions
|
@ -43,8 +43,8 @@ class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: Att
|
|||
|
||||
val itemWidth: Int
|
||||
get() {
|
||||
return if (spanCount == 0) measuredWidth / getTempSpan()
|
||||
else measuredWidth / managerSpanCount
|
||||
return if (width == 0) measuredWidth / getTempSpan()
|
||||
else width / managerSpanCount
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -61,7 +61,7 @@ class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: Att
|
|||
}
|
||||
|
||||
private fun getTempSpan(): Int {
|
||||
if (spanCount == 0 && columnWidth > 0) {
|
||||
if (columnWidth > 0) {
|
||||
val dpWidth = (measuredWidth.toFloat().pxToDp / 100f).roundToInt()
|
||||
return max(1, (dpWidth / columnWidth).roundToInt())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue