|
|
@@ -3,9 +3,14 @@ package com.atmob.keyboard_android.component.child.impl
|
|
|
import android.content.Context
|
|
|
import android.util.AttributeSet
|
|
|
import android.view.View
|
|
|
+import android.widget.TextView
|
|
|
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.child.IKeyboardSelectComponent
|
|
|
import com.atmob.keyboard_android.component.child.IQuickSwitchComponent
|
|
|
+import com.atmob.keyboard_android.enums.Mode
|
|
|
+import com.atmob.keyboard_android.ext.click
|
|
|
import com.atmob.keyboard_android.ui.popup.ModeSwitchPopupWindow
|
|
|
|
|
|
/**
|
|
|
@@ -15,11 +20,13 @@ class QuickSwitchComponent @JvmOverloads constructor(
|
|
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
|
|
) : BaseUIComponent<IQuickSwitchComponent>(context, attrs, defStyleAttr), IQuickSwitchComponent {
|
|
|
private lateinit var vModeSwitchLayout: View
|
|
|
+ private lateinit var vModeText: TextView
|
|
|
+ private lateinit var vKeyboardSelectLayout: View
|
|
|
|
|
|
/**
|
|
|
* 模式切换的弹窗
|
|
|
*/
|
|
|
- private val mModeSwitchPopupWindow = ModeSwitchPopupWindow(context)
|
|
|
+ private val mModeSwitchPopupWindow = ModeSwitchPopupWindow()
|
|
|
|
|
|
override fun onInflateViewId(): Int {
|
|
|
return R.layout.quick_switch_component
|
|
|
@@ -27,17 +34,30 @@ class QuickSwitchComponent @JvmOverloads constructor(
|
|
|
|
|
|
override fun findView(view: View) {
|
|
|
vModeSwitchLayout = view.findViewById(R.id.mode_switch_layout)
|
|
|
+ vModeText = view.findViewById(R.id.mode_text)
|
|
|
+ vKeyboardSelectLayout = view.findViewById(R.id.keyboard_select_layout)
|
|
|
}
|
|
|
|
|
|
override fun bindView(view: View) {
|
|
|
- vModeSwitchLayout.setOnClickListener {
|
|
|
+ vModeSwitchLayout.click {
|
|
|
// 弹出模式切换弹窗
|
|
|
if (mModeSwitchPopupWindow.isShowing()) {
|
|
|
mModeSwitchPopupWindow.dismiss()
|
|
|
} else {
|
|
|
- mModeSwitchPopupWindow.show(vModeSwitchLayout)
|
|
|
+ mModeSwitchPopupWindow.show(vModeSwitchLayout, Mode.HELP_CHAT, object :
|
|
|
+ ModeSwitchPopupWindow.OnModeSelectedListener {
|
|
|
+ override fun onModeSelected(mode: Mode) {
|
|
|
+ vModeText.text = mode.modeName
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
+ vKeyboardSelectLayout.click {
|
|
|
+ // 显示键盘选择页
|
|
|
+ val keyboardSelectComponent =
|
|
|
+ ComponentMediator.findComponent(IKeyboardSelectComponent::class.java)
|
|
|
+ keyboardSelectComponent?.show()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun getComponentInterfaceClazz(): Class<IQuickSwitchComponent> {
|