一键连更改
This commit is contained in:
parent
3bb67f05bb
commit
a063a4753e
|
|
@ -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<ClashNodebBean>? = 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<TextView>(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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -400,4 +400,5 @@ Service Description\n
|
|||
<string name="SwitchingSource">Please turn off acceleration before switching sources</string>
|
||||
<string name="LoginOut">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.</string>
|
||||
<string name="tooFast">The application is initializing. Please wait for 1~2 seconds and try again.</string>
|
||||
<string name="Starting">Starting</string>
|
||||
</resources>
|
||||
|
|
@ -390,4 +390,5 @@
|
|||
<string name="SwitchingSource">請關閉加速後在進行源切換</string>
|
||||
<string name="LoginOut">檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。</string>
|
||||
<string name="tooFast">應用初始化中,請等待1~2秒後重試</string>
|
||||
<string name="Starting">啟動中</string>
|
||||
</resources>
|
||||
|
|
@ -388,4 +388,5 @@
|
|||
<string name="SwitchingSource">請關閉加速後在進行源切換</string>
|
||||
<string name="LoginOut">檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。</string>
|
||||
<string name="tooFast">應用初始化中,請等待1~2秒後重試</string>
|
||||
<string name="Starting">啟動中</string>
|
||||
</resources>
|
||||
|
|
@ -414,5 +414,6 @@
|
|||
<string name="SwitchingSource">请关闭加速后在进行源切换</string>
|
||||
<string name="LoginOut">检测到当前账号在其他设备登录,如非本人操作,请立即修改密码并退出陌生设备。</string>
|
||||
<string name="tooFast">应用初始化中,请等待1~2秒后重试</string>
|
||||
<string name="Starting">启动中</string>
|
||||
|
||||
</resources>
|
||||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue