Introduce ActionBuilder
This commit is contained in:
1 parent
8c2ba051a0
commit
a771994f6f
2 files changed
+13
-12
No files matched your search
@@ -0,0 +1,13 @@
|
||||
package com.hippo.ehviewer.ui.scene
|
||||
|
||||
interface ActionScope {
|
||||
infix fun String.thenDo(that: suspend () -> Unit)
|
||||
}
|
||||
|
||||
inline fun buildAction(builder: ActionScope.() -> Unit) = buildList {
|
||||
builder(object : ActionScope {
|
||||
override fun String.thenDo(that: suspend () -> Unit) {
|
||||
add(this to that)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -106,18 +106,6 @@ import kotlinx.coroutines.launch
|
||||
import moe.tarsin.coroutines.runSuspendCatching
|
||||
import rikka.core.res.resolveColor
|
||||
|
||||
interface ActionScope {
|
||||
infix fun String.thenDo(that: suspend () -> Unit)
|
||||
}
|
||||
|
||||
inline fun buildAction(builder: ActionScope.() -> Unit) = buildList {
|
||||
builder(object : ActionScope {
|
||||
override fun String.thenDo(that: suspend () -> Unit) {
|
||||
add(this to that)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun Context.generateComment(
|
||||
textView: TextView,
|
||||
comment: GalleryComment,
|
||||
|
||||
Reference in new issue
Block a user