voiceactors and fixed flowlayout

This commit is contained in:
LagradOst 2022-04-03 20:34:51 +02:00
parent 0c5f223acb
commit 6d97ac1b82
2 changed files with 24 additions and 6 deletions

View file

@ -343,6 +343,18 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
characters(sort: ROLE page: 1 perPage: 20) { characters(sort: ROLE page: 1 perPage: 20) {
edges { edges {
role role
voiceActors {
name {
userPreferred
full
native
}
age
image {
large
medium
}
}
node { node {
name { name {
userPreferred userPreferred

View file

@ -36,7 +36,7 @@ class FlowLayout : ViewGroup {
val childHeight = child.measuredHeight val childHeight = child.measuredHeight
//check if child can be placed in the current row, else go to next line //check if child can be placed in the current row, else go to next line
if (currentChildHookPointx + childWidth > realWidth) { if (currentChildHookPointx + childWidth > realWidth && i + 1 < childCount) {
//new line //new line
currentWidth = max(currentWidth, currentChildHookPointx) currentWidth = max(currentWidth, currentChildHookPointx)
@ -44,7 +44,8 @@ class FlowLayout : ViewGroup {
currentChildHookPointx = 0 currentChildHookPointx = 0
currentChildHookPointy += childHeight currentChildHookPointy += childHeight
} }
val nextChildHookPointx = currentChildHookPointx + childWidth + if(childWidth == 0) 0 else itemSpacing val nextChildHookPointx =
currentChildHookPointx + childWidth + if (childWidth == 0) 0 else itemSpacing
val nextChildHookPointy = currentChildHookPointy val nextChildHookPointy = currentChildHookPointy
currentHeight = max(currentHeight, currentChildHookPointy + childHeight) currentHeight = max(currentHeight, currentChildHookPointy + childHeight)
val lp = child.layoutParams as LayoutParams val lp = child.layoutParams as LayoutParams
@ -54,8 +55,10 @@ class FlowLayout : ViewGroup {
currentChildHookPointy = nextChildHookPointy currentChildHookPointy = nextChildHookPointy
} }
currentWidth = max(currentChildHookPointx, currentWidth) currentWidth = max(currentChildHookPointx, currentWidth)
setMeasuredDimension(resolveSize(currentWidth, widthMeasureSpec), setMeasuredDimension(
resolveSize(currentHeight, heightMeasureSpec)) resolveSize(currentWidth, widthMeasureSpec),
resolveSize(currentHeight, heightMeasureSpec)
)
} }
override fun onLayout(b: Boolean, left: Int, top: Int, right: Int, bottom: Int) { override fun onLayout(b: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
@ -73,7 +76,10 @@ class FlowLayout : ViewGroup {
} }
override fun generateDefaultLayoutParams(): LayoutParams { override fun generateDefaultLayoutParams(): LayoutParams {
return LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) return LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
} }
override fun generateLayoutParams(p: ViewGroup.LayoutParams): LayoutParams { override fun generateLayoutParams(p: ViewGroup.LayoutParams): LayoutParams {