Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class EnvironmentPartials {
print("Screen Size: ${AndroidEnvironment.screenWidth}x${AndroidEnvironment.screenHeight}");
}

private val throttleScope = CoroutineScope(Dispatchers.Default)
private val throttleScope = CoroutineScope(Dispatchers.Main)
internal fun throttle(toThrottle: () -> Unit, delay: Double): () -> Unit {
var job: Job? = null
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.widget.ScrollView
import java.io.Closeable
import java.lang.RuntimeException
import kotlin.contracts.ExperimentalContracts
import java.util.concurrent.CopyOnWriteArrayList

@ExperimentalUnsignedTypes
@ExperimentalContracts
Expand Down Expand Up @@ -44,7 +45,7 @@ internal class RenderPlaceholder(public var result: RenderFinishedEventArgs) : C
@ExperimentalContracts
internal class AlphaTabRenderSurface(context: Context, attributeSet: AttributeSet) :
View(context, attributeSet), View.OnScrollChangeListener {
private val _placeholders: ArrayList<RenderPlaceholder> = arrayListOf()
private val _placeholders: CopyOnWriteArrayList<RenderPlaceholder> = CopyOnWriteArrayList()
private val _resultIdToIndex: ObjectDoubleMap<String> = ObjectDoubleMap()

private var _totalWidth: Int = 0
Expand All @@ -65,11 +66,10 @@ internal class AlphaTabRenderSurface(context: Context, attributeSet: AttributeSe

public fun clearPlaceholders() {
_resultIdToIndex.clear()
val placeholder = _placeholders
for (p in placeholder) {
for (p in _placeholders) {
p.close();
}
placeholder.clear()
_placeholders.clear()
}

override fun onAttachedToWindow() {
Expand Down