Skip to content

Commit 5ea9f80

Browse files
committed
[1.7.0-feature] 仿chatgpt交互
1 parent 60e3438 commit 5ea9f80

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

app/src/main/kotlin/org/ninetripods/mq/study/chatgpt/viewholder/ChatReplyTxHolder.kt

+16-12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import org.ninetripods.mq.study.R
66
import org.ninetripods.mq.study.base.adapter.BaseVHolder
77
import org.ninetripods.mq.study.chatgpt.MessageModel
88
import org.ninetripods.mq.study.chatgpt.widget.ChatAutoFillView
9+
import org.ninetripods.mq.study.chatgpt.widget.SegModel
910
import org.ninetripods.mq.study.kotlin.ktx.log
1011

1112
/**
@@ -22,17 +23,20 @@ class ChatReplyTxHolder(
2223

2324
override fun onBindView(item: MessageModel, position: Int) {
2425
log("position:$position, item:${item.content}")
25-
//TODO 打字机效果待优化
26-
// answerText.setEndCallback {
27-
// isDrawEnd = true
28-
// }
29-
// answerText.reset()
30-
// answerText.fillText(
31-
// income = SegModel(item.content, true),
32-
// autoFillAnim = item.autoFillAnim && !isDrawEnd,
33-
// type = ChatAutoFillView.TYPE_MARKDOWN
34-
// )
35-
answerText.stop()
36-
answerText.text = item.content
26+
//TODO 打字机效果待优化 如打字机效果正在展示时,此时进行上下滑动
27+
if (isDrawEnd) {
28+
answerText.stop()
29+
answerText.text = item.content
30+
} else {
31+
answerText.setEndCallback {
32+
isDrawEnd = true
33+
}
34+
answerText.reset()
35+
answerText.fillText(
36+
income = SegModel(item.content, true),
37+
autoFillAnim = item.autoFillAnim && !isDrawEnd,
38+
type = ChatAutoFillView.TYPE_MARKDOWN
39+
)
40+
}
3741
}
3842
}

0 commit comments

Comments
 (0)