File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
inputview/src/main/kotlin/com/xiaocydx/inputview Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -144,13 +144,13 @@ internal class EditTextManager(
144144 }
145145
146146 /* *
147- * 在实际场景中,交互可能是先选中[EditText]的文本内容,再点击其它地方切换[Editor],
148- * 当动画开始时,隐藏左右水滴状指示器,避免动画运行时不断跨进程通信,进而造成卡顿。
147+ * 当动画开始时,隐藏水滴状指示器,避免动画运行时不断跨进程通信,进而造成卡顿。
148+ * 在实际场景中,交互可能是先选中[EditText]的内容,再点击其它地方切换[Editor],
149+ * 或者调用[EditorAnimator.requestSimpleAnimation]请求运行动画。
149150 */
150151 private inner class HideTextSelectHandleOnStart : ReplicableAnimationCallback {
151- override fun onAnimationStart (state : AnimationState ) = forEach { handle ->
152- handle.takeIf { it.hasTextSelectHandleLeftRight() }
153- ?.hideTextSelectHandle(keepFocus = state.isIme(state.current))
152+ override fun onAnimationStart (state : AnimationState ) = forEach {
153+ it.hideTextSelectHandle(keepFocus = state.isIme(state.current))
154154 }
155155 }
156156
Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ abstract class EditorAnimator(
145145 }
146146
147147 internal fun requestSimpleAnimation () {
148+ // 构建的record缺少startView和endView,不开放此函数
148149 runSimpleAnimationOnPreDraw(fromRequest = true )
149150 }
150151
@@ -156,9 +157,10 @@ abstract class EditorAnimator(
156157 }
157158
158159 private fun runSimpleAnimationOnPreDraw (fromRequest : Boolean ) {
159- if (host?.hasPendingChange() == true ) return
160- val current = host?.current ? : return
161- val record = AnimationRecord (current, current, fromRequest = fromRequest)
160+ val host = host
161+ if (host == null || host.hasPendingChange()) return
162+ // host.current = null仍然运行动画,支持需要动画调度的场景
163+ val record = AnimationRecord (host.current, host.current, fromRequest = fromRequest)
162164 resetAnimationRecord(record)
163165 record.setAnimationStartOffset()
164166 record.setPreDrawRunSimpleAnimation {
You can’t perform that action at this time.
0 commit comments