Ver Fonte

[feat]键盘插件,键盘的人设列表,调整条目样式、分割线大小等

hezihao há 8 meses atrás
pai
commit
6555a58374

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

@@ -200,7 +200,10 @@ class AiKeyboardComponent @JvmOverloads constructor(
                 })
             }
             // 设置滚动辅助工具
-            val pageSnapHelper = PagerGridSnapHelper()
+            val pageSnapHelper = PagerGridSnapHelper().apply {
+                // 设置滚动阀值
+                setFlingThreshold(minFlingVelocity)
+            }
             pageSnapHelper.attachToRecyclerView(this)
             // 设置适配器
             adapter = mKeyListAdapter

+ 15 - 5
plugins/keyboard_android/android/src/main/kotlin/com/atmob/keyboard_android/util/recyclerview/GridDivider.kt

@@ -25,11 +25,21 @@ class GridDivider(
         val column = position % spanCount
 
         // 右边距,非最后一列添加间距
-        outRect.right = if (column < spanCount - 1) {
-            spacing
-        } else {
-            0
-        }
+//        outRect.right = if (column < spanCount - 1) {
+//            spacing
+//        } else {
+//            0
+//        }
+
+        // 右边距,如果是最后一列,则添加一半的间距
+//        outRect.right = if (column < spanCount - 1) {
+//            spacing
+//        } else {
+//            spacing / 2
+//        }
+
+        // 右边距,都添加
+        outRect.right = spacing
 
         // 下边距,非最后一行添加间距
 //        val totalItemCount = parent.adapter?.itemCount ?: 0

+ 1 - 1
plugins/keyboard_android/android/src/main/res/layout/component_ai_keyboard.xml

@@ -81,7 +81,7 @@
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_marginStart="10dp"
-                android:layout_marginEnd="6dp"
+                android:layout_marginEnd="3dp"
                 android:layout_weight="1">
 
                 <com.atmob.keyboard_android.component.base.FakeComponent

+ 2 - 0
plugins/keyboard_android/android/src/main/res/layout/item_ai_keyboard_key.xml

@@ -14,6 +14,8 @@
         android:ellipsize="end"
         android:gravity="center"
         android:maxLines="1"
+        android:paddingStart="3dp"
+        android:paddingEnd="3dp"
         android:textColor="@color/text_color_primary"
         android:textSize="14sp"
         tools:text="哄女友" />