This commit is contained in:
2022-04-03 18:17:37 +08:00
parent e1cdff0d5b
commit 2c12943daf
67 changed files with 7127 additions and 537 deletions
+1
View File
@@ -0,0 +1 @@
/build
+12
View File
@@ -0,0 +1,12 @@
apply plugin: 'com.novoda.bintray-release'
//添加
publish {
userOrg = 'jenly'//bintray.com用户名
groupId = 'com.king.keyboard'//jcenter上的路径
artifactId = 'kingkeyboard'//项目名称
publishVersion = app_version.versionName//版本号
desc = 'KingKeyboard for Android'//描述
website = 'https://github.com/jenly1314/KingKeyboard'//网站
licences = ['MIT']//开源协议
}
+42
View File
@@ -0,0 +1,42 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
//apply from: 'bintray.gradle'
//apply plugin: "com.vanniktech.maven.publish"
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
warning 'InvalidPackage'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.31"
compileOnly "androidx.appcompat:appcompat:1.1.0"
testImplementation "junit:junit:4.12"
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
}
View File
+3
View File
@@ -0,0 +1,3 @@
POM_NAME=KingKeyboard
POM_ARTIFACT_ID=kingkeyboard
POM_PACKAGING=aar
+21
View File
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,24 @@
package com.king.keyboard
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.king.keyboard.test", appContext.packageName)
}
}
+5
View File
@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.king.keyboard" >
<!-- 震动权限 -->
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
@@ -0,0 +1,913 @@
package com.king.keyboard;
/*
* Copyright (C) 2008-2009 Google Inc.
*
* 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.
*/
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
import androidx.annotation.XmlRes;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard
* consists of rows of keys.
* <p>The layout file for a keyboard contains XML that looks like the following snippet:</p>
* <pre>
* &lt;Keyboard
* android:keyWidth="%10p"
* android:keyHeight="50px"
* android:horizontalGap="2px"
* android:verticalGap="2px" &gt;
* &lt;Row android:keyWidth="32px" &gt;
* &lt;Key android:keyLabel="A" /&gt;
* ...
* &lt;/Row&gt;
* ...
* &lt;/Keyboard&gt;
* </pre>
* @attr ref android.R.styleable#King_Keyboard_keyWidth
* @attr ref android.R.styleable#King_Keyboard_keyHeight
* @attr ref android.R.styleable#King_Keyboard_horizontalGap
* @attr ref android.R.styleable#King_Keyboard_verticalGap
* This class is deprecated because this is just a convenient UI widget class that
* application developers can re-implement on top of existing public APIs. If you have
* already depended on this class, consider copying the implementation from AOSP into
* your project or re-implementing a similar widget by yourselves
*/
public class Keyboard {
static final String TAG = "Keyboard";
// Keyboard XML Tags
private static final String TAG_KEYBOARD = "Keyboard";
private static final String TAG_ROW = "Row";
private static final String TAG_KEY = "Key";
public static final int EDGE_LEFT = 0x01;
public static final int EDGE_RIGHT = 0x02;
public static final int EDGE_TOP = 0x04;
public static final int EDGE_BOTTOM = 0x08;
public static final int KEYCODE_SHIFT = -1;
public static final int KEYCODE_MODE_CHANGE = -2;
public static final int KEYCODE_CANCEL = -3;
public static final int KEYCODE_DONE = -4;
public static final int KEYCODE_DELETE = -5;
public static final int KEYCODE_ALT = -6;
/** Keyboard label **/
private CharSequence mLabel;
/** Horizontal gap default for all rows */
private int mDefaultHorizontalGap;
/** Default key width */
private int mDefaultWidth;
/** Default key height */
private int mDefaultHeight;
/** Default gap between rows */
private int mDefaultVerticalGap;
/** Is the keyboard in the shifted state */
private boolean mShifted;
/** Key instance for the shift key, if present */
private Key[] mShiftKeys = { null, null };
/** Key index for the shift key, if present */
private int[] mShiftKeyIndices = {-1, -1};
/** Current key width, while loading the keyboard */
private int mKeyWidth;
/** Current key height, while loading the keyboard */
private int mKeyHeight;
/** Total height of the keyboard, including the padding and keys */
private int mTotalHeight;
/**
* Total width of the keyboard, including left side gaps and keys, but not any gaps on the
* right side.
*/
private int mTotalWidth;
/** List of keys in this keyboard */
private List<Key> mKeys;
/** List of modifier keys such as Shift & Alt, if any */
private List<Key> mModifierKeys;
/** Width of the screen available to fit the keyboard */
private int mDisplayWidth;
/** Height of the screen */
private int mDisplayHeight;
/** Keyboard mode, or zero, if none. */
private int mKeyboardMode;
// Variables for pre-computing nearest keys.
private static final int GRID_WIDTH = 10;
private static final int GRID_HEIGHT = 5;
private static final int GRID_SIZE = GRID_WIDTH * GRID_HEIGHT;
private int mCellWidth;
private int mCellHeight;
private int[][] mGridNeighbors;
private int mProximityThreshold;
/** Number of key widths from current touch point to search for nearest keys. */
private static float SEARCH_DISTANCE = 1.8f;
private ArrayList<Row> rows = new ArrayList<>();
/**
* Container for keys in the keyboard. All keys in a row are at the same Y-coordinate.
* Some of the key size defaults can be overridden per row from what the {@link Keyboard}
* defines.
* @attr ref android.R.styleable#King_Keyboard_keyWidth
* @attr ref android.R.styleable#King_Keyboard_keyHeight
* @attr ref android.R.styleable#King_Keyboard_horizontalGap
* @attr ref android.R.styleable#King_Keyboard_verticalGap
* @attr ref android.R.styleable#King_Keyboard_Row_rowEdgeFlags
* @attr ref android.R.styleable#King_Keyboard_Row_keyboardMode
*/
public static class Row {
/** Default width of a key in this row. */
public int defaultWidth;
/** Default height of a key in this row. */
public int defaultHeight;
/** Default horizontal gap between keys in this row. */
public int defaultHorizontalGap;
/** Vertical gap following this row. */
public int verticalGap;
ArrayList<Key> mKeys = new ArrayList<>();
/**
* Edge flags for this row of keys. Possible values that can be assigned are
* {@link Keyboard#EDGE_TOP EDGE_TOP} and {@link Keyboard#EDGE_BOTTOM EDGE_BOTTOM}
*/
public int rowEdgeFlags;
/** The keyboard mode for this row */
public int mode;
private Keyboard parent;
public Row(Keyboard parent) {
this.parent = parent;
}
public Row(Resources res, Keyboard parent, XmlResourceParser parser) {
this.parent = parent;
TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard);
defaultWidth = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyWidth,
parent.mDisplayWidth, parent.mDefaultWidth);
defaultHeight = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyHeight,
parent.mDisplayHeight, parent.mDefaultHeight);
defaultHorizontalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_horizontalGap,
parent.mDisplayWidth, parent.mDefaultHorizontalGap);
verticalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_verticalGap,
parent.mDisplayHeight, parent.mDefaultVerticalGap);
a.recycle();
a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard_Row);
rowEdgeFlags = a.getInt(R.styleable.King_Keyboard_Row_android_rowEdgeFlags, 0);
mode = a.getResourceId(R.styleable.King_Keyboard_Row_android_keyboardMode,
0);
}
}
/**
* Class for describing the position and characteristics of a single key in the keyboard.
*
* @attr ref android.R.styleable#King_Keyboard_keyWidth
* @attr ref android.R.styleable#King_Keyboard_keyHeight
* @attr ref android.R.styleable#King_Keyboard_horizontalGap
* @attr ref android.R.styleable#King_Keyboard_Key_codes
* @attr ref android.R.styleable#King_Keyboard_Key_keyIcon
* @attr ref android.R.styleable#King_Keyboard_Key_keyLabel
* @attr ref android.R.styleable#King_Keyboard_Key_iconPreview
* @attr ref android.R.styleable#King_Keyboard_Key_isSticky
* @attr ref android.R.styleable#King_Keyboard_Key_isRepeatable
* @attr ref android.R.styleable#King_Keyboard_Key_isModifier
* @attr ref android.R.styleable#King_Keyboard_Key_popupKeyboard
* @attr ref android.R.styleable#King_Keyboard_Key_popupCharacters
* @attr ref android.R.styleable#King_Keyboard_Key_keyOutputText
* @attr ref android.R.styleable#King_Keyboard_Key_keyEdgeFlags
*/
public static class Key {
/**
* All the key codes (unicode or custom code) that this key could generate, zero'th
* being the most important.
*/
public int[] codes;
/** Label to display */
public CharSequence label;
/** Icon to display instead of a label. Icon takes precedence over a label */
public Drawable icon;
/** Preview version of the icon, for the preview popup */
public Drawable iconPreview;
/** Width of the key, not including the gap */
public int width;
/** Height of the key, not including the gap */
public int height;
/** The horizontal gap before this key */
public int gap;
/** Whether this key is sticky, i.e., a toggle key */
public boolean sticky;
/** X coordinate of the key in the keyboard layout */
public int x;
/** Y coordinate of the key in the keyboard layout */
public int y;
/** The current pressed state of this key */
public boolean pressed;
/** If this is a sticky key, is it on? */
public boolean on;
/** Text to output when pressed. This can be multiple characters, like ".com" */
public CharSequence text;
/** Popup characters */
public CharSequence popupCharacters;
/**
* Flags that specify the anchoring to edges of the keyboard for detecting touch events
* that are just out of the boundary of the key. This is a bit mask of
* {@link Keyboard#EDGE_LEFT}, {@link Keyboard#EDGE_RIGHT}, {@link Keyboard#EDGE_TOP} and
* {@link Keyboard#EDGE_BOTTOM}.
*/
public int edgeFlags;
/** Whether this is a modifier key, such as Shift or Alt */
public boolean modifier;
/** The keyboard that this key belongs to */
private Keyboard keyboard;
/**
* If this key pops up a mini keyboard, this is the resource id for the XML layout for that
* keyboard.
*/
public int popupResId;
/** Whether this key repeats itself when held down */
public boolean repeatable;
private final static int[] KEY_STATE_NORMAL_ON = {
android.R.attr.state_checkable,
android.R.attr.state_checked
};
private final static int[] KEY_STATE_PRESSED_ON = {
android.R.attr.state_pressed,
android.R.attr.state_checkable,
android.R.attr.state_checked
};
private final static int[] KEY_STATE_NORMAL_OFF = {
android.R.attr.state_checkable
};
private final static int[] KEY_STATE_PRESSED_OFF = {
android.R.attr.state_pressed,
android.R.attr.state_checkable
};
private final static int[] KEY_STATE_NORMAL = {
};
private final static int[] KEY_STATE_PRESSED = {
android.R.attr.state_pressed
};
/** Create an empty key with no attributes. */
public Key(Row parent) {
keyboard = parent.parent;
height = parent.defaultHeight;
width = parent.defaultWidth;
gap = parent.defaultHorizontalGap;
edgeFlags = parent.rowEdgeFlags;
}
/** Create a key with the given top-left coordinate and extract its attributes from
* the XML parser.
* @param res resources associated with the caller's context
* @param parent the row that this key belongs to. The row must already be attached to
* a {@link Keyboard}.
* @param x the x coordinate of the top-left
* @param y the y coordinate of the top-left
* @param parser the XML parser containing the attributes for this key
*/
public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) {
this(parent);
this.x = x;
this.y = y;
TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard);
width = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyWidth,
keyboard.mDisplayWidth, parent.defaultWidth);
height = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyHeight,
keyboard.mDisplayHeight, parent.defaultHeight);
gap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_horizontalGap,
keyboard.mDisplayWidth, parent.defaultHorizontalGap);
a.recycle();
a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard_Key);
this.x += gap;
TypedValue codesValue = new TypedValue();
a.getValue(R.styleable.King_Keyboard_Key_android_codes,
codesValue);
if (codesValue.type == TypedValue.TYPE_INT_DEC
|| codesValue.type == TypedValue.TYPE_INT_HEX) {
codes = new int[] { codesValue.data };
} else if (codesValue.type == TypedValue.TYPE_STRING) {
codes = parseCSV(codesValue.string.toString());
}
iconPreview = a.getDrawable(R.styleable.King_Keyboard_Key_android_iconPreview);
if (iconPreview != null) {
iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(),
iconPreview.getIntrinsicHeight());
}
popupCharacters = a.getText(
R.styleable.King_Keyboard_Key_android_popupCharacters);
popupResId = a.getResourceId(
R.styleable.King_Keyboard_Key_android_popupKeyboard, 0);
repeatable = a.getBoolean(
R.styleable.King_Keyboard_Key_android_isRepeatable, false);
modifier = a.getBoolean(
R.styleable.King_Keyboard_Key_android_isModifier, false);
sticky = a.getBoolean(
R.styleable.King_Keyboard_Key_android_isSticky, false);
edgeFlags = a.getInt(R.styleable.King_Keyboard_Key_android_keyEdgeFlags, 0);
edgeFlags |= parent.rowEdgeFlags;
icon = a.getDrawable(
R.styleable.King_Keyboard_Key_android_keyIcon);
if (icon != null) {
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
}
label = a.getText(R.styleable.King_Keyboard_Key_android_keyLabel);
text = a.getText(R.styleable.King_Keyboard_Key_android_keyOutputText);
if (codes == null && !TextUtils.isEmpty(label)) {
codes = new int[] { label.charAt(0) };
}
a.recycle();
}
/**
* Informs the key that it has been pressed, in case it needs to change its appearance or
* state.
* @see #onReleased(boolean)
*/
public void onPressed() {
pressed = !pressed;
}
/**
* Changes the pressed state of the key.
*
* <p>Toggled state of the key will be flipped when all the following conditions are
* fulfilled:</p>
*
* <ul>
* <li>This is a sticky key, that is, {@link #sticky} is {@code true}.
* <li>The parameter {@code inside} is {@code true}.
* <li>{@link android.os.Build.VERSION#SDK_INT} is greater than
* {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}.
* </ul>
*
* @param inside whether the finger was released inside the key. Works only on Android M and
* later. See the method document for details.
* @see #onPressed()
*/
public void onReleased(boolean inside) {
pressed = !pressed;
if (sticky && inside) {
on = !on;
}
}
int[] parseCSV(String value) {
int count = 0;
int lastIndex = 0;
if (value.length() > 0) {
count++;
while ((lastIndex = value.indexOf(",", lastIndex + 1)) > 0) {
count++;
}
}
int[] values = new int[count];
count = 0;
StringTokenizer st = new StringTokenizer(value, ",");
while (st.hasMoreTokens()) {
try {
values[count++] = Integer.parseInt(st.nextToken());
} catch (NumberFormatException nfe) {
Log.e(TAG, "Error parsing keycodes " + value);
}
}
return values;
}
/**
* Detects if a point falls inside this key.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return whether or not the point falls inside the key. If the key is attached to an edge,
* it will assume that all points between the key and the edge are considered to be inside
* the key.
*/
public boolean isInside(int x, int y) {
boolean leftEdge = (edgeFlags & EDGE_LEFT) > 0;
boolean rightEdge = (edgeFlags & EDGE_RIGHT) > 0;
boolean topEdge = (edgeFlags & EDGE_TOP) > 0;
boolean bottomEdge = (edgeFlags & EDGE_BOTTOM) > 0;
if ((x >= this.x || (leftEdge && x <= this.x + this.width))
&& (x < this.x + this.width || (rightEdge && x >= this.x))
&& (y >= this.y || (topEdge && y <= this.y + this.height))
&& (y < this.y + this.height || (bottomEdge && y >= this.y))) {
return true;
} else {
return false;
}
}
/**
* Returns the square of the distance between the center of the key and the given point.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return the square of the distance of the point from the center of the key
*/
public int squaredDistanceFrom(int x, int y) {
int xDist = this.x + width / 2 - x;
int yDist = this.y + height / 2 - y;
return xDist * xDist + yDist * yDist;
}
/**
* Returns the drawable state for the key, based on the current state and type of the key.
* @return the drawable state of the key.
* @see android.graphics.drawable.StateListDrawable#setState(int[])
*/
public int[] getCurrentDrawableState() {
int[] states = KEY_STATE_NORMAL;
if (on) {
if (pressed) {
states = KEY_STATE_PRESSED_ON;
} else {
states = KEY_STATE_NORMAL_ON;
}
} else {
if (sticky) {
if (pressed) {
states = KEY_STATE_PRESSED_OFF;
} else {
states = KEY_STATE_NORMAL_OFF;
}
} else {
if (pressed) {
states = KEY_STATE_PRESSED;
}
}
}
return states;
}
}
/**
* Creates a keyboard from the given xml key layout file.
* @param context the application or service context
* @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
*/
public Keyboard(Context context, int xmlLayoutResId) {
this(context, xmlLayoutResId, 0);
}
/**
* Creates a keyboard from the given xml key layout file. Weeds out rows
* that have a keyboard mode defined but don't match the specified mode.
* @param context the application or service context
* @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
* @param modeId keyboard mode identifier
* @param width sets width of keyboard
* @param height sets height of keyboard
*/
public Keyboard(Context context, @XmlRes int xmlLayoutResId, int modeId, int width,
int height) {
mDisplayWidth = width;
mDisplayHeight = height;
mDefaultHorizontalGap = 0;
mDefaultWidth = mDisplayWidth / 10;
mDefaultVerticalGap = 0;
mDefaultHeight = mDefaultWidth;
mKeys = new ArrayList<>();
mModifierKeys = new ArrayList<>();
mKeyboardMode = modeId;
loadKeyboard(context, context.getResources().getXml(xmlLayoutResId));
}
/**
* Creates a keyboard from the given xml key layout file. Weeds out rows
* that have a keyboard mode defined but don't match the specified mode.
* @param context the application or service context
* @param xmlLayoutResId the resource file that contains the keyboard layout and keys.
* @param modeId keyboard mode identifier
*/
public Keyboard(Context context, @XmlRes int xmlLayoutResId, int modeId) {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
mDisplayWidth = dm.widthPixels;
mDisplayHeight = dm.heightPixels;
//Log.v(TAG, "keyboard's display metrics:" + dm);
mDefaultHorizontalGap = 0;
mDefaultWidth = mDisplayWidth / 10;
mDefaultVerticalGap = 0;
mDefaultHeight = mDefaultWidth;
mKeys = new ArrayList<>();
mModifierKeys = new ArrayList<>();
mKeyboardMode = modeId;
loadKeyboard(context, context.getResources().getXml(xmlLayoutResId));
}
/**
* <p>Creates a blank keyboard from the given resource file and populates it with the specified
* characters in left-to-right, top-to-bottom fashion, using the specified number of columns.
* </p>
* <p>If the specified number of columns is -1, then the keyboard will fit as many keys as
* possible in each row.</p>
* @param context the application or service context
* @param layoutTemplateResId the layout template file, containing no keys.
* @param characters the list of characters to display on the keyboard. One key will be created
* for each character.
* @param columns the number of columns of keys to display. If this number is greater than the
* number of keys that can fit in a row, it will be ignored. If this number is -1, the
* keyboard will fit as many keys as possible in each row.
*/
public Keyboard(Context context, int layoutTemplateResId,
CharSequence characters, int columns, int horizontalPadding) {
this(context, layoutTemplateResId);
int x = 0;
int y = 0;
int column = 0;
mTotalWidth = 0;
Row row = new Row(this);
row.defaultHeight = mDefaultHeight;
row.defaultWidth = mDefaultWidth;
row.defaultHorizontalGap = mDefaultHorizontalGap;
row.verticalGap = mDefaultVerticalGap;
row.rowEdgeFlags = EDGE_TOP | EDGE_BOTTOM;
final int maxColumns = columns == -1 ? Integer.MAX_VALUE : columns;
for (int i = 0; i < characters.length(); i++) {
char c = characters.charAt(i);
if (column >= maxColumns
|| x + mDefaultWidth + horizontalPadding > mDisplayWidth) {
x = 0;
y += mDefaultVerticalGap + mDefaultHeight;
column = 0;
}
final Key key = new Key(row);
key.x = x;
key.y = y;
key.label = String.valueOf(c);
key.codes = new int[] { c };
column++;
x += key.width + key.gap;
mKeys.add(key);
row.mKeys.add(key);
if (x > mTotalWidth) {
mTotalWidth = x;
}
}
mTotalHeight = y + mDefaultHeight;
rows.add(row);
}
final void resize(int newWidth, int newHeight) {
int numRows = rows.size();
for (int rowIndex = 0; rowIndex < numRows; ++rowIndex) {
Row row = rows.get(rowIndex);
int numKeys = row.mKeys.size();
int totalGap = 0;
int totalWidth = 0;
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) {
Key key = row.mKeys.get(keyIndex);
if (keyIndex > 0) {
totalGap += key.gap;
}
totalWidth += key.width;
}
if (totalGap + totalWidth > newWidth) {
int x = 0;
float scaleFactor = (float)(newWidth - totalGap) / totalWidth;
for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) {
Key key = row.mKeys.get(keyIndex);
key.width *= scaleFactor;
key.x = x;
x += key.width + key.gap;
}
}
}
mTotalWidth = newWidth;
// TODO: This does not adjust the vertical placement according to the new size.
// The main problem in the previous code was horizontal placement/size, but we should
// also recalculate the vertical sizes/positions when we get this resize call.
}
public List<Key> getKeys() {
return mKeys;
}
public List<Key> getModifierKeys() {
return mModifierKeys;
}
protected int getHorizontalGap() {
return mDefaultHorizontalGap;
}
protected void setHorizontalGap(int gap) {
mDefaultHorizontalGap = gap;
}
protected int getVerticalGap() {
return mDefaultVerticalGap;
}
protected void setVerticalGap(int gap) {
mDefaultVerticalGap = gap;
}
protected int getKeyHeight() {
return mDefaultHeight;
}
protected void setKeyHeight(int height) {
mDefaultHeight = height;
}
protected int getKeyWidth() {
return mDefaultWidth;
}
protected void setKeyWidth(int width) {
mDefaultWidth = width;
}
/**
* Returns the total height of the keyboard
* @return the total height of the keyboard
*/
public int getHeight() {
return mTotalHeight;
}
public int getMinWidth() {
return mTotalWidth;
}
public boolean setShifted(boolean shiftState) {
for (Key shiftKey : mShiftKeys) {
if (shiftKey != null) {
shiftKey.on = shiftState;
}
}
if (mShifted != shiftState) {
mShifted = shiftState;
return true;
}
return false;
}
public boolean isShifted() {
return mShifted;
}
/**
* @hide
*/
public int[] getShiftKeyIndices() {
return mShiftKeyIndices;
}
public int getShiftKeyIndex() {
return mShiftKeyIndices[0];
}
private void computeNearestNeighbors() {
// Round-up so we don't have any pixels outside the grid
mCellWidth = (getMinWidth() + GRID_WIDTH - 1) / GRID_WIDTH;
mCellHeight = (getHeight() + GRID_HEIGHT - 1) / GRID_HEIGHT;
mGridNeighbors = new int[GRID_SIZE][];
int[] indices = new int[mKeys.size()];
final int gridWidth = GRID_WIDTH * mCellWidth;
final int gridHeight = GRID_HEIGHT * mCellHeight;
for (int x = 0; x < gridWidth; x += mCellWidth) {
for (int y = 0; y < gridHeight; y += mCellHeight) {
int count = 0;
for (int i = 0; i < mKeys.size(); i++) {
final Key key = mKeys.get(i);
if (key.squaredDistanceFrom(x, y) < mProximityThreshold ||
key.squaredDistanceFrom(x + mCellWidth - 1, y) < mProximityThreshold ||
key.squaredDistanceFrom(x + mCellWidth - 1, y + mCellHeight - 1)
< mProximityThreshold ||
key.squaredDistanceFrom(x, y + mCellHeight - 1) < mProximityThreshold) {
indices[count++] = i;
}
}
int [] cell = new int[count];
System.arraycopy(indices, 0, cell, 0, count);
mGridNeighbors[(y / mCellHeight) * GRID_WIDTH + (x / mCellWidth)] = cell;
}
}
}
/**
* Returns the indices of the keys that are closest to the given point.
* @param x the x-coordinate of the point
* @param y the y-coordinate of the point
* @return the array of integer indices for the nearest keys to the given point. If the given
* point is out of range, then an array of size zero is returned.
*/
public int[] getNearestKeys(int x, int y) {
if (mGridNeighbors == null) computeNearestNeighbors();
if (x >= 0 && x < getMinWidth() && y >= 0 && y < getHeight()) {
int index = (y / mCellHeight) * GRID_WIDTH + (x / mCellWidth);
if (index < GRID_SIZE) {
return mGridNeighbors[index];
}
}
return new int[0];
}
protected Row createRowFromXml(Resources res, XmlResourceParser parser) {
return new Row(res, this, parser);
}
protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
XmlResourceParser parser) {
return new Key(res, parent, x, y, parser);
}
private void loadKeyboard(Context context, XmlResourceParser parser) {
boolean inKey = false;
boolean inRow = false;
boolean leftMostKey = false;
int row = 0;
int x = 0;
int y = 0;
Key key = null;
Row currentRow = null;
Resources res = context.getResources();
boolean skipRow = false;
try {
int event;
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
if (event == XmlResourceParser.START_TAG) {
String tag = parser.getName();
if (TAG_ROW.equals(tag)) {
inRow = true;
x = 0;
currentRow = createRowFromXml(res, parser);
rows.add(currentRow);
skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode;
if (skipRow) {
skipToEndOfRow(parser);
inRow = false;
}
} else if (TAG_KEY.equals(tag)) {
inKey = true;
key = createKeyFromXml(res, currentRow, x, y, parser);
mKeys.add(key);
if (key.codes[0] == KEYCODE_SHIFT) {
// Find available shift key slot and put this shift key in it
for (int i = 0; i < mShiftKeys.length; i++) {
if (mShiftKeys[i] == null) {
mShiftKeys[i] = key;
mShiftKeyIndices[i] = mKeys.size()-1;
break;
}
}
mModifierKeys.add(key);
} else if (key.codes[0] == KEYCODE_ALT) {
mModifierKeys.add(key);
}
currentRow.mKeys.add(key);
} else if (TAG_KEYBOARD.equals(tag)) {
parseKeyboardAttributes(res, parser);
}
} else if (event == XmlResourceParser.END_TAG) {
if (inKey) {
inKey = false;
x += key.gap + key.width;
if (x > mTotalWidth) {
mTotalWidth = x;
}
} else if (inRow) {
inRow = false;
y += currentRow.verticalGap;
y += currentRow.defaultHeight;
row++;
} else {
// TODO: error or extend?
}
}
}
} catch (Exception e) {
Log.e(TAG, "Parse error:" + e);
e.printStackTrace();
}
mTotalHeight = y - mDefaultVerticalGap;
}
private void skipToEndOfRow(XmlResourceParser parser)
throws XmlPullParserException, IOException {
int event;
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
if (event == XmlResourceParser.END_TAG
&& parser.getName().equals(TAG_ROW)) {
break;
}
}
}
private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) {
TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.King_Keyboard);
mDefaultWidth = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyWidth,
mDisplayWidth, mDisplayWidth / 10);
mDefaultHeight = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_keyHeight,
mDisplayHeight, 50);
mDefaultHorizontalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_horizontalGap,
mDisplayWidth, 0);
mDefaultVerticalGap = getDimensionOrFraction(a,
R.styleable.King_Keyboard_android_verticalGap,
mDisplayHeight, 0);
mProximityThreshold = (int) (mDefaultWidth * SEARCH_DISTANCE);
mProximityThreshold = mProximityThreshold * mProximityThreshold; // Square it for comparison
a.recycle();
}
static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) {
TypedValue value = a.peekValue(index);
if (value == null) return defValue;
if (value.type == TypedValue.TYPE_DIMENSION) {
return a.getDimensionPixelOffset(index, defValue);
} else if (value.type == TypedValue.TYPE_FRACTION) {
// Round it to avoid values like 47.9999 from getting truncated
return Math.round(a.getFraction(index, base, base, defValue));
}
return defValue;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,55 @@
package com.king.keyboard
import android.content.Context
import android.util.SparseArray
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.annotation.RequiresApi
/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
/**
* 判断是否是小写字母
*/
fun Char.isLowerCase(c: Char): Boolean{
return c.toInt() in 97..122
}
/**
* 判断是否是大写字母
*/
fun Char.isUpperCase(c: Char): Boolean{
return c.toInt() in 65..90
}
/**
* 显示系统输入法
*/
fun View.showSystemInputMethod(){
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(this,InputMethodManager.SHOW_IMPLICIT)
}
/**
* 隐藏系统输入法
*/
fun View.hideSystemInputMethod(){
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(windowToken,0)
}
var View.isVisible: Boolean
get() = visibility == View.VISIBLE
set(value) {
visibility = if (value) View.VISIBLE else View.GONE
}
/** Returns true if the collection contains [key]. */
@RequiresApi(16)
fun <T> SparseArray<T>.containsKey(key: Int) = indexOfKey(key) >= 0
/** Allows the use of the index operator for storing values in the collection. */
@RequiresApi(16)
operator fun <T> SparseArray<T>.set(key: Int, value: T) = put(key, value)
@@ -0,0 +1,316 @@
package com.king.keyboard
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
open class KingKeyboardView : KeyboardView {
private var isCap = false
private var isAllCaps = false
private lateinit var config: Config
private val paint by lazy { Paint() }
companion object {
const val iconRatio = 0.5f
}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes){
init(context, attrs)
}
private fun init(context: Context, attrs: AttributeSet?) {
config = Config(context)
var a = context.obtainStyledAttributes(attrs, R.styleable.KingKeyboardView)
a.indexCount.let {
config.run {
for (i in 0 until it) {
when (val attr = a.getIndex(i)) {
R.styleable.KingKeyboardView_kkbDeleteDrawable -> deleteDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCapitalDrawable -> capitalDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCapitalLockDrawable -> capitalLockDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCancelDrawable -> cancelDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbCancelDrawable -> spaceDrawable = a.getDrawable(attr)
R.styleable.KingKeyboardView_android_labelTextSize -> labelTextSize = a.getDimensionPixelSize(attr, labelTextSize)
R.styleable.KingKeyboardView_android_keyTextSize -> keyTextSize = a.getDimensionPixelSize(attr, keyTextSize)
R.styleable.KingKeyboardView_android_keyTextColor -> keyTextColor = a.getColor(attr, keyTextColor)
R.styleable.KingKeyboardView_kkbKeyIconColor -> keyIconColor = a.getColor(attr, ContextCompat.getColor(context, R.color.king_keyboard_key_icon_color))
R.styleable.KingKeyboardView_kkbKeySpecialTextColor -> keySpecialTextColor = a.getColor(attr, keySpecialTextColor)
R.styleable.KingKeyboardView_kkbKeyDoneTextColor -> keyDoneTextColor = a.getColor(attr, keyDoneTextColor)
R.styleable.KingKeyboardView_kkbKeyNoneTextColor -> keyNoneTextColor = a.getColor(attr, keyNoneTextColor)
R.styleable.KingKeyboardView_android_keyBackground -> keyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbSpecialKeyBackground -> specialKeyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbDoneKeyBackground -> doneKeyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbNoneKeyBackground -> noneKeyBackground = a.getDrawable(attr)
R.styleable.KingKeyboardView_kkbKeyDoneTextSize -> keyDoneTextSize = a.getDimensionPixelSize(attr, keyDoneTextSize)
R.styleable.KingKeyboardView_kkbKeyDoneText -> keyDoneText = a.getString(attr)
}
}
}
a.recycle()
}
paint.textAlign = Paint.Align.CENTER
paint.isAntiAlias = true
}
fun getConfig(): Config {
return config
}
fun setConfig(config: Config) {
this.config = config
invalidate()
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
drawKeyboard(canvas, keyboard?.keys)
}
/**
* 绘制键盘
*/
private fun drawKeyboard(canvas: Canvas,keys: List<Keyboard.Key>?){
keys?.let {
for (key in it) {
drawKey(canvas, key)
}
}
}
/**
* 绘制键盘按键
*/
private fun drawKey(canvas: Canvas, key: Keyboard.Key) {
when (key.codes[0]) {
KingKeyboard.KEYCODE_SHIFT -> drawShiftKey(canvas, key)
KingKeyboard.KEYCODE_MODE_CHANGE -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
KingKeyboard.KEYCODE_CANCEL -> drawCancelKey(canvas, key)
KingKeyboard.KEYCODE_DONE -> drawDoneKey(canvas, key)
KingKeyboard.KEYCODE_DELETE -> drawDeleteKey(canvas, key)
KingKeyboard.KEYCODE_ALT -> drawAltKey(canvas, key)
KingKeyboard.KEYCODE_SPACE -> drawKey(canvas, key, config.keyBackground, config.keyTextColor, config.spaceDrawable)
KingKeyboard.KEYCODE_NONE -> drawNoneKey(canvas, key)
KingKeyboard.KEYCODE_MODE_BACK -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
KingKeyboard.KEYCODE_BACK -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
KingKeyboard.KEYCODE_MORE -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
in -399..-300 -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
// else -> drawKey(canvas,key,keyBackground)
}
}
/**
* 绘制Cancel键,常见于关闭键盘键
*/
private fun drawCancelKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.cancelDrawable)
}
/**
* 绘制Done键,常见于右下角蓝色的“确定”按键
*/
private fun drawDoneKey(canvas: Canvas, key: Keyboard.Key) {
config.keyDoneText?.let {
key.label = it
}
drawKey(canvas, key, config.doneKeyBackground, config.keyDoneTextColor, null, true)
}
/**
* 绘制Delete键
*/
private fun drawNoneKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.noneKeyBackground, config.keyNoneTextColor)
}
/**
* 绘制Alt键
*/
private fun drawAltKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor)
}
/**
* 绘制Delete键
*/
private fun drawDeleteKey(canvas: Canvas, key: Keyboard.Key) {
drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.deleteDrawable)
}
/**
* 绘制Shift键
*/
private fun drawShiftKey(canvas: Canvas, key: Keyboard.Key) {
when {
isAllCaps -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.capitalLockDrawable)
isCap -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.capitalDrawable)
else -> drawKey(canvas, key, config.specialKeyBackground, config.keySpecialTextColor, config.lowerDrawable)
}
}
/**
* 绘制键盘按键
*/
private fun drawKey(canvas: Canvas, key: Keyboard.Key, keyBackground: Drawable?, textColor: Int, iconDrawable: Drawable? = key.icon, isDone: Boolean = false) {
//绘制按键背景
keyBackground?.run {
if (key.codes[0] != 0) {
state = key.currentDrawableState
}
setBounds(
key.x.plus(paddingLeft),
key.y.plus(paddingTop),
key.x.plus(paddingLeft).plus(key.width),
key.y.plus(paddingTop).plus(key.height)
)
draw(canvas)
}
//绘制键盘图标
iconDrawable?.run {
val drawable = DrawableCompat.wrap(this)
config.keyIconColor?.takeIf { it != 0 }?.let {
drawable.setTint(it)
}
key.icon = drawable
var iconWidth = key.icon.intrinsicWidth.toFloat()
var iconHeight = key.icon.intrinsicHeight.toFloat()
val widthRatio = iconWidth.div(key.width.toFloat())
val heightRatio = iconHeight.div(key.height.toFloat())
if (widthRatio <= heightRatio) {//当图标的宽占比小于等于高占比时,以高度比例为基准并控制在iconRatio比例范围内,进行同比例缩放
val ratio = heightRatio.coerceAtMost(iconRatio)
iconWidth = iconWidth.div(heightRatio).times(ratio)
iconHeight = iconHeight.div(heightRatio).times(ratio)
} else {//反之,则以宽度比例为基准并控制在iconRatio比例范围内,进行同比例缩放
val ratio = widthRatio.coerceAtMost(iconRatio)
iconWidth = iconWidth.div(widthRatio).times(ratio)
iconHeight = iconHeight.div(widthRatio).times(ratio)
}
val left = key.x.plus(paddingLeft).plus(key.width.minus(iconWidth).div(2f)).toInt()
val top = key.y.plus(paddingTop).plus(key.height.minus(iconHeight).div(2f)).toInt()
val right = left.plus(iconWidth).toInt()
val bottom = top.plus(iconHeight).toInt()
key.icon.setBounds(left, top, right, bottom)
key.icon.draw(canvas)
} ?: key.label?.let {
//绘制键盘文字
if (isDone) {
paint.textSize = config.keyDoneTextSize.toFloat()
} else if (it.length > 1 && key.codes.size < 2) {// 键盘key内容多个字符
paint.textSize = config.labelTextSize.toFloat()
} else {
paint.textSize = config.keyTextSize.toFloat()
}
paint.color = textColor
paint.typeface = Typeface.DEFAULT
canvas.drawText(
it.toString(),
key.x.plus(paddingLeft).plus(key.width.div(2f)),
key.y.plus(paddingTop).plus(key.height.div(2.0f)).plus(
paint.textSize.minus(paint.descent()).div(2.0f)
),
paint
)
}
}
fun setCap(isCap: Boolean) {
this.isCap = isCap
}
fun isCap(): Boolean {
return isCap
}
fun setAllCaps(isAllCaps: Boolean) {
this.isAllCaps = isAllCaps
}
fun isAllCaps(): Boolean {
return isAllCaps
}
/**
* Config为KingKeyboard的配置类,方便统一管理配置信息
*/
open class Config(context: Context) {
var deleteDrawable = context.getDrawable(R.drawable.king_keyboard_key_delete)
var lowerDrawable = context.getDrawable(R.drawable.king_keyboard_key_lower)
var capitalDrawable = context.getDrawable(R.drawable.king_keyboard_key_cap)
var capitalLockDrawable = context.getDrawable(R.drawable.king_keyboard_key_all_caps)
var cancelDrawable = context.getDrawable(R.drawable.king_keyboard_key_cancel)
var spaceDrawable = context.getDrawable(R.drawable.king_keyboard_key_space)
var labelTextSize = context.resources.getDimensionPixelSize(R.dimen.king_keyboard_label_text_size)
var keyTextSize = context.resources.getDimensionPixelSize(R.dimen.king_keyboard_text_size)
var keyTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_text_color)
var keyIconColor: Int? = null
var keySpecialTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_special_text_color)
var keyDoneTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_done_text_color)
var keyNoneTextColor = ContextCompat.getColor(context, R.color.king_keyboard_key_none_text_color)
var keyBackground = context.getDrawable(R.drawable.king_keyboard_key_bg)
var specialKeyBackground = context.getDrawable(R.drawable.king_keyboard_special_key_bg)
var doneKeyBackground = context.getDrawable(R.drawable.king_keyboard_done_key_bg)
var noneKeyBackground = context.getDrawable(R.drawable.king_keyboard_none_key_bg)
var keyDoneTextSize = context.resources.getDimensionPixelSize(R.dimen.king_keyboard_done_text_size)
var keyDoneText: CharSequence? = context.getString(R.string.king_keyboard_key_done_text)
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_done_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_done_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_none_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_none_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_special_key_bg_pressed" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/king_keyboard_special_key_bg_normal" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/king_keyboard_view_bg">
<com.king.keyboard.KingKeyboardView
android:id="@+id/keyboardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:animateLayoutChanges="true"
android:paddingTop="@dimen/king_keyboard_view_padding_top"
android:paddingBottom="@dimen/king_keyboard_view_padding_bottom"
android:keyBackground="@drawable/king_keyboard_key_bg"
android:keyTextColor="@color/king_keyboard_key_text_color"
android:keyTextSize="@dimen/king_keyboard_text_size"
android:labelTextSize="@dimen/king_keyboard_label_text_size"/>
</RelativeLayout>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="king_keyboard_key_done_text">完成</string>
<string name="king_keyboard_key_more_text">更多</string>
<string name="king_keyboard_key_back_text">返回</string>
</resources>
+106
View File
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="KingKeyboardView">
<attr name="android:labelTextSize"/>
<attr name="android:keyTextSize"/>
<attr name="android:keyTextColor"/>
<attr name="android:keyBackground"/>
<attr name="kkbDeleteDrawable" format="reference"/>
<attr name="kkbCapitalDrawable" format="reference"/>
<attr name="kkbCapitalLockDrawable" format="reference"/>
<attr name="kkbCancelDrawable" format="reference"/>
<attr name="kkbSpaceDrawable" format="reference"/>
<attr name="kkbSpecialKeyBackground" format="reference"/>
<attr name="kkbDoneKeyBackground" format="reference"/>
<attr name="kkbNoneKeyBackground" format="reference"/>
<attr name="kkbKeyIconColor" format="color"/>
<attr name="kkbKeySpecialTextColor" format="color"/>
<attr name="kkbKeyDoneTextColor" format="color"/>
<attr name="kkbKeyDoneTextSize" format="dimension"/>
<attr name="kkbKeyNoneTextColor" format="color"/>
<attr name="kkbKeyDoneText" format="string"/>
</declare-styleable>
<declare-styleable name="King_KeyboardView">
<attr name="android:keyBackground"/>
<attr name="android:keyTextSize"/>
<attr name="android:labelTextSize" />
<attr name="android:keyTextColor"/>
<attr name="android:keyPreviewLayout" />
<attr name="android:keyPreviewOffset" />
<attr name="android:keyPreviewHeight" />
<attr name="android:verticalCorrection" />
<attr name="android:popupLayout" />
<attr name="android:shadowColor" />
<attr name="android:shadowRadius" />
</declare-styleable>
<declare-styleable name="King_KeyboardViewPreviewState">
<attr name="android:state_long_pressable"/>
</declare-styleable>
<declare-styleable name="King_Keyboard">
<attr name="android:keyWidth" />
<attr name="android:keyHeight" />
<attr name="android:horizontalGap" />
<attr name="android:verticalGap"/>
</declare-styleable>
<declare-styleable name="King_Keyboard_Row">
<attr name="android:rowEdgeFlags"/>
<attr name="android:keyboardMode"/>
</declare-styleable>
<declare-styleable name="King_Keyboard_Key">
<attr name="android:codes"/>
<attr name="android:popupKeyboard"/>
<attr name="android:popupCharacters" />
<attr name="android:keyEdgeFlags"/>
<attr name="android:isModifier" />
<attr name="android:isSticky" />
<attr name="android:isRepeatable" />
<attr name="android:iconPreview"/>
<attr name="android:keyOutputText" />
<attr name="android:keyLabel" />
<attr name="android:keyIcon"/>
<attr name="android:keyboardMode" />
</declare-styleable>
</resources>
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="king_keyboard_key_text_color">#ff333333</color>
<color name="king_keyboard_key_special_text_color">#ff333333</color>
<color name="king_keyboard_key_done_text_color">#ffeeeeee</color>
<color name="king_keyboard_key_none_text_color">#7f999999</color>
<color name="king_keyboard_key_icon_color">#ff333333</color>
<color name="king_keyboard_key_bg_normal">#ffffffff</color>
<color name="king_keyboard_key_bg_pressed">#ffbbbbbb</color>
<color name="king_keyboard_special_key_bg_normal">#ffa8afbf</color>
<color name="king_keyboard_special_key_bg_pressed">#ff989faf</color>
<color name="king_keyboard_done_key_bg_normal">#ff0477ff</color>
<color name="king_keyboard_done_key_bg_pressed">#ff0467ef</color>
<color name="king_keyboard_none_key_bg_normal">#ffefefef</color>
<color name="king_keyboard_none_key_bg_pressed">#ffefefef</color>
</resources>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="king_keyboard_key_height">48dp</dimen>
<dimen name="king_keyboard_key_height2">101dp</dimen>
<dimen name="king_keyboard_key_height3">154dp</dimen>
<dimen name="king_keyboard_vertical_gap">5dp</dimen>
<dimen name="king_keyboard_horizontal_gap">10dp</dimen>
<dimen name="king_keyboard_view_padding_top">6dp</dimen>
<dimen name="king_keyboard_view_padding_bottom">6dp</dimen>
<dimen name="king_keyboard_preview_height">56dp</dimen>
<dimen name="king_keyboard_text_size">20sp</dimen>
<dimen name="king_keyboard_done_text_size">20sp</dimen>
<dimen name="king_keyboard_label_text_size">16sp</dimen>
</resources>
@@ -0,0 +1,5 @@
<resources>
<string name="king_keyboard_key_done_text">Done</string>
<string name="king_keyboard_key_more_text">More</string>
<string name="king_keyboard_key_back_text">Back</string>
</resources>
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="88"
android:keyLabel="X" />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="13%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:keyWidth="11.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="98"
android:keyLabel="b"
android:keyWidth="11.4%p"/>
<Key
android:codes="99"
android:keyLabel="c"
android:keyWidth="11.3%p"/>
<Key
android:codes="100"
android:keyLabel="d"
android:keyWidth="11.3%p"/>
<Key
android:codes="101"
android:keyLabel="e"
android:keyWidth="11.3%p"/>
<Key
android:codes="102"
android:keyLabel="f"
android:keyWidth="11.3%p"/>
<Key
android:codes="103"
android:keyLabel="g"
android:keyWidth="11.4%p"/>
<Key
android:codes="104"
android:keyLabel="h"
android:keyWidth="11.5%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="105"
android:keyLabel="i"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="106"
android:keyLabel="j" />
<Key
android:codes="107"
android:keyLabel="k" />
<Key
android:codes="108"
android:keyLabel="l" />
<Key
android:codes="109"
android:keyLabel="m" />
<Key
android:codes="110"
android:keyLabel="n" />
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="112"
android:keyLabel="p"
android:keyWidth="13.5%p"/>
<Key
android:codes="113"
android:keyLabel="q" />
<Key
android:codes="114"
android:keyLabel="r" />
<Key
android:codes="115"
android:keyLabel="s" />
<Key
android:codes="116"
android:keyLabel="t" />
<Key
android:codes="117"
android:keyLabel="u" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-1"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="118"
android:keyLabel="v" />
<Key
android:codes="119"
android:keyLabel="w" />
<Key
android:codes="120"
android:keyLabel="x" />
<Key
android:codes="121"
android:keyLabel="y" />
<Key
android:codes="122"
android:keyLabel="z" />
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2"
android:keyWidth="8.9%p" />
<Key
android:codes="51"
android:keyLabel="3"
android:keyWidth="8.9%p" />
<Key
android:codes="52"
android:keyLabel="4"
android:keyWidth="8.9%p" />
<Key
android:codes="53"
android:keyLabel="5"
android:keyWidth="8.9%p" />
<Key
android:codes="54"
android:keyLabel="6"
android:keyWidth="8.9%p" />
<Key
android:codes="55"
android:keyLabel="7"
android:keyWidth="8.9%p" />
<Key
android:codes="56"
android:keyLabel="8"
android:keyWidth="8.9%p" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="8.9%p" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="113"
android:keyLabel="q"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="119"
android:keyLabel="w"
android:keyWidth="8.9%p"/>
<Key
android:codes="101"
android:keyLabel="e"
android:keyWidth="8.9%p" />
<Key
android:codes="114"
android:keyWidth="8.9%p"
android:keyLabel="r" />
<Key
android:codes="116"
android:keyLabel="t"
android:keyWidth="8.9%p"/>
<Key
android:codes="121"
android:keyLabel="y"
android:keyWidth="8.9%p"/>
<Key
android:codes="117"
android:keyLabel="u"
android:keyWidth="8.9%p"/>
<Key
android:codes="105"
android:keyLabel="i"
android:keyWidth="8.9%p"/>
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="8.9%p"/>
<Key
android:codes="112"
android:keyLabel="p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="115"
android:keyLabel="s"
android:keyWidth="8.9%p"/>
<Key
android:codes="100"
android:keyLabel="d"
android:keyWidth="8.9%p"/>
<Key
android:codes="102"
android:keyLabel="f"
android:keyWidth="8.9%p"/>
<Key
android:codes="103"
android:keyLabel="g"
android:keyWidth="8.9%p"/>
<Key
android:codes="104"
android:keyLabel="h"
android:keyWidth="8.9%p"/>
<Key
android:codes="106"
android:keyLabel="j"
android:keyWidth="8.9%p"/>
<Key
android:codes="107"
android:keyLabel="k"
android:keyWidth="8.9%p"/>
<Key
android:codes="108"
android:keyLabel="l"
android:keyWidth="8.9%p"/>
<Key
android:codes="-5"
android:keyWidth="8.9%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-1"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="122"
android:keyLabel="z"
android:keyWidth="9%p"/>
<Key
android:codes="120"
android:keyLabel="x"
android:keyWidth="9%p"/>
<Key
android:codes="99"
android:keyLabel="c"
android:keyWidth="9%p"/>
<Key
android:codes="118"
android:keyLabel="v"
android:keyWidth="9%p"/>
<Key
android:codes="98"
android:keyLabel="b"
android:keyWidth="9%p"/>
<Key
android:codes="110"
android:keyLabel="n"
android:keyWidth="9%p"/>
<Key
android:codes="109"
android:keyLabel="m"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="0x4eac"
android:keyLabel="京"
android:keyEdgeFlags="left" />
<Key
android:codes="0x6d25"
android:keyLabel="津" />
<Key
android:codes="0x6caa"
android:keyLabel="沪" />
<Key
android:codes="0x6e1d"
android:keyLabel="渝" />
<Key
android:codes="0x5180"
android:keyLabel="冀" />
<Key
android:codes="0x8c6b"
android:keyLabel="豫" />
<Key
android:codes="0x4e91"
android:keyLabel="云" />
<Key
android:codes="0x8fbd"
android:keyLabel="辽" />
<Key
android:codes="0x9ed1"
android:keyLabel="黑" />
<Key
android:codes="0x6e58"
android:keyLabel="湘"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x7696"
android:keyLabel="皖"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9c81"
android:keyLabel="鲁" />
<Key
android:codes="0x65b0"
android:keyLabel="新" />
<Key
android:codes="0x82cf"
android:keyLabel="苏" />
<Key
android:codes="0x6d59"
android:keyLabel="浙" />
<Key
android:codes="0x8d63"
android:keyLabel="赣" />
<Key
android:codes="0x9102"
android:keyLabel="鄂" />
<Key
android:codes="0x6842"
android:keyLabel="桂" />
<Key
android:codes="0x7518"
android:keyLabel="甘" />
<Key
android:codes="0x664b"
android:keyLabel="晋"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-103"
android:keyLabel="@string/king_keyboard_key_more_text"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x8499"
android:keyLabel="蒙"
android:keyWidth="9%p"/>
<Key
android:codes="0x9655"
android:keyLabel="陕"
android:keyWidth="9%p"/>
<Key
android:codes="0x5409"
android:keyLabel="吉"
android:keyWidth="9%p"/>
<Key
android:codes="0x95fd"
android:keyLabel="闽"
android:keyWidth="9%p"/>
<Key
android:codes="0x8d35"
android:keyLabel="贵"
android:keyWidth="9%p"/>
<Key
android:codes="0x7ca4"
android:keyLabel="粤"
android:keyWidth="9%p"/>
<Key
android:codes="0x9752"
android:keyLabel="青"
android:keyWidth="9%p"/>
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-2"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate_number"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x85cf"
android:keyLabel="藏"
android:keyWidth="9%p"/>
<Key
android:codes="0x5ddd"
android:keyLabel="川"
android:keyWidth="9%p"/>
<Key
android:codes="0x5b81"
android:keyLabel="宁"
android:keyWidth="9%p"/>
<Key
android:codes="0x743c"
android:keyLabel="琼"
android:keyWidth="9%p"/>
<Key
android:codes="0x6e2f"
android:keyLabel="港"
android:keyWidth="9%p"/>
<Key
android:codes="0x6fb3"
android:keyLabel="澳"
android:keyWidth="9%p"/>
<Key
android:codes="0x6302"
android:keyLabel="挂"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="0x4eac"
android:keyLabel="京"
android:keyEdgeFlags="left" />
<Key
android:codes="0x6d25"
android:keyLabel="津" />
<Key
android:codes="0x6caa"
android:keyLabel="沪" />
<Key
android:codes="0x6e1d"
android:keyLabel="渝" />
<Key
android:codes="0x5180"
android:keyLabel="冀" />
<Key
android:codes="0x8c6b"
android:keyLabel="豫" />
<Key
android:codes="0x4e91"
android:keyLabel="云" />
<Key
android:codes="0x8fbd"
android:keyLabel="辽" />
<Key
android:codes="0x9ed1"
android:keyLabel="黑" />
<Key
android:codes="0x6e58"
android:keyLabel="湘"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x7696"
android:keyLabel="皖"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9c81"
android:keyLabel="鲁" />
<Key
android:codes="0x65b0"
android:keyLabel="新" />
<Key
android:codes="0x82cf"
android:keyLabel="苏" />
<Key
android:codes="0x6d59"
android:keyLabel="浙" />
<Key
android:codes="0x8d63"
android:keyLabel="赣" />
<Key
android:codes="0x9102"
android:keyLabel="鄂" />
<Key
android:codes="0x6842"
android:keyLabel="桂" />
<Key
android:codes="0x7518"
android:keyLabel="甘" />
<Key
android:codes="0x664b"
android:keyLabel="晋"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-102"
android:keyLabel="@string/king_keyboard_key_back_text"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x8499"
android:keyLabel="蒙"
android:keyWidth="9%p"/>
<Key
android:codes="0x9655"
android:keyLabel="陕"
android:keyWidth="9%p"/>
<Key
android:codes="0x5409"
android:keyLabel="吉"
android:keyWidth="9%p"/>
<Key
android:codes="0x95fd"
android:keyLabel="闽"
android:keyWidth="9%p"/>
<Key
android:codes="0x8d35"
android:keyLabel="贵"
android:keyWidth="9%p"/>
<Key
android:codes="0x7ca4"
android:keyLabel="粤"
android:keyWidth="9%p"/>
<Key
android:codes="0x9752"
android:keyLabel="青"
android:keyWidth="9%p"/>
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-2"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate_number"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x4f7f"
android:keyLabel="使"
android:keyWidth="9%p"/>
<Key
android:codes="0x9886"
android:keyLabel="领"
android:keyWidth="9%p"/>
<Key
android:codes="0x5b66"
android:keyLabel="学"
android:keyWidth="9%p"/>
<Key
android:codes="0x8b66"
android:keyLabel="警"
android:keyWidth="9%p"/>
<Key
android:codes="0x8bd5"
android:keyLabel="试"
android:keyWidth="9%p"/>
<Key
android:codes="0x8d85"
android:keyLabel="超"
android:keyWidth="9%p"/>
<Key
android:codes="0x4e34"
android:keyLabel="临"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="52"
android:keyLabel="4" />
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="55"
android:keyLabel="7" />
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="81"
android:keyLabel="Q"
android:keyEdgeFlags="left" />
<Key
android:codes="87"
android:keyLabel="W" />
<Key
android:codes="69"
android:keyLabel="E" />
<Key
android:codes="82"
android:keyLabel="R" />
<Key
android:codes="84"
android:keyLabel="T" />
<Key
android:codes="89"
android:keyLabel="Y" />
<Key
android:codes="85"
android:keyLabel="U" />
<Key
android:codes="0"
android:keyLabel="I" />
<Key
android:codes="0"
android:keyLabel="O" />
<Key
android:codes="80"
android:keyLabel="P"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="65"
android:keyLabel="A"
android:keyEdgeFlags="left" />
<Key
android:codes="83"
android:keyLabel="S" />
<Key
android:codes="68"
android:keyLabel="D" />
<Key
android:codes="70"
android:keyLabel="F" />
<Key
android:codes="71"
android:keyLabel="G" />
<Key
android:codes="72"
android:keyLabel="H" />
<Key
android:codes="74"
android:keyLabel="J" />
<Key
android:codes="75"
android:keyLabel="K" />
<Key
android:codes="76"
android:keyLabel="L" />
<Key
android:codes="-5"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-102"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="90"
android:keyLabel="Z"
android:keyWidth="9%p"/>
<Key
android:codes="88"
android:keyLabel="X"
android:keyWidth="9%p"/>
<Key
android:codes="67"
android:keyLabel="C"
android:keyWidth="9%p"/>
<Key
android:codes="86"
android:keyLabel="V"
android:keyWidth="9%p"/>
<Key
android:codes="66"
android:keyLabel="B"
android:keyWidth="9%p"/>
<Key
android:codes="78"
android:keyLabel="N"
android:keyWidth="9%p"/>
<Key
android:codes="77"
android:keyLabel="M"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="0x4eac"
android:keyLabel="京"
android:keyEdgeFlags="left" />
<Key
android:codes="0x6d25"
android:keyLabel="津" />
<Key
android:codes="0x6caa"
android:keyLabel="沪" />
<Key
android:codes="0x6e1d"
android:keyLabel="渝" />
<Key
android:codes="0x5180"
android:keyLabel="冀" />
<Key
android:codes="0x8c6b"
android:keyLabel="豫" />
<Key
android:codes="0x4e91"
android:keyLabel="云" />
<Key
android:codes="0x8fbd"
android:keyLabel="辽" />
<Key
android:codes="0x9ed1"
android:keyLabel="黑" />
<Key
android:codes="0x6e58"
android:keyLabel="湘"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x7696"
android:keyLabel="皖"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9c81"
android:keyLabel="鲁" />
<Key
android:codes="0x65b0"
android:keyLabel="新" />
<Key
android:codes="0x82cf"
android:keyLabel="苏" />
<Key
android:codes="0x6d59"
android:keyLabel="浙" />
<Key
android:codes="0x8d63"
android:keyLabel="赣" />
<Key
android:codes="0x9102"
android:keyLabel="鄂" />
<Key
android:codes="0x6842"
android:keyLabel="桂" />
<Key
android:codes="0x7518"
android:keyLabel="甘" />
<Key
android:codes="0x664b"
android:keyLabel="晋"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="0x8499"
android:keyLabel="蒙"
android:keyEdgeFlags="left" />
<Key
android:codes="0x9655"
android:keyLabel="陕" />
<Key
android:codes="0x5409"
android:keyLabel="吉" />
<Key
android:codes="0x95fd"
android:keyLabel="闽" />
<Key
android:codes="0x8d35"
android:keyLabel="贵" />
<Key
android:codes="0x7ca4"
android:keyLabel="粤" />
<Key
android:codes="0x9752"
android:keyLabel="青" />
<Key
android:codes="0x85cf"
android:keyLabel="藏" />
<Key
android:codes="0x5ddd"
android:keyLabel="川" />
<Key
android:codes="-5"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="-2"
android:keyWidth="13.5%p"
android:keyIcon="@drawable/king_keyboard_key_license_plate_number"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="0x5b81"
android:keyLabel="宁"
android:keyWidth="9%p"/>
<Key
android:codes="0x743c"
android:keyLabel="琼"
android:keyWidth="9%p"/>
<Key
android:codes="0x6e2f"
android:keyLabel="港"
android:keyWidth="9%p"/>
<Key
android:codes="0x6fb3"
android:keyLabel="澳"
android:keyWidth="9%p"/>
<Key
android:codes="0x6302"
android:keyLabel="挂"
android:keyWidth="9%p"/>
<Key
android:codes="0x5b66"
android:keyLabel="学"
android:keyWidth="9%p"/>
<Key
android:codes="0x8b66"
android:keyLabel="警"
android:keyWidth="9%p"/>
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="13%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:keyWidth="13.5%p" />
<Key
android:codes="98"
android:keyLabel="b" />
<Key
android:codes="99"
android:keyLabel="c" />
<Key
android:codes="100"
android:keyLabel="d" />
<Key
android:codes="101"
android:keyLabel="e" />
<Key
android:codes="102"
android:keyLabel="f" />
<Key
android:codes="103"
android:keyLabel="g"
android:keyWidth="13.5%p" />
</Row>
<Row>
<Key
android:codes="104"
android:keyLabel="h"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="105"
android:keyLabel="i" />
<Key
android:codes="106"
android:keyLabel="j" />
<Key
android:codes="107"
android:keyLabel="k" />
<Key
android:codes="108"
android:keyLabel="l" />
<Key
android:codes="109"
android:keyLabel="m" />
<Key
android:codes="110"
android:keyLabel="n"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="112"
android:keyLabel="p" />
<Key
android:codes="113"
android:keyLabel="q" />
<Key
android:codes="114"
android:keyLabel="r" />
<Key
android:codes="115"
android:keyLabel="s" />
<Key
android:codes="116"
android:keyLabel="t" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="117"
android:keyLabel="u"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="118"
android:keyLabel="v" />
<Key
android:codes="119"
android:keyLabel="w" />
<Key
android:codes="120"
android:keyLabel="x" />
<Key
android:codes="121"
android:keyLabel="y" />
<Key
android:codes="122"
android:keyLabel="z" />
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="113"
android:keyLabel="q"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="119"
android:keyLabel="w"
android:keyWidth="8.9%p"/>
<Key
android:codes="101"
android:keyLabel="e"
android:keyWidth="8.9%p" />
<Key
android:codes="114"
android:keyWidth="8.9%p"
android:keyLabel="r" />
<Key
android:codes="116"
android:keyLabel="t"
android:keyWidth="8.9%p"/>
<Key
android:codes="121"
android:keyLabel="y"
android:keyWidth="8.9%p"/>
<Key
android:codes="117"
android:keyLabel="u"
android:keyWidth="8.9%p"/>
<Key
android:codes="105"
android:keyLabel="i"
android:keyWidth="8.9%p"/>
<Key
android:codes="111"
android:keyLabel="o"
android:keyWidth="8.9%p"/>
<Key
android:codes="112"
android:keyLabel="p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="97"
android:keyLabel="a"
android:horizontalGap="5.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="115"
android:keyLabel="s" />
<Key
android:codes="100"
android:keyLabel="d" />
<Key
android:codes="102"
android:keyLabel="f" />
<Key
android:codes="103"
android:keyLabel="g" />
<Key
android:codes="104"
android:keyLabel="h" />
<Key
android:codes="106"
android:keyLabel="j" />
<Key
android:codes="107"
android:keyLabel="k" />
<Key
android:codes="108"
android:keyLabel="l"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-1"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="122"
android:keyLabel="z" />
<Key
android:codes="120"
android:keyLabel="x" />
<Key
android:codes="99"
android:keyLabel="c" />
<Key
android:codes="118"
android:keyLabel="v" />
<Key
android:codes="98"
android:keyLabel="b" />
<Key
android:codes="110"
android:keyLabel="n" />
<Key
android:codes="109"
android:keyLabel="m" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-2"
android:keyLabel="\?123"
android:keyWidth="17%p" />
<Key
android:codes="46"
android:keyLabel="."
android:keyWidth="12%p" />
<Key
android:codes="32"
android:keyWidth="36%p"
android:isRepeatable="false"/>
<Key
android:codes="63"
android:keyLabel="\?"
android:keyWidth="12%p" />
<Key
android:codes="-3"
android:keyWidth="17%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2"
android:keyWidth="8.9%p" />
<Key
android:codes="51"
android:keyLabel="3"
android:keyWidth="8.9%p" />
<Key
android:codes="52"
android:keyLabel="4"
android:keyWidth="8.9%p" />
<Key
android:codes="53"
android:keyLabel="5"
android:keyWidth="8.9%p" />
<Key
android:codes="54"
android:keyLabel="6"
android:keyWidth="8.9%p"
/>
<Key
android:codes="55"
android:keyLabel="7"
android:keyWidth="8.9%p" />
<Key
android:codes="56"
android:keyLabel="8"
android:keyWidth="8.9%p" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="8.9%p" />
<Key
android:codes="48"
android:keyLabel="0"
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="33"
android:keyLabel="!"
android:horizontalGap="5.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="64"
android:keyLabel="\@" />
<Key
android:codes="35"
android:keyLabel="#" />
<Key
android:codes="36"
android:keyLabel="\$" />
<Key
android:codes="37"
android:keyLabel="%" />
<Key
android:codes="38"
android:keyLabel="&amp;" />
<Key
android:codes="42"
android:keyLabel="*" />
<Key
android:codes="40"
android:keyLabel="(" />
<Key
android:codes="41"
android:keyLabel=")"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-103"
android:keyLabel="@string/king_keyboard_key_more_text"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="39"
android:keyLabel="'" />
<Key
android:codes="47"
android:keyLabel="/" />
<Key
android:codes="45"
android:keyLabel="-" />
<Key
android:codes="95"
android:keyLabel="_" />
<Key
android:codes="58"
android:keyLabel=":" />
<Key
android:codes="59"
android:keyLabel=";" />
<Key
android:codes="44"
android:keyLabel="," />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-102"
android:keyWidth="17%p"
android:keyLabel="@string/king_keyboard_key_back_text" />
<Key
android:codes="46"
android:keyWidth="12%p"
android:keyLabel="." />
<Key
android:codes="32"
android:isRepeatable="false"
android:keyWidth="36%p"
android:keyLabel="" />
<Key
android:codes="63"
android:keyWidth="12%p"
android:keyLabel="\?" />
<Key
android:codes="-3"
android:keyWidth="17%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="9%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="91"
android:keyLabel="["
android:horizontalGap="1%p"
android:keyWidth="8.9%p"
android:keyEdgeFlags="left" />
<Key
android:codes="93"
android:keyLabel="]"
android:keyWidth="8.9%p" />
<Key
android:codes="123"
android:keyLabel="{"
android:keyWidth="8.9%p" />
<Key
android:codes="125"
android:keyLabel="}"
android:keyWidth="8.9%p" />
<Key
android:codes="35"
android:keyLabel="#"
android:keyWidth="8.9%p" />
<Key
android:codes="37"
android:keyLabel="%"
android:keyWidth="8.9%p"
/>
<Key
android:codes="94"
android:keyLabel="^"
android:keyWidth="8.9%p" />
<Key
android:codes="96"
android:keyLabel="`"
android:keyWidth="8.9%p" />
<Key
android:codes="43"
android:keyLabel="+"
android:keyWidth="8.9%p" />
<Key
android:codes="61"
android:keyLabel="="
android:keyWidth="8.9%p"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="126"
android:keyLabel="~"
android:horizontalGap="5.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="92"
android:keyLabel="\\" />
<Key
android:codes="124"
android:keyLabel="|" />
<Key
android:codes="60"
android:keyLabel="&lt;" />
<Key
android:codes="62"
android:keyLabel="&gt;" />
<Key
android:codes="165"
android:keyLabel="¥" />
<Key
android:codes="8364"
android:keyLabel="€" />
<Key
android:codes="163"
android:keyLabel="£" />
<Key
android:codes="8356"
android:keyLabel="₤"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="-101"
android:keyLabel="123"
android:keyWidth="13.5%p"
android:isModifier="true"
android:isSticky="true"
android:keyEdgeFlags="left" />
<Key
android:codes="39"
android:keyLabel="'" />
<Key
android:codes="47"
android:keyLabel="/" />
<Key
android:codes="45"
android:keyLabel="-" />
<Key
android:codes="95"
android:keyLabel="_" />
<Key
android:codes="58"
android:keyLabel=":" />
<Key
android:codes="59"
android:keyLabel=";" />
<Key
android:codes="44"
android:keyLabel="," />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="-102"
android:keyWidth="17%p"
android:keyLabel="@string/king_keyboard_key_back_text" />
<Key
android:codes="46"
android:keyWidth="12%p"
android:keyLabel="." />
<Key
android:codes="32"
android:isRepeatable="false"
android:keyWidth="36%p"
android:keyLabel="" />
<Key
android:codes="63"
android:keyWidth="12%p"
android:keyLabel="\?" />
<Key
android:codes="-3"
android:keyWidth="17%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="0"
android:keyLabel="" />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="46"
android:keyLabel="." />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="23.5%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="49"
android:keyLabel="1"
android:keyEdgeFlags="left" />
<Key
android:codes="50"
android:keyLabel="2" />
<Key
android:codes="51"
android:keyLabel="3" />
<Key
android:codes="-5"
android:keyWidth="24.5%p"
android:isRepeatable="true"
android:keyEdgeFlags="right" />
</Row>
<Row>
<Key
android:codes="52"
android:keyLabel="4"
android:keyEdgeFlags="left"/>
<Key
android:codes="53"
android:keyLabel="5" />
<Key
android:codes="54"
android:keyLabel="6" />
<Key
android:codes="0"
android:keyWidth="24.5%p"/>
</Row>
<Row>
<Key
android:codes="55"
android:keyLabel="7"
android:keyEdgeFlags="left"/>
<Key
android:codes="56"
android:keyLabel="8" />
<Key
android:codes="57"
android:keyLabel="9"
android:keyWidth="23.5%p"/>
<Key
android:codes="-4"
android:keyEdgeFlags="right"
android:keyWidth="24.5%p"
android:keyHeight="@dimen/king_keyboard_key_height2" />
</Row>
<Row>
<Key
android:codes="45"
android:keyLabel="-" />
<Key
android:codes="48"
android:keyLabel="0" />
<Key
android:codes="-3" />
</Row>
</Keyboard>
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:horizontalGap="1%p"
android:keyWidth="13%p"
android:keyHeight="@dimen/king_keyboard_key_height"
android:verticalGap="@dimen/king_keyboard_vertical_gap">
<Row>
<Key
android:codes="65"
android:keyLabel="A"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left" />
<Key
android:codes="66"
android:keyLabel="B" />
<Key
android:codes="67"
android:keyLabel="C" />
<Key
android:codes="68"
android:keyLabel="D" />
<Key
android:codes="69"
android:keyLabel="E" />
<Key
android:codes="70"
android:keyLabel="F" />
<Key
android:codes="71"
android:keyLabel="G"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="72"
android:keyLabel="H"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="73"
android:keyLabel="I" />
<Key
android:codes="74"
android:keyLabel="J" />
<Key
android:codes="75"
android:keyLabel="K" />
<Key
android:codes="76"
android:keyLabel="L" />
<Key
android:codes="77"
android:keyLabel="M" />
<Key
android:codes="78"
android:keyLabel="N"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key
android:codes="79"
android:keyLabel="O"
android:keyWidth="13.5%p"/>
<Key
android:codes="80"
android:keyLabel="P" />
<Key
android:codes="81"
android:keyLabel="Q" />
<Key
android:codes="82"
android:keyLabel="R" />
<Key
android:codes="83"
android:keyLabel="S" />
<Key
android:codes="84"
android:keyLabel="T" />
<Key
android:codes="-5"
android:keyWidth="13.5%p"
android:isRepeatable="true" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key
android:codes="85"
android:keyLabel="U"
android:keyWidth="13.5%p"
android:keyEdgeFlags="left"/>
<Key
android:codes="86"
android:keyLabel="V" />
<Key
android:codes="87"
android:keyLabel="W" />
<Key
android:codes="88"
android:keyLabel="X" />
<Key
android:codes="89"
android:keyLabel="Y" />
<Key
android:codes="90"
android:keyLabel="Z" />
<Key
android:codes="-3"
android:keyWidth="13.5%p"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,18 @@
package com.king.keyboard
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}