From a063a4753ecb1a6b8f4f819c21af8c1e4fe006a9 Mon Sep 17 00:00:00 2001 From: level <1364007522@qq.com> Date: Tue, 15 Jul 2025 14:48:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E8=BF=9E=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yingmao/clash/fragment/NewAccFragment.kt | 58 +++++++++++++++++-- app/src/main/res/values-en/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + build.gradle.kts | 6 +- 6 files changed, 60 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/yingmao/clash/fragment/NewAccFragment.kt b/app/src/main/java/com/yingmao/clash/fragment/NewAccFragment.kt index ac68350..bff2794 100644 --- a/app/src/main/java/com/yingmao/clash/fragment/NewAccFragment.kt +++ b/app/src/main/java/com/yingmao/clash/fragment/NewAccFragment.kt @@ -20,6 +20,9 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity.RESULT_OK import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope +import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.customview.customView +import com.afollestad.materialdialogs.customview.getCustomView import com.cncat.vpn.common.constants.Intents import com.cncat.vpn.common.log.Log import com.cncat.vpn.core.Clash @@ -91,6 +94,8 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis var proList: MutableList? = null private val reloadLock = Semaphore(10) private val uiStore by lazy { context?.let { UiStore(it) } } + private var baseLoading: RxDialogShapeLoading? = null + override fun init( titleBarRl: RelativeLayout, backIv: ImageView, @@ -202,12 +207,12 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis } return }else{ - if(isSubbed){ + showLoading(resources.getString(R.string.Starting), requireContext()) + launch { + delay(2000) startClash() - getDelayData() - }else{ - RxToast.success(resources.getString(R.string.tooFast)) } + getDelayData() } } @@ -221,7 +226,21 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis private fun startClash() { if (checkExpire()) { if (isAdded) { - RxToast.info(resources.getString(R.string.AccountExpired)) + hideLoading() + MaterialDialog(requireContext()).show { + this.cancelable(false) + cornerRadius(res = R.dimen.dp_10) + customView( + R.layout.expired_recharge__layout, + scrollable = false, + noVerticalPadding = true, + horizontalPadding = false + ) + getCustomView().findViewById(R.id.tv_pay_finish).setOnClickListener { + goNewRecharge() + dismiss() + } + } } return } @@ -264,9 +283,16 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis stateChanged(Clash_Starting, true) context?.startClashService() accelerateViewModel.appStartupStatus() + withContext(Dispatchers.Main){ + hideLoading() + } } }else{ accelerateViewModel.appStartupStatus() + withContext(Dispatchers.Main){ + hideLoading() + } + } } catch (e: Exception) { stopUTimer() @@ -725,4 +751,26 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis requireContext().stopService(serviceIntent) } } + fun showLoading(str: String, context: Context) { + val message = if (TextUtils.isEmpty(str)) "进行中..." else str + if (baseLoading == null) { + baseLoading = RxDialogShapeLoading(context) + } + baseLoading?.setMessage(message) + if (baseLoading?.isShowing == false) { + baseLoading?.show() + } + } + + fun hideLoading() { + if (baseLoading != null && baseLoading?.isShowing == true) { + baseLoading?.cancel() + } + } + private fun goNewRecharge() { + if (activity != null) { + val newMain = activity as NewMainActivity + newMain.goBackupRechargeWeb() + } + } } \ No newline at end of file diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index b2fe188..834f5aa 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -400,4 +400,5 @@ Service Description\n Please turn off acceleration before switching sources It is detected that the current account is logged in on other devices. If it is not your own operation, please change the password immediately and log out of the unfamiliar device. The application is initializing. Please wait for 1~2 seconds and try again. + Starting \ No newline at end of file diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 68cb265..20d30b8 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -390,4 +390,5 @@ 請關閉加速後在進行源切換 檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。 應用初始化中,請等待1~2秒後重試 + 啟動中 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 9386b29..d51e5f8 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -388,4 +388,5 @@ 請關閉加速後在進行源切換 檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。 應用初始化中,請等待1~2秒後重試 + 啟動中 \ 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 d8f635c..d38a107 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -414,5 +414,6 @@ 请关闭加速后在进行源切换 检测到当前账号在其他设备登录,如非本人操作,请立即修改密码并退出陌生设备。 应用初始化中,请等待1~2秒后重试 + 启动中 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 8be0bd0..50eb23e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -119,7 +119,7 @@ subprojects { ) ) } - create("9999") { + create("2222") { isDefault = true dimension = flavorDimensionList[0] buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")") @@ -130,7 +130,7 @@ subprojects { buildConfigField("String", "applicationId", "\"com.jsq.wufu\"") buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"") buildConfigField("boolean", "is_free", "false") - buildConfigField("String", "productId", "\"9999\"") + buildConfigField("String", "productId", "\"2222\"") manifestPlaceholders( mapOf( "APP_NAME" to "@string/wf", @@ -140,7 +140,7 @@ subprojects { } } sourceSets { - getByName("9999") { + getByName("2222") { java.srcDirs("src/foss/java") } }