Browse Source

[fix]处理,键盘选择页的保存按钮遮挡列表问题。2)粘贴栏的提示文案要按照类型,显示不同的文案

hezihao 7 months ago
parent
commit
2c297f897a

+ 8 - 1
plugins/keyboard_android/android/src/main/kotlin/com/atmob/keyboard_android/component/child/impl/KeyboardSelectComponent.kt

@@ -136,15 +136,22 @@ class KeyboardSelectComponent @JvmOverloads constructor(
             getKeyboardViewModel().keyboardList.observe(getLifecycleOwner()) { newKeyboardList ->
                 mListItems.clear()
 
-                val emptyPlaceholderItemHeight = ConvertUtils.dp2px(60f - 16f)
                 // 添加空占位条目
                 mListItems.apply {
+                    val emptyPlaceholderItemHeight = ConvertUtils.dp2px(60f - 16f)
                     add(EmptyPlaceholderModel(emptyPlaceholderItemHeight))
                     add(EmptyPlaceholderModel(emptyPlaceholderItemHeight))
                     add(EmptyPlaceholderModel(emptyPlaceholderItemHeight))
                 }
                 // 添加键盘数据
                 mListItems.addAll(newKeyboardList)
+                // 添加空占位条目
+                mListItems.apply {
+                    val emptyPlaceholderItemHeight = ConvertUtils.dp2px(60f)
+                    add(EmptyPlaceholderModel(emptyPlaceholderItemHeight))
+                    add(EmptyPlaceholderModel(emptyPlaceholderItemHeight))
+                    add(EmptyPlaceholderModel(emptyPlaceholderItemHeight))
+                }
 
                 mListAdapter.notifyDataSetChanged()
             }

+ 24 - 2
plugins/keyboard_android/android/src/main/kotlin/com/atmob/keyboard_android/component/child/impl/PasteBarComponent.kt

@@ -7,6 +7,7 @@ import android.widget.TextView
 import com.atmob.keyboard_android.R
 import com.atmob.keyboard_android.component.base.BaseUIComponent
 import com.atmob.keyboard_android.component.child.IPasteBarComponent
+import com.atmob.keyboard_android.enums.HelpMode
 import com.atmob.keyboard_android.ext.click
 import com.atmob.keyboard_android.ext.setGone
 import com.atmob.keyboard_android.ext.setVisible
@@ -41,11 +42,18 @@ class PasteBarComponent @JvmOverloads constructor(
     }
 
     private fun setData() {
-        // 监听用户的剪切板复制内容
         KeyboardHolder.getKeyboardService()?.run {
+            // 监听用户的剪切板复制内容
             getKeyboardViewModel().userClipboardData.observe(getLifecycleOwner()) { userClipboardData ->
                 render(userClipboardData)
             }
+            // 监听帮助模式切换
+            getKeyboardViewModel().helpMode.observe(getLifecycleOwner()) {
+                val userClipboardData = getKeyboardViewModel().userClipboardData.value ?: ""
+                if (userClipboardData.isBlank()) {
+                    updatePasteTip()
+                }
+            }
         }
     }
 
@@ -58,7 +66,7 @@ class PasteBarComponent @JvmOverloads constructor(
         // 没有复制内容,显示前面的标识图标和提示文案,隐藏清除按钮
         if (userClipboardData.isBlank()) {
             vTipSymbol.setVisible()
-            vTip.text = context.resources.getString(R.string.paste_tip)
+            updatePasteTip()
             vClear.setGone()
         } else {
             // 有复制内容,显示用户复制的内容和清除内容图标,隐藏前面的标识图标
@@ -68,6 +76,20 @@ class PasteBarComponent @JvmOverloads constructor(
         }
     }
 
+    /**
+     * 根据帮助模式,更新提示文案
+     */
+    private fun updatePasteTip() {
+        val helpMode = KeyboardHolder.getKeyboardService()?.getKeyboardViewModel()?.helpMode?.value
+        if (HelpMode.HELP_CHAT == helpMode) {
+            // 帮聊
+            vTip.text = context.resources.getString(R.string.paste_tip)
+        } else if (HelpMode.TEACH_YOU_SAY == helpMode) {
+            // 教你说
+            vTip.text = context.resources.getString(R.string.paste_tip2)
+        }
+    }
+
     override fun getComponentInterfaceClazz(): Class<IPasteBarComponent> {
         return IPasteBarComponent::class.java
     }

+ 2 - 1
plugins/keyboard_android/android/src/main/res/values/string.xml

@@ -17,7 +17,8 @@
     <string name="delete">删除</string>
     <string name="clear">清空</string>
     <string name="send">发送</string>
-    <string name="paste_tip">粘贴你想说的话,润色升华</string>
+    <string name="paste_tip">复制对方的话自动粘贴</string>
+    <string name="paste_tip2">粘贴你想说的话,润色升华</string>
     <string name="re_generate">重新生成</string>
     <string name="paste_permission_tip">“允许”【从其他app粘贴】,不再弹出询问弹窗></string>
     <string name="dialog_permission_tip_title">温馨提示</string>