Don't show key borders in mini keyboard
This commit is contained in:
parent
9eee610929
commit
2999ccdc08
|
@ -378,7 +378,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
|
||||
mShowKeyBorders = context.config.showKeyBorders
|
||||
mUsingSystemTheme = context.config.isUsingSystemTheme
|
||||
mKeyBackground = if (mShowKeyBorders) {
|
||||
|
||||
val isMainKeyboard = changedView == null || changedView != mini_keyboard_view
|
||||
mKeyBackground = if (mShowKeyBorders && isMainKeyboard) {
|
||||
resources.getDrawable(R.drawable.keyboard_key_selector_outlined, context.theme)
|
||||
} else {
|
||||
resources.getDrawable(R.drawable.keyboard_key_selector, context.theme)
|
||||
|
@ -392,7 +394,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
val darkerColor = getKeyboardBackgroundColor()
|
||||
val miniKeyboardBackgroundColor = getToolbarColor(4)
|
||||
|
||||
if (changedView != null && changedView == mini_keyboard_view) {
|
||||
if (!isMainKeyboard) {
|
||||
val previewBackground = background as LayerDrawable
|
||||
previewBackground.findDrawableByLayerId(R.id.button_background_shape).applyColorFilter(miniKeyboardBackgroundColor)
|
||||
previewBackground.findDrawableByLayerId(R.id.button_background_stroke).applyColorFilter(strokeColor)
|
||||
|
@ -1570,7 +1572,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
|
||||
private fun maybeDarkenColor(color: Int, factor: Int): Int {
|
||||
// use darker background color when key borders are enabled
|
||||
if (context.config.showKeyBorders && !context.isUsingSystemDarkTheme()) {
|
||||
if (context.config.showKeyBorders) {
|
||||
val darkerColor = color.darkenColor(factor)
|
||||
return if (darkerColor == Color.WHITE) {
|
||||
resources.getColor(R.color.md_grey_200, context.theme)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--used after long pressing a key to highlight the currently selected key alternative on minikeyboard-->
|
||||
<item android:drawable="@drawable/minikeyboard_selected_background_outlined" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/key_background_outlined"/>
|
||||
<!--used after long pressing a key to highlight the currently selected key alternative on minikeyboard-->
|
||||
<item android:drawable="@drawable/minikeyboard_selected_background" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/key_background_outlined" />
|
||||
</selector>
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/button_background_shape" android:bottom="@dimen/small_margin" android:left="@dimen/tiny_margin" android:right="@dimen/tiny_margin" android:top="@dimen/small_margin">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/color_primary" />
|
||||
<corners android:radius="@dimen/medium_margin" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
Loading…
Reference in New Issue