|
@@ -7,7 +7,9 @@ import android.view.View
|
|
|
import androidx.recyclerview.widget.GridLayoutManager
|
|
import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import com.atmob.keyboard_android.R
|
|
import com.atmob.keyboard_android.R
|
|
|
|
|
+import com.atmob.keyboard_android.component.ComponentMediator
|
|
|
import com.atmob.keyboard_android.component.base.BaseUIComponent
|
|
import com.atmob.keyboard_android.component.base.BaseUIComponent
|
|
|
|
|
+import com.atmob.keyboard_android.component.child.IAiChatComponent
|
|
|
import com.atmob.keyboard_android.component.child.IAiKeyboardComponent
|
|
import com.atmob.keyboard_android.component.child.IAiKeyboardComponent
|
|
|
import com.atmob.keyboard_android.component.item.AiKeyboardKeyViewBinder
|
|
import com.atmob.keyboard_android.component.item.AiKeyboardKeyViewBinder
|
|
|
import com.atmob.keyboard_android.constant.Constants
|
|
import com.atmob.keyboard_android.constant.Constants
|
|
@@ -170,8 +172,7 @@ class AiKeyboardComponent @JvmOverloads constructor(
|
|
|
mKeyListAdapter = MultiTypeAdapter(mKeyListItems).apply {
|
|
mKeyListAdapter = MultiTypeAdapter(mKeyListItems).apply {
|
|
|
register(AiKeyboardKeyModel::class.java, AiKeyboardKeyViewBinder {
|
|
register(AiKeyboardKeyModel::class.java, AiKeyboardKeyViewBinder {
|
|
|
// 点击键盘按键,打开AI生成内容面板
|
|
// 点击键盘按键,打开AI生成内容面板
|
|
|
- KeyboardHolder.getKeyboardService()?.getKeyboardViewModel()
|
|
|
|
|
- ?.updateAiChatPageShowing(true)
|
|
|
|
|
|
|
+ controlAiChatPageShowing(true)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
layoutManager = GridLayoutManager(context, Constants.AI_KEYBOARD_KEY_LIST_SPAN_COUNT)
|
|
layoutManager = GridLayoutManager(context, Constants.AI_KEYBOARD_KEY_LIST_SPAN_COUNT)
|
|
@@ -248,7 +249,7 @@ class AiKeyboardComponent @JvmOverloads constructor(
|
|
|
// 切换Tab
|
|
// 切换Tab
|
|
|
vMagicIndicator.onPageSelected(newTab.getIndex())
|
|
vMagicIndicator.onPageSelected(newTab.getIndex())
|
|
|
// 关闭Ai内容生成面板
|
|
// 关闭Ai内容生成面板
|
|
|
- getKeyboardViewModel().updateAiChatPageShowing(false)
|
|
|
|
|
|
|
+ controlAiChatPageShowing(false)
|
|
|
// 根据Tab,重新加载数据
|
|
// 根据Tab,重新加载数据
|
|
|
loadKeyListByTab(newTab)
|
|
loadKeyListByTab(newTab)
|
|
|
}
|
|
}
|
|
@@ -309,7 +310,19 @@ class AiKeyboardComponent @JvmOverloads constructor(
|
|
|
vPasteBarLayout.setVisible()
|
|
vPasteBarLayout.setVisible()
|
|
|
}
|
|
}
|
|
|
// 隐藏AI生成内容面板
|
|
// 隐藏AI生成内容面板
|
|
|
- KeyboardHolder.getKeyboardService()?.getKeyboardViewModel()
|
|
|
|
|
- ?.updateAiChatPageShowing(false)
|
|
|
|
|
|
|
+ controlAiChatPageShowing(false)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 控制Ai生成内容面板,是否显示
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun controlAiChatPageShowing(isShow: Boolean) {
|
|
|
|
|
+ val aiChatComponent =
|
|
|
|
|
+ ComponentMediator.findComponent<IAiChatComponent>(IAiChatComponent::class.java)
|
|
|
|
|
+ if (isShow) {
|
|
|
|
|
+ aiChatComponent?.show()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ aiChatComponent?.hide()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|