描述:

优化会员过期之后提示
This commit is contained in:
level 2025-03-25 15:58:14 +08:00
parent c7a93838b4
commit 241c70bdf8
6 changed files with 75 additions and 2 deletions

View File

@ -26,6 +26,9 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
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
@ -186,7 +189,20 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
llLine.setOnClickListener {
if (checkExpire()) {
if (isAdded) {
RxToast.info(requireActivity().resources.getString(R.string.AccountExpired))
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@setOnClickListener
}
@ -460,7 +476,20 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
private fun startClash() {
if (checkExpire()) {
if (isAdded) {
RxToast.info(resources.getString(R.string.AccountExpired))
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
}

View File

@ -0,0 +1,36 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/pay_dialog_bg"
android:gravity="center"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:gravity="center"
android:textSize="18sp"
android:textColor="@color/blue_4072FE"
android:text="@string/TimeOver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="20dp" />
<TextView
android:id="@+id/tv_pay_finish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:background="@drawable/activity_jump_bg"
android:textColor="@color/white"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingTop="@dimen/dp_10"
android:paddingRight="20dp"
android:paddingBottom="@dimen/dp_10"
android:text="@string/GORecharge"
/>
</LinearLayout>

View File

@ -336,4 +336,6 @@ Service Description\n
<string name="OnlineCustomerService">Customer Service</string>
<string name="VersionUpdate">Version Update</string>
<string name="Update">Update</string>
<string name="TimeOver">Free time has ended\nPlease recharge</string>
<string name="GORecharge">Go to recharge</string>
</resources>

View File

@ -326,4 +326,6 @@
<string name="OnlineCustomerService">在線客服</string>
<string name="VersionUpdate">版本更新</string>
<string name="Update">更新</string>
<string name="TimeOver">免費時長已結束\n請充值使用</string>
<string name="GORecharge">去充值</string>
</resources>

View File

@ -325,4 +325,6 @@
<string name="OnlineCustomerService">在線客服</string>
<string name="VersionUpdate">版本更新</string>
<string name="Update">更新</string>
<string name="TimeOver">免費時長已結束\n請充值使用</string>
<string name="GORecharge">去充值</string>
</resources>

View File

@ -344,4 +344,6 @@
<string name="OnlineCustomerService">在线客服</string>
<string name="VersionUpdate">版本更新</string>
<string name="Update">更新</string>
<string name="TimeOver">免费时长已结束\n请充值使用</string>
<string name="GORecharge">去充值</string>
</resources>