Improves Scroll Jitter
This commit is contained in:
@@ -1,19 +1,17 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 2,
|
||||||
"artifactType": {
|
"artifactType": {
|
||||||
"type": "APK",
|
"type": "APK",
|
||||||
"kind": "Directory"
|
"kind": "Directory"
|
||||||
},
|
},
|
||||||
"applicationId": "xyz.quaver.pupil",
|
"applicationId": "xyz.quaver.pupil",
|
||||||
"variantName": "release",
|
"variantName": "processReleaseResources",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"properties": [],
|
|
||||||
"versionCode": 63,
|
"versionCode": 63,
|
||||||
"versionName": "5.1.4-hotfix1",
|
"versionName": "5.1.5",
|
||||||
"enabled": true,
|
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package xyz.quaver.pupil.adapters
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.util.Log
|
||||||
import android.util.SparseBooleanArray
|
import android.util.SparseBooleanArray
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -229,6 +230,8 @@ class GalleryBlockAdapter(private val galleries: List<Int>) : RecyclerSwipeAdapt
|
|||||||
}
|
}
|
||||||
|
|
||||||
tags.clear()
|
tags.clear()
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
tags.addAll(
|
tags.addAll(
|
||||||
galleryBlock.relatedTags.sortedBy {
|
galleryBlock.relatedTags.sortedBy {
|
||||||
val tag = Tag.parse(it)
|
val tag = Tag.parse(it)
|
||||||
@@ -246,8 +249,11 @@ class GalleryBlockAdapter(private val galleries: List<Int>) : RecyclerSwipeAdapt
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
galleryblock_id.text = galleryBlock.id.toString()
|
galleryblock_id.text = galleryBlock.id.toString()
|
||||||
galleryblock_pagecount.text = "-"
|
galleryblock_pagecount.text = "-"
|
||||||
|
|||||||
@@ -21,8 +21,13 @@ package xyz.quaver.pupil.ui.view
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.TypedArray
|
import android.content.res.TypedArray
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.util.Log
|
||||||
import com.google.android.material.chip.Chip
|
import com.google.android.material.chip.Chip
|
||||||
import com.google.android.material.chip.ChipGroup
|
import com.google.android.material.chip.ChipGroup
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import xyz.quaver.pupil.R
|
import xyz.quaver.pupil.R
|
||||||
import xyz.quaver.pupil.types.Tag
|
import xyz.quaver.pupil.types.Tag
|
||||||
import xyz.quaver.pupil.types.Tags
|
import xyz.quaver.pupil.types.Tags
|
||||||
@@ -69,17 +74,23 @@ class TagChipGroup @JvmOverloads constructor(context: Context, attr: AttributeSe
|
|||||||
fun refresh() {
|
fun refresh() {
|
||||||
this.removeAllViews()
|
this.removeAllViews()
|
||||||
|
|
||||||
tags.take(maxChipSize).forEach {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
this.addView(TagChip(context, it).apply {
|
tags.take(maxChipSize).map {
|
||||||
|
CoroutineScope(Dispatchers.Default).async {
|
||||||
|
TagChip(context, it).apply {
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
onClickListener?.invoke(this.tag)
|
onClickListener?.invoke(this.tag)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
}.forEach {
|
||||||
|
addView(it.await())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxChipSize > 0 && this.size > maxChipSize)
|
if (maxChipSize > 0 && tags.size > maxChipSize && parent == null)
|
||||||
addView(moreView)
|
addView(moreView)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
applyAttributes(context.obtainStyledAttributes(attr, R.styleable.TagChipGroup))
|
applyAttributes(context.obtainStyledAttributes(attr, R.styleable.TagChipGroup))
|
||||||
|
|||||||
Reference in New Issue
Block a user