diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/ActionBuilder.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/ActionBuilder.kt new file mode 100644 index 000000000..205d378c8 --- /dev/null +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/ActionBuilder.kt @@ -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) + } + }) +} diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/GalleryCommentsFragment.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/GalleryCommentsFragment.kt index 2f3f5726b..0781a953d 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/GalleryCommentsFragment.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/scene/GalleryCommentsFragment.kt @@ -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,