mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-06-05 21:49:26 +02:00
Make categories fit available screen size
This commit is contained in:
@ -23,7 +23,6 @@ import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.RadioGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.inline.InlineContentView
|
||||
import androidx.annotation.RequiresApi
|
||||
@ -1562,6 +1561,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||
}
|
||||
val checkIds = mutableMapOf<Int, String>()
|
||||
keyboardViewBinding?.emojiCategoriesStrip?.apply {
|
||||
weightSum = categories.count().toFloat()
|
||||
val strip = this
|
||||
removeAllViews()
|
||||
categories.entries.forEach { (category, emojis) ->
|
||||
@ -1569,6 +1569,11 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||
root.id = generateViewId()
|
||||
checkIds[root.id] = category
|
||||
root.setImageResource(emojis.first().getCategoryIcon())
|
||||
root.layoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
1f
|
||||
)
|
||||
root.setOnClickListener {
|
||||
strip.children.filterIsInstance<ImageButton>().forEach {
|
||||
it.imageTintList = ColorStateList.valueOf(context.getProperTextColor())
|
||||
|
@ -6,5 +6,6 @@
|
||||
android:background="@drawable/ripple_all_corners_medium"
|
||||
android:gravity="center"
|
||||
android:importantForAccessibility="no"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:padding="@dimen/tiny_margin"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_emoji_category_activities" />
|
||||
|
@ -207,6 +207,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/medium_margin"
|
||||
android:layout_marginEnd="@dimen/medium_margin"
|
||||
android:layout_toStartOf="@+id/emoji_palette_backspace"
|
||||
android:layout_toEndOf="@+id/emoji_palette_mode_change"
|
||||
android:gravity="center"
|
||||
|
Reference in New Issue
Block a user