Skip to content

Commit

Permalink
规范命名,优化部分功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-huangjie committed Nov 28, 2019
1 parent f97d4a7 commit 6d7d0ef
Show file tree
Hide file tree
Showing 21 changed files with 257 additions and 187 deletions.
71 changes: 64 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,65 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
9 changes: 5 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.keybord.keyborddemo">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RecyclerViewActivity"></activity>
<activity android:name=".SystemKeyboardActivity"></activity>
<activity android:name=".SystemKeyboardEidtTextActivity"></activity>
<activity android:name=".SystemKeyboardActivity"/>
<activity android:name=".SystemKeyboardEditTextActivity"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected void onListItemClick(ListView l, View v, int position, long id) {
startActivity(SystemKeyboardActivity.class);
break;
case 1:
startActivity(SystemKeyboardEidtTextActivity.class);
startActivity(SystemKeyboardEditTextActivity.class);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import android.widget.Toast;

import com.jay.easykeyboard.SystemKeyboard;
import com.jay.easykeyboard.action.IKeyBoardUI;
import com.jay.easykeyboard.action.KeyBoardActionListence;
import com.jay.easykeyboard.action.IKeyBoardUIChange;
import com.jay.easykeyboard.action.KeyBoardActionListener;
import com.jay.easykeyboard.util.Util;

/**
Expand All @@ -34,11 +34,11 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_systemkeyboard);
mKeyboard = findViewById(R.id.systemkeyboard);
Button btn_setkeyui = findViewById(R.id.btn_setkeyui);
Button btnChangeUi = findViewById(R.id.btn_change_ui);
EditText edit1 = findViewById(R.id.edit);
EditText edit2 = findViewById(R.id.edit2);
mKeyboard.setEditText(edit1); //用于绑定EditText,如果切换了EditText,请务必设置此方法
mKeyboard.setOnKeyboardActionListener(new KeyBoardActionListence() {
mKeyboard.setOnKeyboardActionListener(new KeyBoardActionListener() {
@Override
public void onComplete() {
showShortToast("完成");
Expand All @@ -63,11 +63,11 @@ public void onClearAll() {
edit1.setOnFocusChangeListener(this);
edit2.setOnFocusChangeListener(this);

btn_setkeyui.setOnClickListener(new View.OnClickListener() {
btnChangeUi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//改变ui
mKeyboard.setKeyboardUI(new IKeyBoardUI() {
mKeyboard.setKeyboardUI(new IKeyBoardUIChange() {
@Override
public Paint setPaint(Paint paint) {
paint.setColor(Color.BLUE);
Expand All @@ -82,7 +82,7 @@ public Paint setPaint(Paint paint) {
@Override
public void onClick(View v) {
isRandom = !isRandom;
mKeyboard.setRandomkeys(isRandom);
mKeyboard.setRandomKeys(isRandom);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
package com.example.keybord.keyborddemo;

import android.inputmethodservice.Keyboard;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.jay.easykeyboard.SystemKeyBoardEditText;
import com.jay.easykeyboard.action.KeyBoardActionListence;
import com.jay.easykeyboard.impl.SystemOnKeyboardActionListener;
import com.jay.easykeyboard.action.KeyBoardActionListener;

/**
* Created by huangjie on 2018/2/6.
* 类名:
* 说明:附带EditText的popwindow形式弹出的键盘
*/

public class SystemKeyboardEidtTextActivity extends AppCompatActivity implements KeyBoardActionListence {
public class SystemKeyboardEditTextActivity extends AppCompatActivity implements KeyBoardActionListener {

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_systemkeyboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_setkeyui"
android:id="@+id/btn_change_ui"
android:text="设置键盘UI"
android:background="#399cff"
android:textColor="@color/white"
Expand All @@ -48,7 +48,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
keyboard:keyViewbg="@drawable/btn_keyboard_key"
keyboard:keyDrawable="@drawable/btn_keyboard_key"
keyboard:xmlLayoutResId="@xml/keyboard_numbers"
/>
</RelativeLayout>
32 changes: 19 additions & 13 deletions app/src/main/res/layout/activity_systemkeyboardedittext.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:keyboard="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">

<com.jay.easykeyboard.SystemKeyBoardEditText
android:id="@+id/skb_top"
android:layout_width="match_parent"
android:layout_height="50dp"
keyboard:xmlLayoutResId="@xml/keyboard_numbers"
keyboard:outSideCancel="true"
android:id="@+id/skb_top"
android:hint="顶部EditText"
android:layout_margin="10dp"
android:background="@drawable/btn_keyboard_key"
/>
android:background="@drawable/edit_bg"
android:hint="顶部EditText(附加属性:点击外部区域消失)"
android:padding="10dp"
keyboard:keyDrawable="@drawable/btn_keyboard_key"
keyboard:outSideCancel="true"
keyboard:xmlLayoutResId="@xml/keyboard_numbers" />

<com.jay.easykeyboard.SystemKeyBoardEditText
android:id="@+id/skb_bottom"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:layout_alignParentBottom="true"
android:hint="底部EditText"
android:id="@+id/skb_bottom"
android:background="@drawable/edit_bg"
android:hint="底部EditText(附加属性:输入框自动上移,4位空格)"
android:padding="10dp"
keyboard:keyDrawable="@drawable/btn_keyboard_key"
keyboard:space="true"
android:layout_gravity="bottom"
android:layout_marginBottom="10dp"
keyboard:xmlLayoutResId="@xml/keyboard_numbers"
android:background="@drawable/btn_keyboard_key"
/>
</RelativeLayout>
</FrameLayout>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' // Add this line
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Loading

0 comments on commit 6d7d0ef

Please sign in to comment.