liuyuqi-dellpc 3 years ago
parent
commit
46e1b45555
43 changed files with 1242 additions and 7 deletions
  1. 4 0
      app/src/main/AndroidManifest.xml
  2. 16 1
      app/src/main/java/me/yoqi/android/safekeyboard/MainActivity.java
  3. 127 0
      app/src/main/java/me/yoqi/android/safekeyboard/keyboard/CustomKeyboardView.java
  4. 158 0
      app/src/main/java/me/yoqi/android/safekeyboard/keyboard/KeyBoardDialogUtils.java
  5. 298 0
      app/src/main/java/me/yoqi/android/safekeyboard/keyboard/KhKeyboardView.java
  6. 9 0
      app/src/main/res/anim/keyboard_anim_dismiss.xml
  7. 9 0
      app/src/main/res/anim/keyboard_anim_start.xml
  8. BIN
      app/src/main/res/drawable-xxhdpi/icon_keyboard_capital_default.png
  9. BIN
      app/src/main/res/drawable-xxhdpi/icon_keyboard_capital_selected.png
  10. BIN
      app/src/main/res/drawable-xxhdpi/icon_shuzi_keyboard_del_default.png
  11. BIN
      app/src/main/res/drawable-xxhdpi/icon_yingwen_fuhao_keyboard_del_default.png
  12. BIN
      app/src/main/res/drawable-xxhdpi/keyboard_enlarge.9.png
  13. BIN
      app/src/main/res/drawable/keyboard_backspace.png
  14. BIN
      app/src/main/res/drawable/keyboard_delete.png
  15. BIN
      app/src/main/res/drawable/keyboard_done.png
  16. BIN
      app/src/main/res/drawable/keyboard_ic_dialog.png
  17. BIN
      app/src/main/res/drawable/keyboard_left.png
  18. 22 0
      app/src/main/res/drawable/keyboard_number_selector_bg.xml
  19. BIN
      app/src/main/res/drawable/keyboard_right.png
  20. BIN
      app/src/main/res/drawable/keyboard_search.png
  21. 18 0
      app/src/main/res/drawable/keyboard_selector_bg.xml
  22. 18 0
      app/src/main/res/drawable/keyboard_selector_blue_bg.xml
  23. BIN
      app/src/main/res/drawable/keyboard_shift.png
  24. BIN
      app/src/main/res/drawable/keyboard_space.png
  25. 17 0
      app/src/main/res/drawable/keyboard_word_del_layerlist.xml
  26. 17 0
      app/src/main/res/drawable/keyboard_word_del_layerlist2.xml
  27. 17 0
      app/src/main/res/drawable/keyboard_word_shift_layerlist.xml
  28. 17 0
      app/src/main/res/drawable/keyboard_word_shift_layerlist_da.xml
  29. 10 6
      app/src/main/res/layout/activity_main.xml
  30. 87 0
      app/src/main/res/layout/keyboard_key_board_popu.xml
  31. 9 0
      app/src/main/res/layout/keyboard_key_preview_layout.xml
  32. 11 0
      app/src/main/res/layout/keyboard_number_key_preview_layout.xml
  33. 8 0
      app/src/main/res/values-zh-rCN/strings.xml
  34. 5 0
      app/src/main/res/values/colors.xml
  35. 13 0
      app/src/main/res/values/keyboard_colors.xml
  36. 11 0
      app/src/main/res/values/keyboard_dimens.xml
  37. 10 0
      app/src/main/res/values/keyboard_strings.xml
  38. 20 0
      app/src/main/res/values/keyboard_styles.xml
  39. 1 0
      app/src/main/res/values/strings.xml
  40. 11 0
      app/src/main/res/values/styles.xml
  41. 31 0
      app/src/main/res/xml/keyboard_numbers.xml
  42. 68 0
      app/src/main/res/xml/keyboard_symbol.xml
  43. 200 0
      app/src/main/res/xml/keyboard_word.xml

+ 4 - 0
app/src/main/AndroidManifest.xml

@@ -2,6 +2,10 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="me.yoqi.android.safekeyboard">
 
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"

+ 16 - 1
app/src/main/java/me/yoqi/android/safekeyboard/MainActivity.java

@@ -1,14 +1,29 @@
 package me.yoqi.android.safekeyboard;
 
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+
 import androidx.appcompat.app.AppCompatActivity;
 
-import android.os.Bundle;
+import me.yoqi.android.safekeyboard.keyboard.KeyBoardDialogUtils;
 
 public class MainActivity extends AppCompatActivity {
+    private KeyBoardDialogUtils keyBoardDialogUtils;
+    private EditText et;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
+
+        et = (EditText) findViewById(R.id.et);
+        keyBoardDialogUtils = new KeyBoardDialogUtils(this);
+        et.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                keyBoardDialogUtils.show(et);
+            }
+        });
     }
 }

+ 127 - 0
app/src/main/java/me/yoqi/android/safekeyboard/keyboard/CustomKeyboardView.java

@@ -0,0 +1,127 @@
+package me.yoqi.android.safekeyboard.keyboard;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import android.inputmethodservice.Keyboard;
+import android.inputmethodservice.KeyboardView;
+import android.util.AttributeSet;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+import me.yoqi.android.safekeyboard.R;
+
+/** 自定义全键盘布局
+ * Created by liuyu1 on 2017/8/2.
+ */
+
+public class CustomKeyboardView extends KeyboardView {
+    private Context context;
+    public CustomKeyboardView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        this.context = context;
+    }
+
+    @Override
+    public void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        try {
+            List<Keyboard.Key> keys = getKeyboard().getKeys();
+            for (Keyboard.Key key : keys) {
+                if (key.codes[0] == -5) {
+                    Drawable dr = (Drawable) context.getResources().getDrawable(R.drawable.keyboard_word_del_layerlist);
+                    dr.setBounds(key.x, key.y, key.x + key.width, key.y + key.height);
+                    dr.draw(canvas);
+                } else if (key.codes[0] == -35) {
+                    Drawable dr = (Drawable) context.getResources().getDrawable(R.drawable.keyboard_word_del_layerlist2);
+                    dr.setBounds(key.x, key.y, key.x + key.width, key.y + key.height);
+                    dr.draw(canvas);
+                } else if (key.codes[0] == -1) {
+                    Drawable dr = (Drawable) context.getResources().getDrawable(R.drawable.keyboard_word_shift_layerlist);
+                    Drawable dr_da = (Drawable) context.getResources().getDrawable(R.drawable.keyboard_word_shift_layerlist_da);
+                    dr.setBounds(key.x, key.y, key.x + key.width, key.y + key.height);
+                    dr_da.setBounds(key.x, key.y, key.x + key.width, key.y + key.height);
+
+                    if (KhKeyboardView.isUpper) {
+                        dr_da.draw(canvas);
+                    } else {
+                        dr.draw(canvas);
+                    }
+
+                } else if (key.codes[0] == -2 || key.codes[0] == 90001) {
+                    Drawable dr = (Drawable) context.getResources().getDrawable(R.drawable.keyboard_selector_blue_bg);
+                    dr.setBounds(key.x, key.y, key.x + key.width, key.y + key.height);
+                    dr.draw(canvas);
+                    drawText(canvas, key);
+                } else {
+
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void drawText(Canvas canvas, Keyboard.Key key) {
+        try {
+            Rect bounds = new Rect();
+            Paint paint = new Paint();
+            paint.setTextAlign(Paint.Align.CENTER);
+
+
+            paint.setAntiAlias(true);
+
+            paint.setColor(Color.WHITE);
+
+            if (key.label != null) {
+                String label = key.label.toString();
+
+                Field field;
+
+                if (label.length() > 1 && key.codes.length < 2) {
+                    int labelTextSize = 0;
+                    try {
+                        field = KeyboardView.class.getDeclaredField("mLabelTextSize");
+                        field.setAccessible(true);
+                        labelTextSize = (int) field.get(this);
+                    } catch (NoSuchFieldException e) {
+                        e.printStackTrace();
+                    } catch (IllegalAccessException e) {
+                        e.printStackTrace();
+                    }
+                    paint.setTextSize(labelTextSize);
+                    paint.setTypeface(Typeface.DEFAULT_BOLD);
+                } else {
+                    int keyTextSize = 0;
+                    try {
+                        field = KeyboardView.class.getDeclaredField("mLabelTextSize");
+                        field.setAccessible(true);
+                        keyTextSize = (int) field.get(this);
+                    } catch (NoSuchFieldException e) {
+                        e.printStackTrace();
+                    } catch (IllegalAccessException e) {
+                        e.printStackTrace();
+                    }
+                    paint.setTextSize(keyTextSize);
+                    paint.setTypeface(Typeface.DEFAULT);
+                }
+
+                paint.getTextBounds(key.label.toString(), 0, key.label.toString()
+                        .length(), bounds);
+                canvas.drawText(key.label.toString(), key.x + (key.width / 2),
+                        (key.y + key.height / 2) + bounds.height() / 2, paint);
+            } else if (key.icon != null) {
+                key.icon.setBounds(key.x + (key.width - key.icon.getIntrinsicWidth()) / 2, key.y + (key.height - key.icon.getIntrinsicHeight()) / 2,
+                        key.x + (key.width - key.icon.getIntrinsicWidth()) / 2 + key.icon.getIntrinsicWidth(), key.y + (key.height - key.icon.getIntrinsicHeight()) / 2 + key.icon.getIntrinsicHeight());
+                key.icon.draw(canvas);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 158 - 0
app/src/main/java/me/yoqi/android/safekeyboard/keyboard/KeyBoardDialogUtils.java

@@ -0,0 +1,158 @@
+package me.yoqi.android.safekeyboard.keyboard;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Build;
+import android.text.InputType;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import me.yoqi.android.safekeyboard.R;
+
+
+public class KeyBoardDialogUtils implements View.OnClickListener {
+    protected View view;
+    protected Dialog popWindow;
+    protected Activity mContext;
+    private EditText contentView;
+    private List<String> contentList;
+    private KhKeyboardView keyboardUtil;
+
+    /**
+     * 构造方法
+     *
+     * @param mContext 全局 context 对象
+     */
+    public KeyBoardDialogUtils(Activity mContext) {
+        try {
+            this.mContext = mContext;
+            if (contentList == null) {
+                contentList = new ArrayList<>();
+            }
+            if (popWindow == null) {
+                view = LayoutInflater.from(mContext).inflate(R.layout.keyboard_key_board_popu, null);
+//				view.getBackground().setAlpha(68);
+                popWindow = new Dialog(mContext, R.style.keyboard_popupAnimation);
+                view.findViewById(R.id.keyboard_finish).setOnClickListener(this);
+                view.findViewById(R.id.keyboard_back_hide).setOnClickListener(this);
+            }
+            popWindow.setContentView(view);
+            popWindow.setCanceledOnTouchOutside(true);
+            Window mWindow = popWindow.getWindow();
+            mWindow.setWindowAnimations(R.style.keyboard_popupAnimation);
+            mWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
+            mWindow.setGravity(Gravity.BOTTOM | Gravity.FILL_HORIZONTAL);
+            mWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
+                    ViewGroup.LayoutParams.WRAP_CONTENT);
+            popWindow.setOnDismissListener(new DialogInterface.OnDismissListener() {
+
+                @Override
+                public void onDismiss(DialogInterface dialog) {
+                    if (contentView != null && contentView.isFocused()) {
+                        contentView.clearFocus();
+                    }
+                }
+            });
+            initView();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void initView() {
+        try {
+            if (keyboardUtil == null)
+                keyboardUtil = new KhKeyboardView(mContext, view);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 隐藏系统键盘
+     *
+     * @param editText
+     */
+    public void hideSystemSofeKeyboard(EditText editText) {
+        int sdkInt = Build.VERSION.SDK_INT;
+        if (sdkInt >= 11) {
+            try {
+                Class<EditText> cls = EditText.class;
+                Method setShowSoftInputOnFocus;
+                setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
+                setShowSoftInputOnFocus.setAccessible(true);
+                setShowSoftInputOnFocus.invoke(editText, false);
+
+            } catch (SecurityException e) {
+                e.printStackTrace();
+            } catch (NoSuchMethodException e) {
+                e.printStackTrace();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            editText.setInputType(InputType.TYPE_NULL);
+        }
+        // 如果软键盘已经显示,则隐藏
+        InputMethodManager imm = (InputMethodManager) mContext.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+        imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
+    }
+
+
+    /**
+     * 显示键盘界面
+     *
+     * @param editText 输入框
+     */
+    public void show(final EditText editText) {
+        editText.setFocusable(true);
+        editText.setFocusableInTouchMode(true);
+        editText.requestFocus();
+        hideSystemSofeKeyboard(editText); //隐藏系统键盘不然系统键盘会闪一下
+        popWindow.show();
+        keyboardUtil.showKeyboard(editText);
+    }
+
+    public void dismiss() {
+        if (popWindow != null && popWindow.isShowing()) {
+            popWindow.dismiss();
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        try {
+            int i = v.getId();
+            if (i == R.id.keyboard_finish) {
+                keyboardUtil.hideKeyboard();
+                dismiss();
+            } else if (i == R.id.keyboard_back_hide) {
+                keyboardUtil.hideKeyboard();
+                dismiss();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
+
+
+
+
+
+
+
+
+

+ 298 - 0
app/src/main/java/me/yoqi/android/safekeyboard/keyboard/KhKeyboardView.java

@@ -0,0 +1,298 @@
+package me.yoqi.android.safekeyboard.keyboard;
+
+import android.app.Activity;
+import android.graphics.drawable.Drawable;
+import android.inputmethodservice.Keyboard;
+import android.inputmethodservice.KeyboardView;
+import android.text.Editable;
+import android.text.InputType;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+import java.util.List;
+import me.yoqi.android.safekeyboard.R;
+
+
+public class KhKeyboardView {
+    private Activity mContext;
+    private View parentView;
+    private KeyboardView mLetterView;   //字母键盘view
+    private KeyboardView mNumberView;   //数字键盘View
+    private Keyboard mNumberKeyboard;   // 数字键盘
+    private Keyboard mLetterKeyboard;   // 字母键盘
+    private Keyboard mSymbolKeyboard;   // 符号键盘
+
+    private boolean isNumber = true;    // 是否数字键盘
+    public static   boolean isUpper = false;    // 是否大写
+    private boolean isSymbol = false;   // 是否是符号
+    private EditText mEditText;
+    private View headerView;
+
+    public void setEditText(EditText text) {
+        mEditText = text;
+    }
+
+    public KhKeyboardView(Activity context, View view) {
+        mContext = context;
+        parentView = view;
+
+        //构建系统 Keyboard 实例
+        mNumberKeyboard = new Keyboard(mContext, R.xml.keyboard_numbers); //数字键盘
+        mLetterKeyboard = new Keyboard(mContext, R.xml.keyboard_word); // 字母键盘
+        mSymbolKeyboard = new Keyboard(mContext, R.xml.keyboard_symbol); // 符号键盘
+
+        mNumberView = (KeyboardView) parentView.findViewById(R.id.keyboard_view);
+        mLetterView = (KeyboardView) parentView.findViewById(R.id.keyboard_view_2);
+
+        mNumberView.setKeyboard(mNumberKeyboard);
+        mNumberView.setEnabled(true);
+        mNumberView.setPreviewEnabled(false);
+        mNumberView.setOnKeyboardActionListener(listener);
+
+        mLetterView.setKeyboard(mLetterKeyboard);
+        mLetterView.setEnabled(true);
+        mLetterView.setPreviewEnabled(true); //默认显示字母键盘
+        mLetterView.setOnKeyboardActionListener(listener);
+
+        headerView = parentView.findViewById(R.id.keyboard_header);
+
+    }
+
+    private KeyboardView.OnKeyboardActionListener listener = new KeyboardView.OnKeyboardActionListener() {
+        @Override
+        public void onPress(int primaryCode) {
+            Log.d("primaryCode","onPress--"+primaryCode);
+            if (primaryCode == Keyboard.KEYCODE_SHIFT) {
+                List<Keyboard.Key> keyList = mLetterKeyboard.getKeys();
+
+                mLetterView.setPreviewEnabled(false);
+            } else if (primaryCode == Keyboard.KEYCODE_DELETE) {
+                mLetterView.setPreviewEnabled(false);
+            } else if (primaryCode == 32) {
+                mLetterView.setPreviewEnabled(false);
+            } else {
+                mLetterView.setPreviewEnabled(true);
+            }
+
+        }
+
+        @Override
+        public void onRelease(int primaryCode) {
+            Log.d("primaryCode","onRelease--"+primaryCode);
+
+//            if(primaryCode== -1){
+//                if(isUpper){
+//                    isUpper=false;
+//                }else {
+//                    isUpper=true;
+//                }
+//            }
+        }
+
+        @Override
+        public void onKey(int primaryCode, int[] keyCodes) {
+            Log.d("primaryCode","onKey--"+primaryCode);
+            try {
+                if (mEditText == null)
+                    return;
+                Editable editable = mEditText.getText();
+                int start = mEditText.getSelectionStart();
+                if (primaryCode == Keyboard.KEYCODE_CANCEL) {
+                    // 隐藏键盘
+                    hideKeyboard();
+                } else if (primaryCode == Keyboard.KEYCODE_DELETE || primaryCode == -35) {
+
+                    // 回退键,删除字符
+                    if (editable != null && editable.length() > 0) {
+                        if (start > 0) {
+                            editable.delete(start - 1, start);
+                        }
+                    }
+                } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
+                    // 大小写切换
+                    changeKeyboart();
+                    mLetterView.setKeyboard(mLetterKeyboard);
+
+                } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
+                    // 数字与字母键盘互换
+                    if (isNumber) {
+                        showLetterView();
+                        showLetterView2();
+                    } else {
+                        showNumberView();
+                    }
+
+                } else if (primaryCode == 90001) {
+//                  字母与符号切换
+                    if (isSymbol) {
+                        showLetterView2();
+                    } else {
+                        showSymbolView();
+                    }
+
+                } else {
+                    // 输入键盘值
+                    editable.insert(start, Character.toString((char) primaryCode));
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+        }
+
+        @Override
+        public void onText(CharSequence text) {
+
+        }
+
+        @Override
+        public void swipeLeft() {
+
+        }
+
+        @Override
+        public void swipeRight() {
+
+        }
+
+        @Override
+        public void swipeDown() {
+
+        }
+
+        @Override
+        public void swipeUp() {
+
+        }
+    };
+
+    //  字母-符号,显示字母
+    private void showLetterView2() {
+        if (mLetterView != null) {
+            isSymbol = false;
+            mLetterView.setKeyboard(mLetterKeyboard);
+        }
+    }
+
+    //  字母-符号,显示符号
+    private void showSymbolView() {
+        try {
+            if (mLetterKeyboard != null) {
+                isSymbol = true;
+                mLetterView.setKeyboard(mSymbolKeyboard);
+            }
+        } catch (Exception e) {
+        }
+    }
+
+    //  数字-字母,显示字母键盘
+    private void showLetterView() {
+        try {
+            if (mLetterView != null && mNumberView != null) {
+                isNumber = false;
+                mLetterView.setVisibility(View.VISIBLE);
+                mNumberView.setVisibility(View.INVISIBLE);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    // 数字-字母, 显示数字键盘
+    private void showNumberView() {
+        try {
+            if (mLetterView != null && mNumberView != null) {
+                isNumber = true;
+                mLetterView.setVisibility(View.INVISIBLE);
+                mNumberView.setVisibility(View.VISIBLE);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 切换大小写
+     */
+    private void changeKeyboart() {
+        List<Keyboard.Key> keyList = mLetterKeyboard.getKeys();
+        if (isUpper) {
+            // 大写切换小写
+            isUpper = false;
+            for (Keyboard.Key key : keyList) {
+                Drawable icon = key.icon;
+
+                if (key.label != null && isLetter(key.label.toString())) {
+                    key.label = key.label.toString().toLowerCase();
+                    key.codes[0] = key.codes[0] + 32;
+                }
+            }
+        } else {
+            // 小写切换成大写
+            isUpper = true;
+            for (Keyboard.Key key : keyList) {
+                if (key.label != null && isLetter(key.label.toString())) {
+                    key.label = key.label.toString().toUpperCase();
+                    key.codes[0] = key.codes[0] - 32;
+                }
+            }
+        }
+    }
+
+    /**
+     * 判断是否是字母
+     */
+    private boolean isLetter(String str) {
+        String wordStr = "abcdefghijklmnopqrstuvwxyz";
+        return wordStr.contains(str.toLowerCase());
+    }
+
+    public void hideKeyboard() {
+        try {
+            int visibility = mLetterView.getVisibility();
+            if (visibility == View.VISIBLE) {
+                headerView.setVisibility(View.GONE);
+                mLetterView.setVisibility(View.GONE);
+            }
+            visibility = mNumberView.getVisibility();
+            if (visibility == View.VISIBLE) {
+                headerView.setVisibility(View.GONE);
+                mNumberView.setVisibility(View.GONE);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 显示键盘
+     *
+     * @param editText 输入字符串到 editText 类型的控件中
+     */
+    public void showKeyboard(EditText editText) {
+        try {
+            this.mEditText = editText;
+            int visibility = 0;
+            int inputText = mEditText.getInputType();
+            headerView.setVisibility(View.VISIBLE);
+            switch (inputText) {
+                case InputType.TYPE_CLASS_NUMBER:
+                    showNumberView();
+                    break;
+                case InputType.TYPE_CLASS_PHONE:
+                    showNumberView();
+                    break;
+                case InputType.TYPE_NUMBER_FLAG_DECIMAL:
+                    showNumberView();
+                    break;
+                default:
+                    showLetterView();
+                    break;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 9 - 0
app/src/main/res/anim/keyboard_anim_dismiss.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shareInterpolator="false">
+    <translate
+        android:duration="600"
+        android:fromYDelta="0"
+        android:toYDelta="+30%p"/>
+</set>

+ 9 - 0
app/src/main/res/anim/keyboard_anim_start.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set
+	xmlns:android="http://schemas.android.com/apk/res/android"
+	android:shareInterpolator="false">
+   <translate
+       android:fromYDelta="+30%p"
+       android:toYDelta="0"
+       android:duration="600"/>
+</set>

BIN
app/src/main/res/drawable-xxhdpi/icon_keyboard_capital_default.png


BIN
app/src/main/res/drawable-xxhdpi/icon_keyboard_capital_selected.png


BIN
app/src/main/res/drawable-xxhdpi/icon_shuzi_keyboard_del_default.png


BIN
app/src/main/res/drawable-xxhdpi/icon_yingwen_fuhao_keyboard_del_default.png


BIN
app/src/main/res/drawable-xxhdpi/keyboard_enlarge.9.png


BIN
app/src/main/res/drawable/keyboard_backspace.png


BIN
app/src/main/res/drawable/keyboard_delete.png


BIN
app/src/main/res/drawable/keyboard_done.png


BIN
app/src/main/res/drawable/keyboard_ic_dialog.png


BIN
app/src/main/res/drawable/keyboard_left.png


+ 22 - 0
app/src/main/res/drawable/keyboard_number_selector_bg.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_pressed="false"
+          android:state_checked="false"
+          >
+        <shape android:shape="rectangle">
+            <corners  android:radius="4dp"/>
+            <solid android:color="#474749"/>
+        </shape>
+    </item>
+
+    <item android:state_pressed="true"
+          android:state_checked="false"
+         >
+        <shape android:shape="rectangle">
+            <corners  android:radius="4dp"/>
+            <solid android:color="#1c69ac"/>
+        </shape>
+    </item>
+
+</selector>

BIN
app/src/main/res/drawable/keyboard_right.png


BIN
app/src/main/res/drawable/keyboard_search.png


+ 18 - 0
app/src/main/res/drawable/keyboard_selector_bg.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_checked="false" android:state_pressed="false">
+        <shape android:shape="rectangle">
+            <solid android:color="#474749" />
+            <corners android:radius="5dp" />
+        </shape>
+    </item>
+
+    <item android:state_checked="false" android:state_pressed="true">
+        <shape android:shape="rectangle">
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp" />
+        </shape>
+    </item>
+
+</selector>

+ 18 - 0
app/src/main/res/drawable/keyboard_selector_blue_bg.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:state_checked="false" android:state_pressed="false">
+        <shape android:shape="rectangle">
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp" />
+        </shape>
+    </item>
+
+    <item android:state_checked="false" android:state_pressed="true">
+        <shape android:shape="rectangle">
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp" />
+        </shape>
+    </item>
+
+</selector>

BIN
app/src/main/res/drawable/keyboard_shift.png


BIN
app/src/main/res/drawable/keyboard_space.png


+ 17 - 0
app/src/main/res/drawable/keyboard_word_del_layerlist.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp"/>
+        </shape>
+    </item>
+    <item
+        android:left="15dp"
+        android:right="15dp"
+        android:top="15dp"
+        android:bottom="15dp"
+        android:drawable="@drawable/icon_yingwen_fuhao_keyboard_del_default"
+         />
+</layer-list>
+

+ 17 - 0
app/src/main/res/drawable/keyboard_word_del_layerlist2.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp"/>
+        </shape>
+    </item>
+    <item
+        android:left="48dp"
+        android:right="48dp"
+        android:top="15dp"
+        android:bottom="15dp"
+        android:drawable="@drawable/icon_shuzi_keyboard_del_default"
+         />
+</layer-list>
+

+ 17 - 0
app/src/main/res/drawable/keyboard_word_shift_layerlist.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp"/>
+        </shape>
+    </item>
+    <item
+        android:left="16dp"
+        android:right="16dp"
+        android:top="13dp"
+        android:bottom="13dp"
+        android:drawable="@drawable/icon_keyboard_capital_default"
+        />
+</layer-list>
+

+ 17 - 0
app/src/main/res/drawable/keyboard_word_shift_layerlist_da.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="#1c69ac" />
+            <corners android:radius="5dp"/>
+        </shape>
+    </item>
+    <item
+        android:left="16dp"
+        android:right="16dp"
+        android:top="13dp"
+        android:bottom="13dp"
+        android:drawable="@drawable/icon_keyboard_capital_selected"
+        />
+</layer-list>
+

+ 10 - 6
app/src/main/res/layout/activity_main.xml

@@ -6,13 +6,17 @@
     android:layout_height="match_parent"
     tools:context=".MainActivity">
 
-    <TextView
-        android:layout_width="wrap_content"
+    <EditText
+        android:id="@+id/et"
+        android:layout_width="200dp"
         android:layout_height="wrap_content"
-        android:text="Hello World!"
+        android:layout_marginBottom="292dp"
+        android:focusableInTouchMode="false"
+        android:hint="input text."
+        android:textColor="@android:color/black"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toStartOf="parent" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 87 - 0
app/src/main/res/layout/keyboard_key_board_popu.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/rl_key"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="#00000000"
+    android:orientation="vertical">
+
+    <View
+        android:id="@+id/keyboard_back_hide"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:visibility="gone" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="#7d7d7d"
+        android:orientation="vertical">
+
+        <RelativeLayout
+            android:id="@+id/keyboard_header"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:visibility="visible">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerInParent="true"
+                android:text="智能安全加密键盘"
+                android:textColor="#bfbfbf"
+                android:textSize="15sp" />
+
+            <TextView
+                android:id="@+id/keyboard_finish"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginRight="10dp"
+                android:padding="5dp"
+                android:text="@string/finish"
+                android:textColor="#ffffff"
+                android:textSize="15sp" />
+        </RelativeLayout>
+
+        <ImageView
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:layout_marginBottom="10dp"
+            android:background="#555457" />
+
+        <FrameLayout
+            android:id="@+id/keyboard_layer"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+
+            <me.yoqi.android.safekeyboard.keyboard.CustomKeyboardView
+                android:id="@+id/keyboard_view"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="#7d7d7d"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:keyBackground="@drawable/keyboard_number_selector_bg"
+                android:keyPreviewLayout="@null"
+                android:keyTextColor="#ffffff"
+                android:visibility="gone" />
+
+            <me.yoqi.android.safekeyboard.keyboard.CustomKeyboardView
+                android:id="@+id/keyboard_view_2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="#7d7d7d"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:keyBackground="@drawable/keyboard_selector_bg"
+                android:keyPreviewHeight="90dp"
+                android:keyPreviewLayout="@layout/keyboard_key_preview_layout"
+                android:keyPreviewOffset="45dp"
+                android:keyTextColor="#ffffff"
+                android:visibility="gone" />
+        </FrameLayout>
+
+    </LinearLayout>
+</RelativeLayout>

+ 9 - 0
app/src/main/res/layout/keyboard_key_preview_layout.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:background="@drawable/keyboard_enlarge"
+    android:gravity="center"
+    android:textColor="@color/keyboard_black"
+    android:textSize="24sp"
+    android:textStyle="bold" />

+ 11 - 0
app/src/main/res/layout/keyboard_number_key_preview_layout.xml

@@ -0,0 +1,11 @@
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="50dp"
+    android:layout_height="50dp"
+    android:background="@drawable/keyboard_enlarge"
+    android:gravity="center_horizontal"
+    android:paddingLeft="5dp"
+    android:paddingRight="5dp"
+    android:paddingTop="5dp"
+    android:textColor="@color/keyboard_black"
+    android:textSize="24sp"
+    android:textStyle="bold" />

+ 8 - 0
app/src/main/res/values-zh-rCN/strings.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">安全键盘</string>
+    <string name="keyboard_app_name">软键盘</string>
+    <string name="keyboard_username">请输入用户名</string>
+    <string name="keyboard_password">请输入密码</string>
+    <string name="finish">完成</string>
+</resources>

+ 5 - 0
app/src/main/res/values/colors.xml

@@ -7,4 +7,9 @@
     <color name="teal_700">#FF018786</color>
     <color name="black">#FF000000</color>
     <color name="white">#FFFFFFFF</color>
+
+    <!--自定义颜色-->
+    <color name="colorPrimary">#3F51B5</color>
+    <color name="colorPrimaryDark">#303F9F</color>
+    <color name="colorAccent">#FF4081</color>
 </resources>

+ 13 - 0
app/src/main/res/values/keyboard_colors.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="keyboard_colorPrimary">#3F51B5</color>
+    <color name="keyboard_colorPrimaryDark">#303F9F</color>
+    <color name="keyboard_colorAccent">#FF4081</color>
+    <color name="keyboard_white">#ffffff</color>
+    <color name="keyboard_gray">#bdbdbd</color>
+    <color name="keyboard_black">#000000</color>
+    <color name="keyboard_keyTextColor">#424242</color>
+    <color name="keyboard_green">#00ff00</color>
+    <color name="keyboard_red">#ff0000</color>
+    <color name="keyboard_transparent">#00000000</color>
+</resources>

+ 11 - 0
app/src/main/res/values/keyboard_dimens.xml

@@ -0,0 +1,11 @@
+<resources>
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="keyboard_activity_horizontal_margin">16dp</dimen>
+    <dimen name="keyboard_activity_vertical_margin">16dp</dimen>
+
+    <!--键盘-->
+    <dimen name="keyboard_key_height">45dp</dimen>
+    <dimen name="keyboard_horizontalGap">10dp</dimen>
+    <dimen name="keyboard_verticalGap">10dp</dimen>
+    <dimen name="keyboard_key_height_double">120dp</dimen>
+</resources>

+ 10 - 0
app/src/main/res/values/keyboard_strings.xml

@@ -0,0 +1,10 @@
+<resources>
+    <string name="keyboard_app_name">keyboard</string>
+    <string name="keyboard_username">input username</string>
+    <string name="keyboard_password">input password</string>
+    <string name="keyboard_key1">"&#64;"</string>
+    <string name="keyboard_key2">"&#38;"</string>
+    <string name="keyboard_key3">\"</string>
+    <string name="keyboard_key4">"&#60;"</string>
+    <string name="keyboard_key5">"&#62;"</string>
+</resources>

+ 20 - 0
app/src/main/res/values/keyboard_styles.xml

@@ -0,0 +1,20 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <!--<style name="keyboard_AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">-->
+        <!--&lt;!&ndash; Customize your theme here. &ndash;&gt;-->
+        <!--<item name="colorPrimary">@color/keyboard_colorPrimary</item>-->
+        <!--<item name="colorPrimaryDark">@color/keyboard_colorPrimaryDark</item>-->
+        <!--<item name="colorAccent">@color/keyboard_colorAccent</item>-->
+    <!--</style>-->
+    <style name="keyboard_popupAnimation" mce_bogus="1" parent="android:Animation">
+        <item name="android:windowFrame">@null</item>
+        <item name="android:windowIsFloating">true</item>
+        <item name="android:windowIsTranslucent">false</item>
+        <item name="android:backgroundDimEnabled">false</item>
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowBackground">@color/keyboard_transparent</item>
+        <item name="android:windowEnterAnimation">@anim/keyboard_anim_start</item>
+        <item name="android:windowExitAnimation">@anim/keyboard_anim_dismiss</item>
+    </style>
+</resources>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -1,3 +1,4 @@
 <resources>
     <string name="app_name">SafeKeyboard</string>
+    <string name="finish">finish</string>
 </resources>

+ 11 - 0
app/src/main/res/values/styles.xml

@@ -0,0 +1,11 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+        <!-- Customize your theme here. -->
+        <item name="colorPrimary">@color/colorPrimary</item>
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorAccent">@color/colorAccent</item>
+    </style>
+
+</resources>

+ 31 - 0
app/src/main/res/xml/keyboard_numbers.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
+          android:keyWidth="30%p"
+          android:horizontalGap="@dimen/keyboard_horizontalGap"
+          android:verticalGap="@dimen/keyboard_verticalGap"
+          android:keyHeight="47dp">
+    <Row>
+        <Key android:codes="49" android:keyLabel="1" />
+        <Key android:codes="50" android:keyLabel="2" />
+        <Key android:codes="51" android:keyLabel="3" />
+    </Row>
+
+    <Row>
+        <Key android:codes="52" android:keyLabel="4" />
+        <Key android:codes="53" android:keyLabel="5" />
+        <Key android:codes="54" android:keyLabel="6" />
+    </Row>
+
+    <Row>
+        <Key android:codes="55" android:keyLabel="7" />
+        <Key android:codes="56" android:keyLabel="8" />
+        <Key android:codes="57" android:keyLabel="9" />
+    </Row>
+
+    <Row>
+        <Key android:codes="-2" android:keyLabel="ABC" />
+        <Key android:codes="48" android:keyLabel="0" />
+        <Key android:codes="-35"
+            android:isRepeatable="true"/>
+    </Row>
+</Keyboard>

+ 68 - 0
app/src/main/res/xml/keyboard_symbol.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Keyboard
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:keyHeight="47dp"
+    android:keyWidth="10%p"
+    android:horizontalGap="1%p"
+    android:verticalGap="10dp"
+    >
+    <Row>
+        <Key
+            android:keyWidth="8.9%p" android:codes="33" android:keyLabel="!" android:keyEdgeFlags="left"
+            />
+        <Key android:keyWidth="8.9%p" android:codes="64" android:keyLabel="@string/keyboard_key1" /><!--@-->
+        <Key android:keyWidth="8.9%p" android:codes="35" android:keyLabel="#" />
+        <Key android:keyWidth="8.9%p" android:codes="36" android:keyLabel="$" />
+        <Key android:keyWidth="8.9%p" android:codes="37" android:keyLabel="%" />
+        <Key android:keyWidth="8.9%p" android:codes="94" android:keyLabel="^" />
+        <Key android:keyWidth="8.9%p" android:codes="38" android:keyLabel="@string/keyboard_key2" /><!--&-->
+        <Key android:keyWidth="8.9%p" android:codes="42" android:keyLabel="*" />
+        <Key android:keyWidth="8.9%p" android:codes="40" android:keyLabel="(" />
+        <Key android:keyWidth="8.9%p" android:codes="41" android:keyLabel=")" android:keyEdgeFlags="right" />
+    </Row>
+
+    <Row>
+        <Key android:keyWidth="8.9%p" android:codes="39"
+             android:keyEdgeFlags="left" android:keyLabel="'" />
+        <Key android:keyWidth="8.9%p" android:codes="34" android:keyLabel="@string/keyboard_key3" /> <!--"-->
+        <Key android:keyWidth="8.9%p" android:codes="61" android:keyLabel="=" />
+        <Key android:keyWidth="8.9%p" android:codes="95" android:keyLabel="_" />
+        <Key android:keyWidth="8.9%p" android:codes="58" android:keyLabel=":" />
+        <Key android:keyWidth="8.9%p" android:codes="59" android:keyLabel=";" />
+        <Key android:keyWidth="8.9%p" android:codes="63" android:keyLabel="\?" />
+        <Key android:keyWidth="8.9%p" android:codes="126" android:keyLabel="~" />
+        <Key android:keyWidth="8.9%p" android:codes="124" android:keyLabel="|" />
+        <Key android:keyWidth="8.9%p" android:codes="183" android:keyEdgeFlags="right"
+             android:keyLabel="·" />
+    </Row>
+
+    <Row>
+        <Key android:horizontalGap="3.5%p" android:keyWidth="9%p" android:codes="43" android:keyLabel="+" />
+        <Key android:keyWidth="9%p" android:codes="45" android:keyLabel="-" />
+        <Key android:keyWidth="9%p" android:codes="92" android:keyLabel="\\" />
+        <Key android:keyWidth="9%p" android:codes="47" android:keyLabel="/" />
+        <Key android:keyWidth="9%p" android:codes="91" android:keyLabel="[" />
+        <Key android:keyWidth="9%p" android:codes="93" android:keyLabel="]" />
+        <Key android:keyWidth="9%p" android:codes="123" android:keyLabel="{" />
+        <Key android:keyWidth="9%p" android:codes="125" android:keyLabel="}" />
+        <Key android:horizontalGap="3.5%p" android:keyWidth="13%p" android:codes="-5"
+              android:isRepeatable="true"
+             android:keyIcon="@drawable/icon_yingwen_fuhao_keyboard_del_default" />
+    </Row>
+
+    <Row android:rowEdgeFlags="bottom">
+        <Key android:keyWidth="13%p" android:codes="-2"
+             android:keyLabel="123" />
+        <Key android:keyWidth="9%p" android:horizontalGap="2%p" android:codes="44" android:keyLabel="," />
+        <Key android:keyWidth="9%p" android:codes="46" android:keyLabel="." />
+        <Key android:keyWidth="9%p" android:codes="60" android:keyLabel="@string/keyboard_key4" />
+        <!--<-->
+        <!-->-->
+        <Key android:keyWidth="9%p" android:codes="62" android:keyLabel="@string/keyboard_key5" />
+        <Key android:keyWidth="9%p" android:codes="8364" android:keyLabel="€" />
+        <Key android:keyWidth="9%p" android:codes="163" android:keyLabel="£" />
+        <Key android:keyWidth="9%p" android:codes="165" android:keyLabel="¥" />
+        <Key android:keyWidth="13%p" android:codes="90001" android:horizontalGap="2%p"
+             android:keyEdgeFlags="right" android:keyLabel="ABC" />
+    </Row>
+</Keyboard>

+ 200 - 0
app/src/main/res/xml/keyboard_word.xml

@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
+    android:horizontalGap="1%p"
+    android:keyHeight="@dimen/keyboard_key_height"
+    android:keyWidth="10%p"
+    android:verticalGap="3dp">
+
+    <Row>
+        <Key
+            android:codes="49"
+            android:keyEdgeFlags="left"
+            android:keyLabel="1"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="50"
+            android:keyLabel="2"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="51"
+            android:keyLabel="3"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="52"
+            android:keyLabel="4"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="53"
+            android:keyLabel="5"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="54"
+            android:keyLabel="6"
+            android:keyWidth="8.8%p" />
+        <Key
+            android:codes="55"
+            android:keyLabel="7"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="56"
+            android:keyLabel="8"
+            android:keyWidth="8.8%p" />
+        <Key
+            android:codes="57"
+            android:keyLabel="9"
+            android:keyWidth="8.8%p"/>
+        <Key
+            android:codes="48"
+            android:keyEdgeFlags="right"
+            android:keyLabel="0"
+            android:keyWidth="8.8%p" />
+    </Row>
+    <Row>
+        <Key
+            android:codes="113"
+            android:keyEdgeFlags="left"
+            android:keyLabel="q"
+            android:keyWidth="8.9%p" />
+        <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:keyLabel="r"
+            android:keyWidth="8.9%p" />
+        <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:keyEdgeFlags="right"
+            android:keyLabel="p"
+            android:keyWidth="8.9%p" />
+    </Row>
+
+    <Row>
+        <Key
+            android:codes="97"
+            android:horizontalGap="5.5%p"
+            android:keyEdgeFlags="left"
+            android:keyLabel="a"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="115"
+            android:keyLabel="s"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="100"
+            android:keyLabel="d"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="102"
+            android:keyLabel="f"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="103"
+            android:keyLabel="g"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="104"
+            android:keyLabel="h"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="106"
+            android:keyLabel="j"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="107"
+            android:keyLabel="k"
+            android:keyWidth="9%p" />
+        <Key
+            android:codes="108"
+            android:keyEdgeFlags="right"
+            android:keyLabel="l"
+            android:keyWidth="9%p" />
+    </Row>
+
+    <Row>
+        <Key
+            android:codes="-1"
+            android:isModifier="true"
+            android:isSticky="true"
+            android:keyEdgeFlags="left"
+            android:keyIcon="@drawable/icon_keyboard_capital_default"
+            android:keyWidth="13%p" />
+        <Key
+            android:codes="122"
+            android:horizontalGap="2%p"
+            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="-5"
+            android:horizontalGap="2%p"
+            android:isRepeatable="true"
+            android:keyIcon="@drawable/icon_yingwen_fuhao_keyboard_del_default"
+            android:keyWidth="13%p" />
+    </Row>
+
+    <Row android:rowEdgeFlags="bottom">
+        <Key
+            android:codes="-2"
+            android:keyLabel="123"
+            android:keyWidth="19%p" />
+        <Key
+            android:codes="32"
+            android:isRepeatable="true"
+            android:keyLabel="space"
+            android:keyWidth="58%p" />
+        <Key
+            android:codes="90001"
+            android:keyEdgeFlags="right"
+            android:keyLabel="#+="
+            android:keyWidth="19%p" />
+    </Row>
+</Keyboard>