From 8cbe2d275528217f7be24554a7d576263f6513e3 Mon Sep 17 00:00:00 2001 From: level <1364007522@qq.com> Date: Tue, 27 Aug 2024 16:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=9A=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=B3=A8=E5=86=8C=E6=88=90=E5=8A=9F=E5=90=8E,?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=90=AF=E5=8A=A8=E6=97=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=BC=B9=E7=AA=97=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yingmao/clash/act/NewMainActivity.kt | 25 +++++++++++-- .../com/yingmao/clash/act/SplashActivity.kt | 5 +++ .../com/yingmao/clash/conf/BZYConstants.kt | 1 + .../main/res/layout/first_entry_layout.xml | 36 +++++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout/first_entry_layout.xml diff --git a/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt b/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt index 575a565..32a8049 100644 --- a/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt +++ b/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt @@ -10,6 +10,7 @@ import android.content.pm.PackageManager import android.net.Uri import android.os.Build import android.os.Bundle +import android.os.Handler import android.text.TextUtils import android.view.View import android.widget.ImageView @@ -44,7 +45,6 @@ import com.yingmao.clash.entity.CheckLoginRsp import com.yingmao.clash.fragment.NewAccFragment import com.yingmao.clash.fragment.mine.MineFragment import com.yingmao.clash.fragment.recharge.BackupRechargeActivity -import com.yingmao.clash.fragment.recharge.RechargeFragment import com.yingmao.clash.listener.DownLoadListener import com.yingmao.clash.net.http.HttpApi import com.yingmao.clash.net.http.HttpReqType @@ -84,7 +84,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody import java.io.File import java.text.SimpleDateFormat -import java.util.* +import java.util.Date +import java.util.UUID class NewMainActivity : BaseActivity() { @@ -220,8 +221,28 @@ class NewMainActivity : BaseActivity() { startLog() // showBindAccount() + firstEntry() } + private fun firstEntry() { + val decodeBool = + MMKV.defaultMMKV().decodeBool(BZYConstants.INITIALIZATION, true) + if ((decodeBool)) { + MaterialDialog(this).show { + cornerRadius(res = R.dimen.dp_10) + customView( + R.layout.first_entry_layout, + scrollable = false, + noVerticalPadding = true, + horizontalPadding = false + ) + getCustomView().findViewById(R.id.determine).setOnClickListener { + MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, false) + dismiss() + } + } + } + } private fun startLog() { launch(Dispatchers.IO) { diff --git a/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt b/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt index 481481f..ab1aee6 100644 --- a/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt +++ b/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt @@ -376,6 +376,11 @@ class SplashActivity : BaseActivity() { val encryPsw = AESUtil.byteArrayToHexStr( AESUtil.encrypt(BZYConstants.defaultPassword) ) + val decodeBool = + MMKV.defaultMMKV().decodeBool(BZYConstants.INITIALIZATION, false) + if (decodeBool) { + MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, true) + } splashAtyVM.login(encryName, encryPsw) } else if (code == "20062") { message?.let { diff --git a/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt b/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt index 4eb5f33..a72ef6e 100644 --- a/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt +++ b/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt @@ -102,5 +102,6 @@ class BZYConstants { const val GoSeaShareUrl = "https://reg.cannmaxllc.com/page/register.html?userId=" const val BackHomeShareUrl = "https://38.180.8.92:8080/page/register.html?userId=" // const val shareTextHost = "嗨,一个稳定好用的加速器,打开链接注册免费体验吧=> https://38.180.8.92:8080/page/register.html?userId=" + const val INITIALIZATION = "is_initialization" } } \ No newline at end of file diff --git a/app/src/main/res/layout/first_entry_layout.xml b/app/src/main/res/layout/first_entry_layout.xml new file mode 100644 index 0000000..ca9b1fa --- /dev/null +++ b/app/src/main/res/layout/first_entry_layout.xml @@ -0,0 +1,36 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 40efe07..99775ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -392,4 +392,6 @@ 验证失败,还剩%d次机会 聚合支付(推荐) 快捷支付 + 免费时长已赠送,如果出现初始化,请等待一分钟后关闭app重新打开 + 确定 \ No newline at end of file