Merge branch 'level'
This commit is contained in:
commit
15267249f1
|
|
@ -102,7 +102,7 @@ dependencies {
|
|||
implementation("com.airbnb.android:lottie:5.2.0")
|
||||
// https://mvnrepository.com/artifact/com.github.bumptech.glide/glide
|
||||
implementation("com.github.bumptech.glide:glide:4.13.2")
|
||||
|
||||
implementation("com.luozm.captcha:captcha:1.1.2")
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import android.text.TextUtils
|
|||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
|
|
@ -19,9 +20,11 @@ import androidx.lifecycle.lifecycleScope
|
|||
import com.yingmao.clash.view.dialog.RxDialogSureCancel
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import com.luozm.captcha.Captcha
|
||||
import com.yingmao.clash.net.http.entity.RegisterRsp
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tencent.mmkv.MMKV
|
||||
|
|
@ -158,7 +161,47 @@ class SplashActivity : BaseActivity() {
|
|||
override fun onStarted() {
|
||||
super.onStarted()
|
||||
}
|
||||
private fun graphicVerificationDialog() {
|
||||
//开启人机验证
|
||||
MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.graphic_verification_dialog_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
val captchaSimple = findViewById<Captcha>(R.id.captCha)
|
||||
captchaSimple.setBitmap(R.drawable.gv_icon)
|
||||
captchaSimple.setCaptchaListener(object : Captcha.CaptchaListener {
|
||||
override fun onAccess(time: Long): String {
|
||||
Toast.makeText(this@SplashActivity, "验证成功", Toast.LENGTH_SHORT).show()
|
||||
dismiss()
|
||||
val intent = Intent(this@SplashActivity, LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
return "验证通过,耗时" + time + "毫秒"
|
||||
}
|
||||
|
||||
override fun onFailed(failedCount: Int): String {
|
||||
Toast.makeText(this@SplashActivity, "验证失败", Toast.LENGTH_SHORT).show()
|
||||
return "验证失败,已失败" + failedCount + "次" + " 注意:超过3次验证失败即退出应用"
|
||||
}
|
||||
|
||||
override fun onMaxFailed(): String {
|
||||
Toast.makeText(
|
||||
this@SplashActivity,
|
||||
"验证超过次数,即将退出应用",
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
.show()
|
||||
finish()
|
||||
return "验证失败,即将推出登录"
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
private fun isNeedRegister() {
|
||||
if (!BuildConfig.is_free && BuildConfig.productId.isNotEmpty()) { //渠道包都自动注册登录,广州22222也是非自动注册
|
||||
rlPb.visibility = View.VISIBLE
|
||||
|
|
@ -350,9 +393,7 @@ class SplashActivity : BaseActivity() {
|
|||
// }
|
||||
// }
|
||||
MMKV.defaultMMKV().encode(MMKV_KEY_REMEMBER_USERNAME, username)
|
||||
val intent = Intent(this@SplashActivity, LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
graphicVerificationDialog()
|
||||
} else {
|
||||
MaterialDialog(this@SplashActivity).show {
|
||||
message(text = "初始化失败")
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 182 KiB |
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<size android:height="28dp"/>
|
||||
<solid android:color="#797158" />
|
||||
<corners android:radius="14dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size
|
||||
android:width="28dp"
|
||||
android:height="28dp" />
|
||||
<solid android:color="#e27a1e"/>
|
||||
<corners android:radius="14dp"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<com.luozm.captcha.Captcha
|
||||
android:id="@+id/captCha"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Loading…
Reference in New Issue