diff --git a/app/build.gradle b/app/build.gradle index c2a9357..57383ac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,8 +17,8 @@ android { minSdkVersion 24 targetSdkVersion 29 - versionCode 28 - versionName "1.3.6" + versionCode 31 + versionName "1.3.9" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -81,22 +81,22 @@ android { // signingConfig signingConfigs.iPlay50SE // } - iPlay50SEDebug.initWith(debug) - iPlay50SEDebug { - versionNameSuffix "-debug" - debuggable true - signingConfig signingConfigs.tuixin - resValue "string", "app_name", "智慧课堂" - } - - iPlay50SERelease.initWith(release) - iPlay50SERelease { - signingConfig signingConfigs.tuixin - resValue "string", "app_name", "智慧课堂" - } +// iPlay50SEDebug.initWith(debug) +// iPlay50SEDebug { +// versionNameSuffix "-debug" +// debuggable true +// signingConfig signingConfigs.tuixin +// resValue "string", "app_name", "学习课堂" +// } +// +// iPlay50SERelease.initWith(release) +// iPlay50SERelease { +// signingConfig signingConfigs.tuixin +// resValue "string", "app_name", "学习课堂" +// } debug { - resValue "string", "app_name", "教育中心" +// resValue "string", "app_name", "学习课堂" // 显示Log versionNameSuffix "-debug" minifyEnabled false @@ -106,8 +106,8 @@ android { applicationVariants.all { variant -> variant.outputs.each { output -> if (outputFile != null) { - def app_name = getResValues().get("app_name").value - def fileName = "${appName()}-${app_name}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" +// def app_name = getResValues().get("app_name").value + def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" output.outputFileName = fileName } } @@ -115,7 +115,7 @@ android { } release { - resValue "string", "app_name", "教育中心" +// resValue "string", "app_name", "学习课堂" //混淆 minifyEnabled false //Zipalign优化 @@ -129,8 +129,8 @@ android { variant.outputs.each { output -> def outputFile = "" if (outputFile != null) { - def app_name = getResValues().get("app_name").value - def fileName = "${appName()}-${app_name}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" +// def app_name = getResValues().get("app_name").value + def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk" output.outputFileName = new File(outputFile, fileName) } } @@ -144,6 +144,8 @@ dependencies { compileOnly files('libs/framework.jar') implementation project(path: ':niceimageview') implementation project(path: ':FlycoTabLayoutZ_Lib') + implementation project(path: ':verification-view') + //保持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-native:1.0.16' //验证码输入 - implementation 'com.jacktuotuo.customview:verificationcodeview:1.0.5' +// implementation 'com.jacktuotuo.customview:verificationcodeview:1.0.5' } preBuild { diff --git a/app/src/main/java/com/uiui/zyos/activity/ScreenLockActivity.java b/app/src/main/java/com/uiui/zyos/activity/ScreenLockActivity.java index 5af482c..9465dfb 100644 --- a/app/src/main/java/com/uiui/zyos/activity/ScreenLockActivity.java +++ b/app/src/main/java/com/uiui/zyos/activity/ScreenLockActivity.java @@ -1,15 +1,17 @@ package com.uiui.zyos.activity; import android.content.Context; +import android.media.AudioAttributes; +import android.media.SoundPool; import android.os.Build; import android.os.Bundle; +import android.os.Handler; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; -import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; @@ -30,29 +32,29 @@ public class ScreenLockActivity extends BaseActivity { private static final String TAG = ScreenLockActivity.class.getSimpleName(); @BindView(R.id.bt_0) - Button bt0; + TextView bt0; @BindView(R.id.bt_1) - Button bt1; + TextView bt1; @BindView(R.id.bt_2) - Button bt2; + TextView bt2; @BindView(R.id.bt_3) - Button bt3; + TextView bt3; @BindView(R.id.bt_4) - Button bt4; + TextView bt4; @BindView(R.id.bt_5) - Button bt5; + TextView bt5; @BindView(R.id.bt_6) - Button bt6; + TextView bt6; @BindView(R.id.bt_7) - Button bt7; + TextView bt7; @BindView(R.id.bt_8) - Button bt8; + TextView bt8; @BindView(R.id.bt_9) - Button bt9; + TextView bt9; @BindView(R.id.bt_del) - Button bt_del; + TextView bt_del; @BindView(R.id.bt_confirm) - Button bt_confirm; + TextView bt_confirm; @BindView(R.id.textView) TextView textView; @@ -63,10 +65,21 @@ public class ScreenLockActivity extends BaseActivity { @BindView(R.id.icv) VerificationCodeView codeView; + private SoundPool soundPool; + private int soundId; + @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); 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 @@ -88,7 +101,7 @@ public class ScreenLockActivity extends BaseActivity { codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() { @Override public void inputComplete() { - + checkPasswd(); } @Override @@ -107,24 +120,7 @@ public class ScreenLockActivity extends BaseActivity { bt_confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - String content = codeView.getInputContent(); - 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("密码错误"); - } + checkPasswd(); } }); @@ -140,6 +136,38 @@ public class ScreenLockActivity extends BaseActivity { 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 public void initData() { @@ -150,15 +178,16 @@ public class ScreenLockActivity extends BaseActivity { String oldText = codeView.getEditText().getText().toString(); Log.e(TAG, "add: " + oldText); codeView.getEditText().setText(text); + soundPool.play(soundId, 1, 1, 0, 0, 1); } private void exitDesktop() { 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)) { ApkUtils.gotoLauncher(this); } - }else { + } else { if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) { ApkUtils.gotoLauncher(this); } diff --git a/app/src/main/java/com/uiui/zyos/service/main/MainService.java b/app/src/main/java/com/uiui/zyos/service/main/MainService.java index dfb5d35..fa374ba 100644 --- a/app/src/main/java/com/uiui/zyos/service/main/MainService.java +++ b/app/src/main/java/com/uiui/zyos/service/main/MainService.java @@ -79,14 +79,14 @@ public class MainService extends BaseService implements MainSContact.MainSView, } private void startJxwLauncher() { - ComponentName cn = new ComponentName(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_CLASS_NAME); - Intent intent = new Intent(); - intent.setComponent(cn); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForegroundService(intent); - } else { - startService(intent); - } +// ComponentName cn = new ComponentName(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_CLASS_NAME); +// Intent intent = new Intent(); +// intent.setComponent(cn); +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { +// startForegroundService(intent); +// } else { +// startService(intent); +// } } private void unregisterReceiver() { diff --git a/app/src/main/res/drawable-hdpi/control_background.png b/app/src/main/res/drawable-hdpi/control_background.png new file mode 100644 index 0000000..b9b512c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/control_background.png differ diff --git a/app/src/main/res/drawable-hdpi/icon_lock.png b/app/src/main/res/drawable-hdpi/icon_lock.png new file mode 100644 index 0000000..72f6fcb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_lock.png differ diff --git a/app/src/main/res/layout-land/activity_screen_lock.xml b/app/src/main/res/layout-land/activity_screen_lock.xml index 3b46e8d..402718e 100644 --- a/app/src/main/res/layout-land/activity_screen_lock.xml +++ b/app/src/main/res/layout-land/activity_screen_lock.xml @@ -4,65 +4,76 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/float_window_color"> + android:background="@drawable/control_background"> - - + app:layout_constraintVertical_bias="0.11" /> - + app:layout_constraintBottom_toTopOf="@+id/ll_keyboard" + app:layout_constraintTop_toBottomOf="@+id/imageView5" + app:layout_constraintVertical_bias="0.347" + tools:layout_editor_absoluteX="0dp"> - + - + + + + + app:layout_constraintTop_toBottomOf="@+id/imageView5" + app:layout_constraintVertical_bias="0.796"> -