Browse Source

[feat]键盘插件,修复切换键盘,json解析报错的问题

hezihao 7 tháng trước cách đây
mục cha
commit
d578e20493

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

@@ -94,7 +94,7 @@ class QuickSwitchComponent @JvmOverloads constructor(
             // 监听键盘名称切换
             getKeyboardViewModel().currentKeyboardInfo.observe(getLifecycleOwner()) { newKeyboard ->
                 LogUtil.d("更新键盘名称:${newKeyboard.name}")
-                var name = newKeyboard.name
+                var name = newKeyboard.name ?: ""
                 if (name.isBlank()) {
                     name = context.resources.getString(R.string.common_keyboard)
                 }

+ 1 - 1
plugins/keyboard_android/android/src/main/kotlin/com/atmob/keyboard_android/component/item/KeyboardSelectViewBinder.kt

@@ -34,7 +34,7 @@ class KeyboardSelectViewBinder(
     ) {
         val context = holder.itemView.context
 
-        val isSystemKeyboard = KeyboardType.isSystem(item.type)
+        val isSystemKeyboard = KeyboardType.isSystem(item.type ?: "")
         val iconDefaultResId = if (isSystemKeyboard) {
             R.mipmap.ic_common_keyboard_icon
         } else {

+ 5 - 5
plugins/keyboard_android/android/src/main/kotlin/com/atmob/keyboard_android/model/KeyboardSelectModel.kt

@@ -13,23 +13,23 @@ data class KeyboardSelectModel(
     /**
      * 键盘类型,system:系统键盘、custom:定制键盘
      */
-    val type: String,
+    val type: String?,
     /**
      * 键盘名称
      */
-    val name: String,
+    val name: String?,
     /**
      * 性别
      */
-    val gender: Int,
+    val gender: Int?,
     /**
      * 生日
      */
-    val birthday: String,
+    val birthday: String?,
     /**
      * 亲密度
      */
-    val intimacy: Int,
+    val intimacy: Int?,
     /**
      * 键盘图标Url
      */