|
|
@@ -1,13 +1,14 @@
|
|
|
-package com.atmob.keyboard_android.component
|
|
|
+package com.atmob.keyboard_android.component.view
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
|
import android.util.AttributeSet
|
|
|
+import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
+import android.widget.FrameLayout
|
|
|
import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import com.atmob.keyboard_android.R
|
|
|
-import com.atmob.keyboard_android.component.base.BaseUIComponent
|
|
|
import com.atmob.keyboard_android.component.item.AiKeyboardKeyViewBinder
|
|
|
import com.atmob.keyboard_android.ext.click
|
|
|
import com.atmob.keyboard_android.model.AiKeyboardKeyModel
|
|
|
@@ -17,11 +18,11 @@ import me.drakeet.multitype.Items
|
|
|
import me.drakeet.multitype.MultiTypeAdapter
|
|
|
|
|
|
/**
|
|
|
- * AI键盘内容组件
|
|
|
+ * AI键盘内容View
|
|
|
*/
|
|
|
-class AiKeyboardContentComponent @JvmOverloads constructor(
|
|
|
+class AiKeyboardContentView @JvmOverloads constructor(
|
|
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
|
|
-) : BaseUIComponent(context, attrs, defStyleAttr) {
|
|
|
+) : FrameLayout(context, attrs, defStyleAttr) {
|
|
|
private lateinit var vKeyList: RecyclerView
|
|
|
private lateinit var vDeleteBtn: View
|
|
|
private lateinit var vClearBtn: View
|
|
|
@@ -30,21 +31,27 @@ class AiKeyboardContentComponent @JvmOverloads constructor(
|
|
|
private lateinit var mListItems: Items
|
|
|
private lateinit var mListAdapter: MultiTypeAdapter
|
|
|
|
|
|
- override fun onInflateViewId(): Int {
|
|
|
- return R.layout.component_ai_keyboard_content
|
|
|
+ init {
|
|
|
+ val view = LayoutInflater.from(context).inflate(onInflateViewId(), this, true)
|
|
|
+ findView(view)
|
|
|
+ bindView()
|
|
|
+ setData()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun onInflateViewId(): Int {
|
|
|
+ return R.layout.view_ai_keyboard_content
|
|
|
}
|
|
|
|
|
|
- override fun findView(view: View) {
|
|
|
+ private fun findView(view: View) {
|
|
|
vKeyList = view.findViewById(R.id.key_list)
|
|
|
vDeleteBtn = view.findViewById(R.id.delete_btn)
|
|
|
vClearBtn = view.findViewById(R.id.clear_btn)
|
|
|
vSendBtn = view.findViewById(R.id.send_btn)
|
|
|
}
|
|
|
|
|
|
- override fun bindView(view: View) {
|
|
|
+ private fun bindView() {
|
|
|
setupKeyList()
|
|
|
setupActionBtn()
|
|
|
- setData()
|
|
|
}
|
|
|
|
|
|
/**
|