adding some initial styling things
This commit is contained in:
parent
ccb9d61841
commit
12c4fb3d2d
|
@ -538,7 +538,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
val canvas = mCanvas
|
||||
canvas!!.clipRect(mDirtyRect)
|
||||
val paint = mPaint
|
||||
val keyBackground = mKeyBackground
|
||||
val clipRegion = mClipRegion
|
||||
val padding = mPadding
|
||||
val kbdPaddingLeft: Int = paddingLeft
|
||||
|
@ -574,6 +573,13 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
continue
|
||||
}
|
||||
|
||||
var keyBackground = mKeyBackground
|
||||
if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_SPACE) {
|
||||
keyBackground = resources.getDrawable(R.drawable.keyboard_space_background, context.theme)
|
||||
} else if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) {
|
||||
keyBackground = resources.getDrawable(R.drawable.keyboard_enter_background, context.theme)
|
||||
}
|
||||
|
||||
// Switch the character to uppercase if shift is pressed
|
||||
val label = adjustCase(key.label)?.toString()
|
||||
val bounds = keyBackground!!.bounds
|
||||
|
@ -623,22 +629,10 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||
key.icon = resources.getDrawable(drawableId)
|
||||
}
|
||||
|
||||
val iconWidthToUse = if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) {
|
||||
(key.icon!!.intrinsicWidth * 1.2).toInt()
|
||||
} else {
|
||||
key.icon!!.intrinsicWidth
|
||||
}
|
||||
|
||||
val iconHeightToUse = if (key.codes.firstOrNull() == MyKeyboard.KEYCODE_ENTER) {
|
||||
(key.icon!!.intrinsicHeight * 1.2).toInt()
|
||||
} else {
|
||||
key.icon!!.intrinsicHeight
|
||||
}
|
||||
|
||||
val drawableX = (key.width - iconWidthToUse) / 2
|
||||
val drawableY = (key.height - iconHeightToUse) / 2
|
||||
val drawableX = (key.width - key.icon!!.intrinsicWidth) / 2
|
||||
val drawableY = (key.height - key.icon!!.intrinsicHeight) / 2
|
||||
canvas.translate(drawableX.toFloat(), drawableY.toFloat())
|
||||
key.icon!!.setBounds(0, 0, iconWidthToUse, iconHeightToUse)
|
||||
key.icon!!.setBounds(0, 0, key.icon!!.intrinsicWidth, key.icon!!.intrinsicHeight)
|
||||
key.icon!!.draw(canvas)
|
||||
canvas.translate(-drawableX.toFloat(), -drawableY.toFloat())
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/btn_keyboard_key_pressed" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/btn_keyboard_key_normal" />
|
||||
</selector>
|
Binary file not shown.
Before Width: | Height: | Size: 715 B |
Binary file not shown.
Before Width: | Height: | Size: 745 B |
|
@ -1,9 +1,14 @@
|
|||
<?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">
|
||||
<item
|
||||
android:id="@+id/button_background_shape"
|
||||
android:bottom="@dimen/normal_margin"
|
||||
android:left="@dimen/normal_margin"
|
||||
android:right="@dimen/normal_margin"
|
||||
android:top="@dimen/normal_margin">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/md_grey_800_dark" />
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/color_primary" />
|
||||
<corners android:radius="@dimen/medium_margin" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
<?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">
|
||||
<item
|
||||
android:id="@+id/button_background_shape"
|
||||
android:bottom="@dimen/normal_margin"
|
||||
android:left="@dimen/medium_margin"
|
||||
android:right="@dimen/medium_margin"
|
||||
android:top="@dimen/normal_margin">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/md_grey_800_dark" />
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/md_grey_700" />
|
||||
<corners android:radius="@dimen/medium_margin" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/button_background_shape">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/md_grey_800_dark" />
|
||||
<solid android:color="@color/md_green" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/minikeyboard_selected_background" android:state_pressed="true" />
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?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">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/md_yellow" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -1,7 +1,7 @@
|
|||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/keyboard_key_feedback_background"
|
||||
android:background="@drawable/minikeyboard_background"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/md_grey_white"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/keyboard_key_feedback_background"
|
||||
android:background="@drawable/minikeyboard_background"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.simplemobiletools.keyboard.views.MyKeyboardView
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</style>
|
||||
|
||||
<style name="Widget.KeyboardView" parent="Widget">
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key</item>
|
||||
<item name="keyBackground">@drawable/minikeyboard_key_selector</item>
|
||||
<item name="keyTextSize">22sp</item>
|
||||
<item name="keyTextColor">#FFFFFFFF</item>
|
||||
<item name="keyPreviewLayout">@layout/keyboard_key_preview</item>
|
||||
|
|
Loading…
Reference in New Issue