copying some resources and assets from the AOSP keyboard

This commit is contained in:
tibbi 2022-01-06 23:31:06 +01:00
parent 46a33d2397
commit 495ffe16c3
17 changed files with 143 additions and 1431 deletions

View File

@ -2,12 +2,10 @@ package com.simplemobiletools.keyboard.views
import android.annotation.SuppressLint
import android.content.Context
import android.content.res.TypedArray
import android.graphics.*
import android.graphics.Paint.Align
import android.graphics.drawable.Drawable
import android.inputmethodservice.Keyboard
import android.inputmethodservice.KeyboardView
import android.media.AudioManager
import android.os.Handler
import android.os.Message
@ -19,8 +17,6 @@ import android.view.accessibility.AccessibilityEvent
import android.view.accessibility.AccessibilityManager
import android.widget.PopupWindow
import android.widget.TextView
import com.simplemobiletools.commons.extensions.getResolution
import com.simplemobiletools.commons.helpers.mydebug
import com.simplemobiletools.keyboard.R
import java.util.*

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Toggle keys. Use checkable/checked state. -->
<item android:state_checkable="true" android:state_checked="true"
android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_pressed_on" />
<item android:state_checkable="true" android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_pressed_off" />
<item android:state_checkable="true" android:state_checked="true"
android:drawable="@drawable/btn_keyboard_key_normal_on" />
<item android:state_checkable="true"
android:drawable="@drawable/btn_keyboard_key_normal_off" />
<!-- Normal keys -->
<item android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_pressed" />
<item
android:drawable="@drawable/btn_keyboard_key_normal" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@ -0,0 +1,4 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/keyboard_key_feedback_more_background" android:state_long_pressable="true" />
<item android:drawable="@drawable/keyboard_key_feedback_background" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -1,7 +1,8 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_background_color"
android:textAlignment="center"
android:textColor="@color/default_text_color"
android:textSize="30sp" />
android:layout_width="wrap_content"
android:layout_height="80sp"
android:background="@drawable/keyboard_key_feedback"
android:gravity="center"
android:minWidth="32dip"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textSize="40sp" />

View File

@ -2,6 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/keyboard_popup_panel_background"
android:orientation="horizontal">
<com.simplemobiletools.keyboard.views.MyKeyboardView

View File

@ -4,4 +4,5 @@
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:background="@color/default_background_color"
style="@style/Widget.KeyboardView"
android:keyPreviewLayout="@layout/keyboard_key_preview" />

View File

@ -2,6 +2,25 @@
<style name="AppTheme" parent="AppTheme.Base" />
<style name="Widget">
<item name="itemTextAppearance">?attr/itemTextAppearance</item>
</style>
<style name="Widget.KeyboardView" parent="Widget">
<item name="background">@drawable/keyboard_background</item>
<item name="keyBackground">@drawable/btn_keyboard_key</item>
<item name="keyTextSize">22sp</item>
<item name="keyTextColor">#FFFFFFFF</item>
<item name="keyPreviewLayout">@layout/keyboard_key_preview</item>
<item name="keyPreviewOffset">-12dip</item>
<item name="keyPreviewHeight">80dip</item>
<item name="labelTextSize">14sp</item>
<item name="popupLayout">@layout/keyboard_popup_keyboard</item>
<item name="verticalCorrection">-10dip</item>
<item name="shadowColor">#BB000000</item>
<item name="shadowRadius">2.75</item>
</style>
<declare-styleable name="KeyboardView">
<attr name="keyboardViewStyle" format="reference" />
<!-- Image for the key. This image needs to be a StateListDrawable, with the following
@ -30,6 +49,85 @@
<!-- Vertical offset of the text shadow. -->
<attr name="shadowDy" format="dimension" />
<!-- Blur radius of the text shadow. -->
<attr name="shadowRadius" format="dimension" />
<attr name="shadowRadius" format="float" />
</declare-styleable>
<declare-styleable name="Keyboard">
<!-- Default width of a key, in pixels or percentage of display width.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyWidth" format="dimension|fraction" />
<!-- Default height of a key, in pixels or percentage of display width.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyHeight" format="dimension|fraction" />
<!-- Default horizontal gap between keys.
{@deprecated Copy this definition into your own application project.} -->
<attr name="horizontalGap" format="dimension|fraction" />
<!-- Default vertical gap between rows of keys.
{@deprecated Copy this definition into your own application project.} -->
<attr name="verticalGap" format="dimension|fraction" />
</declare-styleable>
<declare-styleable name="Keyboard_Row">
<!-- Row edge flags.
{@deprecated Copy this definition into your own application project.} -->
<attr name="rowEdgeFlags">
<!-- Row is anchored to the top of the keyboard.
{@deprecated Copy this definition into your own application project.} -->
<flag name="top" value="4" />
<!-- Row is anchored to the bottom of the keyboard.
{@deprecated Copy this definition into your own application project.} -->
<flag name="bottom" value="8" />
</attr>
<!-- Mode of the keyboard. If the mode doesn't match the
requested keyboard mode, the row will be skipped.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyboardMode" format="reference" />
</declare-styleable>
<declare-styleable name="Keyboard_Key">
<!-- The unicode value or comma-separated values that this key outputs.
{@deprecated Copy this definition into your own application project.} -->
<attr name="codes" format="integer|string" />
<!-- The XML keyboard layout of any popup keyboard.
{@deprecated Copy this definition into your own application project.} -->
<attr name="popupKeyboard" format="reference" />
<!-- The characters to display in the popup keyboard.
{@deprecated Copy this definition into your own application project.} -->
<attr name="popupCharacters" format="string" />
<!-- Key edge flags.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyEdgeFlags">
<!-- Key is anchored to the left of the keyboard.
{@deprecated Copy this definition into your own application project.} -->
<flag name="left" value="1" />
<!-- Key is anchored to the right of the keyboard.
{@deprecated Copy this definition into your own application project.} -->
<flag name="right" value="2" />
</attr>
<!-- Whether this is a modifier key such as Alt or Shift.
{@deprecated Copy this definition into your own application project.} -->
<attr name="isModifier" format="boolean" />
<!-- Whether this is a toggle key.
{@deprecated Copy this definition into your own application project.} -->
<attr name="isSticky" format="boolean" />
<!-- Whether long-pressing on this key will make it repeat.
{@deprecated Copy this definition into your own application project.} -->
<attr name="isRepeatable" format="boolean" />
<!-- The icon to show in the popup preview.
{@deprecated Copy this definition into your own application project.} -->
<attr name="iconPreview" format="reference" />
<!-- The string of characters to output when this key is pressed.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyOutputText" format="string" />
<!-- The label to display on the key.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyLabel" format="string" />
<!-- The icon to display on the key instead of the label.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyIcon" format="reference" />
<!-- Mode of the keyboard. If the mode doesn't match the
requested keyboard mode, the key will be skipped.
{@deprecated Copy this definition into your own application project.} -->
<attr name="keyboardMode" />
</declare-styleable>
</resources>