version:1.3.9
fix: update:优化退出界面
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
|||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 28
|
versionCode 31
|
||||||
versionName "1.3.6"
|
versionName "1.3.9"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
@@ -81,22 +81,22 @@ android {
|
|||||||
// signingConfig signingConfigs.iPlay50SE
|
// signingConfig signingConfigs.iPlay50SE
|
||||||
// }
|
// }
|
||||||
|
|
||||||
iPlay50SEDebug.initWith(debug)
|
// iPlay50SEDebug.initWith(debug)
|
||||||
iPlay50SEDebug {
|
// iPlay50SEDebug {
|
||||||
versionNameSuffix "-debug"
|
// versionNameSuffix "-debug"
|
||||||
debuggable true
|
// debuggable true
|
||||||
signingConfig signingConfigs.tuixin
|
// signingConfig signingConfigs.tuixin
|
||||||
resValue "string", "app_name", "智慧课堂"
|
// resValue "string", "app_name", "学习课堂"
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
iPlay50SERelease.initWith(release)
|
// iPlay50SERelease.initWith(release)
|
||||||
iPlay50SERelease {
|
// iPlay50SERelease {
|
||||||
signingConfig signingConfigs.tuixin
|
// signingConfig signingConfigs.tuixin
|
||||||
resValue "string", "app_name", "智慧课堂"
|
// resValue "string", "app_name", "学习课堂"
|
||||||
}
|
// }
|
||||||
|
|
||||||
debug {
|
debug {
|
||||||
resValue "string", "app_name", "教育中心"
|
// resValue "string", "app_name", "学习课堂"
|
||||||
// 显示Log
|
// 显示Log
|
||||||
versionNameSuffix "-debug"
|
versionNameSuffix "-debug"
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
@@ -106,8 +106,8 @@ android {
|
|||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.each { output ->
|
variant.outputs.each { output ->
|
||||||
if (outputFile != null) {
|
if (outputFile != null) {
|
||||||
def app_name = getResValues().get("app_name").value
|
// def app_name = getResValues().get("app_name").value
|
||||||
def fileName = "${appName()}-${app_name}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
||||||
output.outputFileName = fileName
|
output.outputFileName = fileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
release {
|
release {
|
||||||
resValue "string", "app_name", "教育中心"
|
// resValue "string", "app_name", "学习课堂"
|
||||||
//混淆
|
//混淆
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
//Zipalign优化
|
//Zipalign优化
|
||||||
@@ -129,8 +129,8 @@ android {
|
|||||||
variant.outputs.each { output ->
|
variant.outputs.each { output ->
|
||||||
def outputFile = ""
|
def outputFile = ""
|
||||||
if (outputFile != null) {
|
if (outputFile != null) {
|
||||||
def app_name = getResValues().get("app_name").value
|
// def app_name = getResValues().get("app_name").value
|
||||||
def fileName = "${appName()}-${app_name}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
||||||
output.outputFileName = new File(outputFile, fileName)
|
output.outputFileName = new File(outputFile, fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,6 +144,8 @@ dependencies {
|
|||||||
compileOnly files('libs/framework.jar')
|
compileOnly files('libs/framework.jar')
|
||||||
implementation project(path: ':niceimageview')
|
implementation project(path: ':niceimageview')
|
||||||
implementation project(path: ':FlycoTabLayoutZ_Lib')
|
implementation project(path: ':FlycoTabLayoutZ_Lib')
|
||||||
|
implementation project(path: ':verification-view')
|
||||||
|
|
||||||
|
|
||||||
//保持1.3.1 更新会报错
|
//保持1.3.1 更新会报错
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
@@ -216,7 +218,7 @@ dependencies {
|
|||||||
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.16'
|
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.16'
|
||||||
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.16'
|
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.16'
|
||||||
//验证码输入
|
//验证码输入
|
||||||
implementation 'com.jacktuotuo.customview:verificationcodeview:1.0.5'
|
// implementation 'com.jacktuotuo.customview:verificationcodeview:1.0.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
preBuild {
|
preBuild {
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
package com.uiui.zyos.activity;
|
package com.uiui.zyos.activity;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.media.AudioAttributes;
|
||||||
|
import android.media.SoundPool;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -30,29 +32,29 @@ public class ScreenLockActivity extends BaseActivity {
|
|||||||
private static final String TAG = ScreenLockActivity.class.getSimpleName();
|
private static final String TAG = ScreenLockActivity.class.getSimpleName();
|
||||||
|
|
||||||
@BindView(R.id.bt_0)
|
@BindView(R.id.bt_0)
|
||||||
Button bt0;
|
TextView bt0;
|
||||||
@BindView(R.id.bt_1)
|
@BindView(R.id.bt_1)
|
||||||
Button bt1;
|
TextView bt1;
|
||||||
@BindView(R.id.bt_2)
|
@BindView(R.id.bt_2)
|
||||||
Button bt2;
|
TextView bt2;
|
||||||
@BindView(R.id.bt_3)
|
@BindView(R.id.bt_3)
|
||||||
Button bt3;
|
TextView bt3;
|
||||||
@BindView(R.id.bt_4)
|
@BindView(R.id.bt_4)
|
||||||
Button bt4;
|
TextView bt4;
|
||||||
@BindView(R.id.bt_5)
|
@BindView(R.id.bt_5)
|
||||||
Button bt5;
|
TextView bt5;
|
||||||
@BindView(R.id.bt_6)
|
@BindView(R.id.bt_6)
|
||||||
Button bt6;
|
TextView bt6;
|
||||||
@BindView(R.id.bt_7)
|
@BindView(R.id.bt_7)
|
||||||
Button bt7;
|
TextView bt7;
|
||||||
@BindView(R.id.bt_8)
|
@BindView(R.id.bt_8)
|
||||||
Button bt8;
|
TextView bt8;
|
||||||
@BindView(R.id.bt_9)
|
@BindView(R.id.bt_9)
|
||||||
Button bt9;
|
TextView bt9;
|
||||||
@BindView(R.id.bt_del)
|
@BindView(R.id.bt_del)
|
||||||
Button bt_del;
|
TextView bt_del;
|
||||||
@BindView(R.id.bt_confirm)
|
@BindView(R.id.bt_confirm)
|
||||||
Button bt_confirm;
|
TextView bt_confirm;
|
||||||
|
|
||||||
@BindView(R.id.textView)
|
@BindView(R.id.textView)
|
||||||
TextView textView;
|
TextView textView;
|
||||||
@@ -63,10 +65,21 @@ public class ScreenLockActivity extends BaseActivity {
|
|||||||
@BindView(R.id.icv)
|
@BindView(R.id.icv)
|
||||||
VerificationCodeView codeView;
|
VerificationCodeView codeView;
|
||||||
|
|
||||||
|
private SoundPool soundPool;
|
||||||
|
private int soundId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||||
|
AudioAttributes attr = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_GAME) // 设置音效使用场景
|
||||||
|
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build(); // 设置音效的类型
|
||||||
|
soundPool = new SoundPool.Builder().setAudioAttributes(attr) // 设置音效池的属性
|
||||||
|
.setMaxStreams(1) // 设置最多可容纳10个音频流
|
||||||
|
.build(); // ①
|
||||||
|
// load方法加载指定音频文件,并返回所加载的音效ID
|
||||||
|
// 此处使用HashMap来管理这些音频流
|
||||||
|
soundId = soundPool.load(this, R.raw.click, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -88,7 +101,7 @@ public class ScreenLockActivity extends BaseActivity {
|
|||||||
codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() {
|
codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() {
|
||||||
@Override
|
@Override
|
||||||
public void inputComplete() {
|
public void inputComplete() {
|
||||||
|
checkPasswd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -107,24 +120,7 @@ public class ScreenLockActivity extends BaseActivity {
|
|||||||
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
String content = codeView.getInputContent();
|
checkPasswd();
|
||||||
if (TextUtils.isEmpty(content)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.e(TAG, "inputComplete: " + content);
|
|
||||||
String password = Settings.Global.getString(getContentResolver(), CommonConfig.DEFAULT_PASSWORD);
|
|
||||||
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
|
|
||||||
if (password.equals(content)) {
|
|
||||||
exitDesktop();
|
|
||||||
} else {
|
|
||||||
tv_hint.setText("密码错误");
|
|
||||||
}
|
|
||||||
} else if (CommonConfig.DEFAULT_PASSWORD.equals(content)) {
|
|
||||||
exitDesktop();
|
|
||||||
} else {
|
|
||||||
// ToastUtil.show("密码错误");
|
|
||||||
tv_hint.setText("密码错误");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -140,6 +136,38 @@ public class ScreenLockActivity extends BaseActivity {
|
|||||||
bt9.setOnClickListener(view1 -> add(codeView, "9"));
|
bt9.setOnClickListener(view1 -> add(codeView, "9"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkPasswd() {
|
||||||
|
String content = codeView.getInputContent();
|
||||||
|
if (TextUtils.isEmpty(content) || content.length() != 6) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.e(TAG, "inputComplete: " + content);
|
||||||
|
String password = Settings.Global.getString(getContentResolver(), CommonConfig.DEFAULT_PASSWORD);
|
||||||
|
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
|
||||||
|
if (password.equals(content)) {
|
||||||
|
exitDesktop();
|
||||||
|
} else {
|
||||||
|
setEmpty();
|
||||||
|
tv_hint.setText("密码错误");
|
||||||
|
}
|
||||||
|
} else if (CommonConfig.DEFAULT_PASSWORD.equals(content)) {
|
||||||
|
exitDesktop();
|
||||||
|
} else {
|
||||||
|
setEmpty();
|
||||||
|
tv_hint.setText("密码错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEmpty() {
|
||||||
|
Handler.getMain().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
codeView.clearInputContent();
|
||||||
|
tv_hint.setText("");
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
|
|
||||||
@@ -150,15 +178,16 @@ public class ScreenLockActivity extends BaseActivity {
|
|||||||
String oldText = codeView.getEditText().getText().toString();
|
String oldText = codeView.getEditText().getText().toString();
|
||||||
Log.e(TAG, "add: " + oldText);
|
Log.e(TAG, "add: " + oldText);
|
||||||
codeView.getEditText().setText(text);
|
codeView.getEditText().setText(text);
|
||||||
|
soundPool.play(soundId, 1, 1, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitDesktop() {
|
private void exitDesktop() {
|
||||||
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||||
if (Build.VERSION.SDK_INT> Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
||||||
if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
|
if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
|
||||||
ApkUtils.gotoLauncher(this);
|
ApkUtils.gotoLauncher(this);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
||||||
ApkUtils.gotoLauncher(this);
|
ApkUtils.gotoLauncher(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,14 +79,14 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startJxwLauncher() {
|
private void startJxwLauncher() {
|
||||||
ComponentName cn = new ComponentName(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_CLASS_NAME);
|
// ComponentName cn = new ComponentName(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_CLASS_NAME);
|
||||||
Intent intent = new Intent();
|
// Intent intent = new Intent();
|
||||||
intent.setComponent(cn);
|
// intent.setComponent(cn);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
startForegroundService(intent);
|
// startForegroundService(intent);
|
||||||
} else {
|
// } else {
|
||||||
startService(intent);
|
// startService(intent);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterReceiver() {
|
private void unregisterReceiver() {
|
||||||
|
|||||||
BIN
app/src/main/res/drawable-hdpi/control_background.png
Normal file
BIN
app/src/main/res/drawable-hdpi/control_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_lock.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_lock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 900 B |
@@ -4,53 +4,47 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/float_window_color">
|
android:background="@drawable/control_background">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
<TextView
|
android:id="@+id/imageView5"
|
||||||
android:id="@+id/textView"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:layout_height="wrap_content"
|
android:adjustViewBounds="true"
|
||||||
android:text="退出系统"
|
android:scaleType="centerCrop"
|
||||||
android:textStyle="bold"
|
android:src="@drawable/icon_lock"
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_15"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.065" />
|
app:layout_constraintVertical_bias="0.11" />
|
||||||
|
|
||||||
<TextView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/textView4"
|
android:id="@+id/constraintLayout5"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
app:layout_constraintBottom_toTopOf="@+id/ll_keyboard"
|
||||||
android:maxLines="1"
|
app:layout_constraintTop_toBottomOf="@+id/imageView5"
|
||||||
android:singleLine="true"
|
app:layout_constraintVertical_bias="0.347"
|
||||||
android:textColor="@color/white"
|
tools:layout_editor_absoluteX="0dp">
|
||||||
android:textSize="@dimen/sp_14"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
|
||||||
|
|
||||||
<com.tuo.customview.VerificationCodeView
|
<com.tuo.customview.VerificationCodeView
|
||||||
android:id="@+id/icv"
|
android:id="@+id/icv"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/sp_32"
|
android:layout_height="@dimen/sp_32"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
app:icv_et_bg_focus="@color/transparent"
|
||||||
app:icv_et_bg_focus="@drawable/shape_icv_et_bg_focus1"
|
app:icv_et_bg_normal="@color/transparent"
|
||||||
app:icv_et_bg_normal="@drawable/shape_icv_et_bg_normal1"
|
|
||||||
app:icv_et_divider_drawable="@drawable/shape_divider_identifying"
|
app:icv_et_divider_drawable="@drawable/shape_divider_identifying"
|
||||||
app:icv_et_number="6"
|
app:icv_et_number="6"
|
||||||
app:icv_et_pwd_radius="10dp"
|
app:icv_et_pwd="true"
|
||||||
app:icv_et_text_color="#000000"
|
app:icv_et_pwd_radius="@dimen/dp_4"
|
||||||
|
app:icv_et_text_color="@color/transparent"
|
||||||
app:icv_et_width="@dimen/sp_32"
|
app:icv_et_width="@dimen/sp_32"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_hint"
|
android:id="@+id/tv_hint"
|
||||||
@@ -59,11 +53,28 @@
|
|||||||
android:layout_marginTop="@dimen/dp_16"
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_12"
|
android:textSize="@dimen/sp_11"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/icv"
|
app:layout_constraintEnd_toEndOf="@+id/icv"
|
||||||
app:layout_constraintStart_toStartOf="@+id/icv"
|
app:layout_constraintStart_toStartOf="@+id/icv"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/icv" />
|
app:layout_constraintTop_toBottomOf="@+id/icv" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_48"
|
||||||
|
android:layout_marginEnd="@dimen/dp_48"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:minLines="2"
|
||||||
|
android:text="退出系统"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_14"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_hint" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_keyboard"
|
android:id="@+id/ll_keyboard"
|
||||||
android:layout_width="@dimen/dp_200"
|
android:layout_width="@dimen/dp_200"
|
||||||
@@ -73,7 +84,8 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_hint">
|
app:layout_constraintTop_toBottomOf="@+id/imageView5"
|
||||||
|
app:layout_constraintVertical_bias="0.796">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -81,35 +93,35 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_1"
|
android:id="@+id/bt_1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="1"
|
android:text="1"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_2"
|
android:id="@+id/bt_2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="2"
|
android:text="2"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_3"
|
android:id="@+id/bt_3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="3"
|
android:text="3"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -118,35 +130,35 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_4"
|
android:id="@+id/bt_4"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="4"
|
android:text="4"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_5"
|
android:id="@+id/bt_5"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="5"
|
android:text="5"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_6"
|
android:id="@+id/bt_6"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="6"
|
android:text="6"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -155,35 +167,35 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_7"
|
android:id="@+id/bt_7"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="7"
|
android:text="7"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_8"
|
android:id="@+id/bt_8"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="8"
|
android:text="8"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_9"
|
android:id="@+id/bt_9"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="9"
|
android:text="9"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -192,34 +204,34 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_0"
|
android:id="@+id/bt_0"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_del"
|
android:id="@+id/bt_del"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="清除"
|
android:text="清除"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_confirm"
|
android:id="@+id/bt_confirm"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="确认"
|
android:text="确认"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textSize="@dimen/sp_14" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -1,56 +1,50 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/float_window_color">
|
android:background="@drawable/control_background">
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/imageView5"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/dp_20"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/dp_20"
|
||||||
android:text="退出系统"
|
android:adjustViewBounds="true"
|
||||||
android:textColor="@color/white"
|
android:scaleType="centerCrop"
|
||||||
android:textSize="24sp"
|
android:src="@drawable/icon_lock"
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintVertical_bias="0.219" />
|
app:layout_constraintVertical_bias="0.11" />
|
||||||
|
|
||||||
<TextView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/textView4"
|
android:id="@+id/constraintLayout5"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/dp_40"
|
app:layout_constraintBottom_toTopOf="@+id/ll_keyboard"
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
app:layout_constraintTop_toBottomOf="@+id/imageView5"
|
||||||
android:layout_marginEnd="@dimen/dp_40"
|
app:layout_constraintVertical_bias="0.347"
|
||||||
android:gravity="center"
|
tools:layout_editor_absoluteX="0dp">
|
||||||
android:maxLines="2"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_14"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
|
||||||
|
|
||||||
<com.tuo.customview.VerificationCodeView
|
<com.tuo.customview.VerificationCodeView
|
||||||
android:id="@+id/icv"
|
android:id="@+id/icv"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/sp_32"
|
android:layout_height="@dimen/sp_32"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
app:icv_et_bg_focus="@color/transparent"
|
||||||
app:icv_et_bg_focus="@drawable/shape_icv_et_bg_focus1"
|
app:icv_et_bg_normal="@color/transparent"
|
||||||
app:icv_et_bg_normal="@drawable/shape_icv_et_bg_normal1"
|
|
||||||
app:icv_et_divider_drawable="@drawable/shape_divider_identifying"
|
app:icv_et_divider_drawable="@drawable/shape_divider_identifying"
|
||||||
app:icv_et_number="6"
|
app:icv_et_number="6"
|
||||||
app:icv_et_pwd_radius="10dp"
|
app:icv_et_pwd="true"
|
||||||
app:icv_et_text_color="#000000"
|
app:icv_et_pwd_radius="@dimen/dp_4"
|
||||||
|
app:icv_et_text_color="@color/transparent"
|
||||||
app:icv_et_width="@dimen/sp_32"
|
app:icv_et_width="@dimen/sp_32"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_hint"
|
android:id="@+id/tv_hint"
|
||||||
@@ -59,21 +53,39 @@
|
|||||||
android:layout_marginTop="@dimen/dp_16"
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_12"
|
android:textSize="@dimen/sp_11"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/icv"
|
app:layout_constraintEnd_toEndOf="@+id/icv"
|
||||||
app:layout_constraintStart_toStartOf="@+id/icv"
|
app:layout_constraintStart_toStartOf="@+id/icv"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/icv" />
|
app:layout_constraintTop_toBottomOf="@+id/icv" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_48"
|
||||||
|
android:layout_marginEnd="@dimen/dp_48"
|
||||||
|
android:gravity="center"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:minLines="2"
|
||||||
|
android:text="退出系统"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_14"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_hint" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_keyboard"
|
android:id="@+id/ll_keyboard"
|
||||||
android:layout_width="@dimen/dp_200"
|
android:layout_width="@dimen/dp_200"
|
||||||
android:layout_height="@dimen/dp_200"
|
android:layout_height="@dimen/dp_160"
|
||||||
android:layout_marginBottom="@dimen/dp_32"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/imageView5"
|
||||||
|
app:layout_constraintVertical_bias="0.796">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -81,35 +93,35 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_1"
|
android:id="@+id/bt_1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="1"
|
android:text="1"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_2"
|
android:id="@+id/bt_2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="2"
|
android:text="2"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_3"
|
android:id="@+id/bt_3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="3"
|
android:text="3"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -118,35 +130,35 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_4"
|
android:id="@+id/bt_4"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="4"
|
android:text="4"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_5"
|
android:id="@+id/bt_5"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="5"
|
android:text="5"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_6"
|
android:id="@+id/bt_6"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="6"
|
android:text="6"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -155,35 +167,35 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_7"
|
android:id="@+id/bt_7"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="7"
|
android:text="7"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_8"
|
android:id="@+id/bt_8"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="8"
|
android:text="8"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_9"
|
android:id="@+id/bt_9"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="9"
|
android:text="9"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -192,34 +204,34 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_0"
|
android:id="@+id/bt_0"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_del"
|
android:id="@+id/bt_del"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="清除"
|
android:text="清除"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/bt_confirm"
|
android:id="@+id/bt_confirm"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/dp_2"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/shape_bt_bg"
|
android:gravity="center"
|
||||||
android:text="确认"
|
android:text="确认"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textSize="@dimen/sp_14" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
BIN
app/src/main/res/raw/click.mp3
Normal file
BIN
app/src/main/res/raw/click.mp3
Normal file
Binary file not shown.
@@ -1,7 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<!-- <string name="app_name">教育中心</string>-->
|
<string name="app_name">学习课堂</string>
|
||||||
<!-- <string name="app_name">智慧课堂</string>-->
|
|
||||||
|
|
||||||
<string name="privacy_agreement"><u>隐私协议</u></string>
|
<string name="privacy_agreement"><u>隐私协议</u></string>
|
||||||
<string name="privacy_agreement_title">服务协议和隐私政策</string>
|
<string name="privacy_agreement_title">服务协议和隐私政策</string>
|
||||||
<string name="privacy_agreement_content">\t\t\t\t请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了向你提供即时通讯,内容分享等服务,
|
<string name="privacy_agreement_content">\t\t\t\t请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了向你提供即时通讯,内容分享等服务,
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
include ':app', ':niceimageview', ':FlycoTabLayoutZ_Lib'
|
include ':app', ':niceimageview', ':FlycoTabLayoutZ_Lib', ':verification-view'
|
||||||
rootProject.name='科大讯飞智慧课堂'
|
rootProject.name='科大讯飞智慧课堂'
|
||||||
2
verification-view/.gitignore
vendored
Normal file
2
verification-view/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
.iml
|
||||||
70
verification-view/build.gradle
Normal file
70
verification-view/build.gradle
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.2'
|
||||||
|
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 15
|
||||||
|
targetSdkVersion 25
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
iPlay50Debug{}
|
||||||
|
iPlay50Release{}
|
||||||
|
zhanRuiUserdebug{}
|
||||||
|
iPlay50SEDebug{}
|
||||||
|
iPlay50SERelease{}
|
||||||
|
iPlay50ProDebug{}
|
||||||
|
iPlay50ProRelease{}
|
||||||
|
iPlay50miniDebug{}
|
||||||
|
iPlay50miniRelease{}
|
||||||
|
iPlay5013Debug{}
|
||||||
|
iPlay5013Release{}
|
||||||
|
MTKAndroid12Debug {}
|
||||||
|
MTKAndroid12Release {}
|
||||||
|
teclast8183Debug {}
|
||||||
|
teclast8183Release {}
|
||||||
|
XPadDebug{}
|
||||||
|
XPadRelease{}
|
||||||
|
debug {}
|
||||||
|
release {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
//// 上传 jcenter 的配置
|
||||||
|
//apply plugin: 'com.novoda.bintray-release'//添加
|
||||||
|
//
|
||||||
|
////添加
|
||||||
|
//publish {
|
||||||
|
// userOrg = 'jacktuotuo'//用户名
|
||||||
|
// repoName = 'maven' //仓库的名字
|
||||||
|
// groupId = 'com.jacktuotuo.customview'//jcenter上的路径
|
||||||
|
// artifactId = 'verificationcodeview'//项目名称
|
||||||
|
// publishVersion = '1.0.5'//版本号
|
||||||
|
// desc = 'a custom View of the square verification code input box'//描述
|
||||||
|
// website = 'http://blog.csdn.net/qq_33553515'//个人网站
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
// gradle clean build bintrayUpload -PbintrayUser=jacktuotuo -PbintrayKey=key -PdryRun=false
|
||||||
|
// 最终引用路径 compile 'com.jacktuotuo.customview:verificationcodeview:1.0.0
|
||||||
|
|
||||||
|
|
||||||
21
verification-view/proguard-rules.pro
vendored
Normal file
21
verification-view/proguard-rules.pro
vendored
Normal 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
|
||||||
2
verification-view/src/main/AndroidManifest.xml
Normal file
2
verification-view/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.tuo.customview" />
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.tuo.customview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputConnection;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.AppCompatEditText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* author slimvan
|
||||||
|
* email: slimvan@163.com
|
||||||
|
* date 2018/7/24.
|
||||||
|
* desc: 重写InputConnection 监听返回键
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PwdEditText extends AppCompatEditText {
|
||||||
|
private TInputConnection inputConnection;
|
||||||
|
|
||||||
|
public PwdEditText(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PwdEditText(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PwdEditText(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(){
|
||||||
|
inputConnection = new TInputConnection(null,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当输入法和EditText建立连接的时候会通过这个方法返回一个InputConnection。
|
||||||
|
* 我们需要代理这个方法的父类方法生成的InputConnection并返回我们自己的代理类。
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||||
|
inputConnection.setTarget(super.onCreateInputConnection(outAttrs));
|
||||||
|
return inputConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackSpaceListener(TInputConnection.BackspaceListener backSpaceLisetener){
|
||||||
|
inputConnection.setBackspaceListener(backSpaceLisetener);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.tuo.customview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 作者:Tuo on 2018/4/13 16:35
|
||||||
|
* 邮箱:839539179@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PwdTextView extends AppCompatTextView {
|
||||||
|
|
||||||
|
|
||||||
|
private float radius;
|
||||||
|
|
||||||
|
private boolean hasPwd;
|
||||||
|
|
||||||
|
public PwdTextView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PwdTextView(Context context, AttributeSet attrs) {
|
||||||
|
this(context, attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PwdTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
|
||||||
|
if (hasPwd) {
|
||||||
|
// 画一个黑色的圆
|
||||||
|
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
paint.setColor(Color.WHITE);
|
||||||
|
paint.setStyle(Paint.Style.FILL);
|
||||||
|
canvas.drawCircle(getWidth() / 2, getHeight() / 2, radius, paint);
|
||||||
|
}else {
|
||||||
|
// 占位白色的圆
|
||||||
|
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
paint.setColor(getResources().getColor(R.color.circle_bg));
|
||||||
|
paint.setStyle(Paint.Style.FILL);
|
||||||
|
canvas.drawCircle(getWidth() / 2, getHeight() / 2, radius, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void clearPwd() {
|
||||||
|
this.hasPwd = false;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void drawPwd(float radius) {
|
||||||
|
this.hasPwd = true;
|
||||||
|
if (radius == 0) {
|
||||||
|
this.radius = getWidth() / 4;
|
||||||
|
} else {
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawPwdBg(float radius) {
|
||||||
|
if (radius == 0) {
|
||||||
|
this.radius = getWidth() / 4;
|
||||||
|
} else {
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.tuo.customview;
|
||||||
|
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.inputmethod.InputConnection;
|
||||||
|
import android.view.inputmethod.InputConnectionWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* author slimvan
|
||||||
|
* email: slimvan@163.com
|
||||||
|
* date 2018/7/24.
|
||||||
|
* desc: 参考https://blog.csdn.net/frained/article/details/78880579
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TInputConnection extends InputConnectionWrapper {
|
||||||
|
|
||||||
|
private BackspaceListener mBackspaceListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a wrapper.
|
||||||
|
* <p>
|
||||||
|
* <p><b>Caveat:</b> Although the system can accept {@code (InputConnection) null} in some
|
||||||
|
* places, you cannot emulate such a behavior by non-null {@link InputConnectionWrapper} that
|
||||||
|
* has {@code null} in {@code target}.</p>
|
||||||
|
*
|
||||||
|
* @param target the {@link InputConnection} to be proxied.
|
||||||
|
* @param mutable set {@code true} to protect this object from being reconfigured to target
|
||||||
|
* another {@link InputConnection}. Note that this is ignored while the target is {@code null}.
|
||||||
|
*/
|
||||||
|
public TInputConnection(InputConnection target, boolean mutable) {
|
||||||
|
super(target, mutable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BackspaceListener {
|
||||||
|
/**
|
||||||
|
* @return true 代表消费了这个事件
|
||||||
|
* */
|
||||||
|
boolean onBackspace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当软键盘删除文本之前,会调用这个方法通知输入框,我们可以重写这个方法并判断是否要拦截这个删除事件。
|
||||||
|
* 在谷歌输入法上,点击退格键的时候不会调用{@link #sendKeyEvent(KeyEvent event)},
|
||||||
|
* 而是直接回调这个方法,所以也要在这个方法上做拦截;
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
|
||||||
|
if(mBackspaceListener != null){
|
||||||
|
if(mBackspaceListener.onBackspace()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.deleteSurroundingText(beforeLength, afterLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackspaceListener(BackspaceListener backspaceListener) {
|
||||||
|
this.mBackspaceListener = backspaceListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当在软件盘上点击某些按钮(比如退格键,数字键,回车键等),该方法可能会被触发(取决于输入法的开发者),
|
||||||
|
* 所以也可以重写该方法并拦截这些事件,这些事件就不会被分发到输入框了
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public boolean sendKeyEvent(KeyEvent event) {
|
||||||
|
if( event.getKeyCode() == KeyEvent.KEYCODE_DEL && event.getAction() == KeyEvent.ACTION_DOWN){
|
||||||
|
if(mBackspaceListener != null && mBackspaceListener.onBackspace()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.sendKeyEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
package com.tuo.customview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.InputFilter;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* description: 自定义view 验证码 输入框
|
||||||
|
* Created by Jack on 2017/6/2.
|
||||||
|
* 邮箱:839539179@qq.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VerificationCodeView extends RelativeLayout {
|
||||||
|
|
||||||
|
private LinearLayout containerEt;
|
||||||
|
|
||||||
|
private PwdEditText et;
|
||||||
|
// 输入框数量
|
||||||
|
private int mEtNumber;
|
||||||
|
// 输入框的宽度
|
||||||
|
private int mEtWidth;
|
||||||
|
//输入框分割线
|
||||||
|
private Drawable mEtDividerDrawable;
|
||||||
|
//输入框文字颜色
|
||||||
|
private int mEtTextColor;
|
||||||
|
//输入框文字大小
|
||||||
|
private float mEtTextSize;
|
||||||
|
//输入框获取焦点时背景
|
||||||
|
private Drawable mEtBackgroundDrawableFocus;
|
||||||
|
//输入框没有焦点时背景
|
||||||
|
private Drawable mEtBackgroundDrawableNormal;
|
||||||
|
//是否是密码模式
|
||||||
|
private boolean mEtPwd;
|
||||||
|
//密码模式时圆的半径
|
||||||
|
private float mEtPwdRadius;
|
||||||
|
|
||||||
|
//存储TextView的数据 数量由自定义控件的属性传入
|
||||||
|
private PwdTextView[] mPwdTextViews;
|
||||||
|
|
||||||
|
private MyTextWatcher myTextWatcher = new MyTextWatcher();
|
||||||
|
|
||||||
|
|
||||||
|
public VerificationCodeView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificationCodeView(Context context, AttributeSet attrs) {
|
||||||
|
this(context, attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificationCodeView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
init(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化 布局和属性
|
||||||
|
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.layout_identifying_code, this);
|
||||||
|
containerEt = (LinearLayout) this.findViewById(R.id.container_et);
|
||||||
|
et = (PwdEditText) this.findViewById(R.id.et);
|
||||||
|
|
||||||
|
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.VerificationCodeView, defStyleAttr, 0);
|
||||||
|
mEtNumber = typedArray.getInteger(R.styleable.VerificationCodeView_icv_et_number, 1);
|
||||||
|
mEtWidth = typedArray.getDimensionPixelSize(R.styleable.VerificationCodeView_icv_et_width, 42);
|
||||||
|
mEtDividerDrawable = typedArray.getDrawable(R.styleable.VerificationCodeView_icv_et_divider_drawable);
|
||||||
|
mEtTextSize = typedArray.getDimensionPixelSize(R.styleable.VerificationCodeView_icv_et_text_size, (int) sp2px(16, context));
|
||||||
|
mEtTextColor = typedArray.getColor(R.styleable.VerificationCodeView_icv_et_text_color, Color.BLACK);
|
||||||
|
mEtBackgroundDrawableFocus = typedArray.getDrawable(R.styleable.VerificationCodeView_icv_et_bg_focus);
|
||||||
|
mEtBackgroundDrawableNormal = typedArray.getDrawable(R.styleable.VerificationCodeView_icv_et_bg_normal);
|
||||||
|
mEtPwd = typedArray.getBoolean(R.styleable.VerificationCodeView_icv_et_pwd, false);
|
||||||
|
mEtPwdRadius = typedArray.getDimensionPixelSize(R.styleable.VerificationCodeView_icv_et_pwd_radius, 0);
|
||||||
|
//释放资源
|
||||||
|
typedArray.recycle();
|
||||||
|
|
||||||
|
|
||||||
|
// 当xml中未配置时 这里进行初始配置默认图片
|
||||||
|
if (mEtDividerDrawable == null) {
|
||||||
|
mEtDividerDrawable = context.getResources().getDrawable(R.drawable.shape_divider_identifying);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mEtBackgroundDrawableFocus == null) {
|
||||||
|
mEtBackgroundDrawableFocus = context.getResources().getDrawable(R.drawable.shape_icv_et_bg_focus);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mEtBackgroundDrawableNormal == null) {
|
||||||
|
mEtBackgroundDrawableNormal = context.getResources().getDrawable(R.drawable.shape_icv_et_bg_normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始UI
|
||||||
|
private void initUI() {
|
||||||
|
initTextViews(getContext(), mEtNumber, mEtWidth, mEtDividerDrawable, mEtTextSize, mEtTextColor);
|
||||||
|
initEtContainer(mPwdTextViews);
|
||||||
|
setListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
// 设置当 高为 warpContent 模式时的默认值 为 50dp
|
||||||
|
int mHeightMeasureSpec = heightMeasureSpec;
|
||||||
|
|
||||||
|
int heightMode = MeasureSpec.getMode(mHeightMeasureSpec);
|
||||||
|
if (heightMode == MeasureSpec.AT_MOST) {
|
||||||
|
mHeightMeasureSpec = MeasureSpec.makeMeasureSpec((int) dp2px(50, getContext()), MeasureSpec.EXACTLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onMeasure(widthMeasureSpec, mHeightMeasureSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//初始化TextView
|
||||||
|
private void initTextViews(Context context, int etNumber, int etWidth, Drawable etDividerDrawable, float etTextSize, int etTextColor) {
|
||||||
|
// 设置 editText 的输入长度
|
||||||
|
et.setCursorVisible(false);//将光标隐藏
|
||||||
|
et.setFilters(new InputFilter[]{new InputFilter.LengthFilter(etNumber)}); //最大输入长度
|
||||||
|
// 设置分割线的宽度
|
||||||
|
if (etDividerDrawable != null) {
|
||||||
|
etDividerDrawable.setBounds(0, 0, etDividerDrawable.getMinimumWidth(), etDividerDrawable.getMinimumHeight());
|
||||||
|
containerEt.setDividerDrawable(etDividerDrawable);
|
||||||
|
}
|
||||||
|
mPwdTextViews = new PwdTextView[etNumber];
|
||||||
|
|
||||||
|
for (int i = 0; i < mPwdTextViews.length; i++) {
|
||||||
|
PwdTextView textView = new PwdTextView(context);
|
||||||
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, etTextSize);
|
||||||
|
textView.setTextColor(etTextColor);
|
||||||
|
textView.setWidth(etWidth);
|
||||||
|
textView.setHeight(etWidth);
|
||||||
|
if (mEtPwd) {
|
||||||
|
textView.drawPwdBg(mEtPwdRadius);
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
textView.setBackgroundDrawable(mEtBackgroundDrawableFocus);
|
||||||
|
} else {
|
||||||
|
textView.setBackgroundDrawable(mEtBackgroundDrawableNormal);
|
||||||
|
}
|
||||||
|
textView.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
textView.setFocusable(false);
|
||||||
|
|
||||||
|
mPwdTextViews[i] = textView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化存储TextView 的容器
|
||||||
|
private void initEtContainer(TextView[] mTextViews) {
|
||||||
|
for (TextView mTextView : mTextViews) {
|
||||||
|
containerEt.addView(mTextView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setListener() {
|
||||||
|
// 监听输入内容
|
||||||
|
et.addTextChangedListener(myTextWatcher);
|
||||||
|
|
||||||
|
// 监听删除按键
|
||||||
|
et.setOnKeyListener(new OnKeyListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_DEL && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
|
onKeyDelete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 给TextView 设置文字
|
||||||
|
private void setText(String inputContent) {
|
||||||
|
|
||||||
|
for (int i = 0; i < mPwdTextViews.length; i++) {
|
||||||
|
PwdTextView tv = mPwdTextViews[i];
|
||||||
|
if (tv.getText().toString().trim().equals("")) {
|
||||||
|
if (mEtPwd) {
|
||||||
|
tv.drawPwd(mEtPwdRadius);
|
||||||
|
}
|
||||||
|
tv.setText(inputContent);
|
||||||
|
// 添加输入完成的监听
|
||||||
|
if (inputCompleteListener != null) {
|
||||||
|
inputCompleteListener.inputComplete();
|
||||||
|
}
|
||||||
|
tv.setBackgroundDrawable(mEtBackgroundDrawableNormal);
|
||||||
|
if (i < mEtNumber - 1) {
|
||||||
|
mPwdTextViews[i + 1].setBackgroundDrawable(mEtBackgroundDrawableFocus);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听删除
|
||||||
|
private void onKeyDelete() {
|
||||||
|
for (int i = mPwdTextViews.length - 1; i >= 0; i--) {
|
||||||
|
PwdTextView tv = mPwdTextViews[i];
|
||||||
|
if (!tv.getText().toString().trim().equals("")) {
|
||||||
|
if (mEtPwd) {
|
||||||
|
tv.clearPwd();
|
||||||
|
}
|
||||||
|
tv.setText("");
|
||||||
|
// 添加删除完成监听
|
||||||
|
tv.setBackgroundDrawable(mEtBackgroundDrawableNormal);
|
||||||
|
if (i < mEtNumber - 1) {
|
||||||
|
mPwdTextViews[i + 1].setBackgroundDrawable(mEtBackgroundDrawableFocus);
|
||||||
|
}
|
||||||
|
// 添加输入完成的监听
|
||||||
|
if (inputCompleteListener != null) {
|
||||||
|
inputCompleteListener.inputComplete();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取输入文本
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public String getInputContent() {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
for (TextView tv : mPwdTextViews) {
|
||||||
|
buffer.append(tv.getText().toString().trim());
|
||||||
|
}
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除输入内容
|
||||||
|
*/
|
||||||
|
public void clearInputContent() {
|
||||||
|
for (int i = 0; i < mPwdTextViews.length; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
mPwdTextViews[i].setBackgroundDrawable(mEtBackgroundDrawableFocus);
|
||||||
|
} else {
|
||||||
|
mPwdTextViews[i].setBackgroundDrawable(mEtBackgroundDrawableNormal);
|
||||||
|
}
|
||||||
|
if (mEtPwd) {
|
||||||
|
mPwdTextViews[i].clearPwd();
|
||||||
|
}
|
||||||
|
mPwdTextViews[i].setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置输入框个数
|
||||||
|
*
|
||||||
|
* @param etNumber
|
||||||
|
*/
|
||||||
|
public void setEtNumber(int etNumber) {
|
||||||
|
this.mEtNumber = etNumber;
|
||||||
|
et.removeTextChangedListener(myTextWatcher);
|
||||||
|
containerEt.removeAllViews();
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取输入的位数
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getEtNumber() {
|
||||||
|
return mEtNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否是密码模式 默认不是
|
||||||
|
*
|
||||||
|
* @param isPwdMode
|
||||||
|
*/
|
||||||
|
public void setPwdMode(boolean isPwdMode) {
|
||||||
|
this.mEtPwd = isPwdMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取输入的EditText 用于外界设置键盘弹出
|
||||||
|
*
|
||||||
|
* @return EditText
|
||||||
|
*/
|
||||||
|
public EditText getEditText() {
|
||||||
|
return et;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 输入完成 和 删除成功 的监听
|
||||||
|
private InputCompleteListener inputCompleteListener;
|
||||||
|
|
||||||
|
public void setInputCompleteListener(InputCompleteListener inputCompleteListener) {
|
||||||
|
this.inputCompleteListener = inputCompleteListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface InputCompleteListener {
|
||||||
|
void inputComplete();
|
||||||
|
|
||||||
|
void deleteContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public float dp2px(float dpValue, Context context) {
|
||||||
|
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||||
|
dpValue, context.getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
|
public float sp2px(float spValue, Context context) {
|
||||||
|
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
|
||||||
|
spValue, context.getResources().getDisplayMetrics());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class MyTextWatcher implements TextWatcher {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable editable) {
|
||||||
|
String inputStr = editable.toString();
|
||||||
|
if (!TextUtils.isEmpty(inputStr)) {
|
||||||
|
|
||||||
|
String[] strArray = inputStr.split("");
|
||||||
|
|
||||||
|
for (int i = 0; i < strArray.length; i++) {
|
||||||
|
|
||||||
|
// 不能大于输入框个数
|
||||||
|
if (i > mEtNumber) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
setText(strArray[i]);
|
||||||
|
et.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<size
|
||||||
|
android:width="6dp"
|
||||||
|
android:height="6dp" />
|
||||||
|
<solid android:color="#00000000" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#F2F2F2" />
|
||||||
|
<!-- 大小 -->
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" /><!-- 宽度和高度 -->
|
||||||
|
<corners android:radius="2dp" />
|
||||||
|
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="#A6D8EB" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#F2F2F2" />
|
||||||
|
<!-- 大小 -->
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" /><!-- 宽度和高度 -->
|
||||||
|
<corners android:radius="2dp" />
|
||||||
|
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="#C7C7CD" />
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/container_et"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:showDividers="middle">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.tuo.customview.PwdEditText
|
||||||
|
android:id="@+id/et"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:inputType="number" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
24
verification-view/src/main/res/values/attrs.xml
Normal file
24
verification-view/src/main/res/values/attrs.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- 自定义验证码输入框-->
|
||||||
|
<declare-styleable name="VerificationCodeView">
|
||||||
|
<!--输入框的数量-->
|
||||||
|
<attr name="icv_et_number" format="integer" />
|
||||||
|
<!--输入框的宽度-->
|
||||||
|
<attr name="icv_et_width" format="dimension|reference" />
|
||||||
|
<!--输入框之间的分割线-->
|
||||||
|
<attr name="icv_et_divider_drawable" format="reference" />
|
||||||
|
<!--输入框文字颜色-->
|
||||||
|
<attr name="icv_et_text_color" format="color|reference" />
|
||||||
|
<!--输入框文字大小-->
|
||||||
|
<attr name="icv_et_text_size" format="dimension|reference" />
|
||||||
|
<!--输入框获取焦点时边框-->
|
||||||
|
<attr name="icv_et_bg_focus" format="reference" />
|
||||||
|
<!--输入框没有焦点时边框-->
|
||||||
|
<attr name="icv_et_bg_normal" format="reference" />
|
||||||
|
<!--是否是密码模式-->
|
||||||
|
<attr name="icv_et_pwd" format="boolean" />
|
||||||
|
<!--密码模式时,圆的半径-->
|
||||||
|
<attr name="icv_et_pwd_radius" format="dimension|reference" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
||||||
6
verification-view/src/main/res/values/colors.xml
Normal file
6
verification-view/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<color name="circle_bg">#2a2c36</color>
|
||||||
|
|
||||||
|
</resources>
|
||||||
3
verification-view/src/main/res/values/strings.xml
Normal file
3
verification-view/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">VerificationView</string>
|
||||||
|
</resources>
|
||||||
Reference in New Issue
Block a user