套餐名称和描述适配多语言

This commit is contained in:
2026-09-02 17:13:33 +08:00
parent a1814c7fd6
commit 4a37e579f4
11 changed files with 30 additions and 66 deletions

View File

@@ -30,7 +30,7 @@ android {
targetSdkVersion 35 targetSdkVersion 35
versionCode 2500 versionCode 2500
// versionName "2.5.0" // versionName "2.5.0"
versionName "2.5.0-Beta4" versionName "2.5.0-Beta5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -87,29 +87,10 @@ class ChoosePlanAdapter(
getTextView(R.id.tv_choose_plan_item_power).let { getTextView(R.id.tv_choose_plan_item_power).let {
it.visibility = if (TextUtils.isEmpty(item.description)) View.GONE it.visibility = if (TextUtils.isEmpty(item.description)) View.GONE
else { else {
// var str = getManyLanguageLimitDec(item.listTitleCode)
// if (TextUtils.isEmpty(str)) {
// for (i in 0 until item.list!!.size) {
// val packageDec = item.list!![i]
// str += "${i + 1}.${packageDec.title}"
// if (i != item.list!!.size - 1) {
// str += "\n"
// }
// }
// }
it.text = item.description it.text = item.description
View.VISIBLE View.VISIBLE
} }
} }
} }
} }
private fun getManyLanguageLimitDec(nameCode: Int): String {
return when (nameCode) {
ConstantInt.Type1 -> mContext.getString(R.string.txt_package_permission1)
ConstantInt.Type2 -> mContext.getString(R.string.txt_package_permission2)
ConstantInt.Type3 -> mContext.getString(R.string.txt_package_permission3)
else -> ""
}
}
} }

View File

@@ -25,19 +25,7 @@ class SubscriptionPlanDetailAdapter(
checkBox.setOnClickListener { checkBox.setOnClickListener {
checkBox.isChecked = !checkBox.isChecked checkBox.isChecked = !checkBox.isChecked
} }
val titleName = when (item.titleCode) { holder.setText(R.id.tv_subscribe_plan_detail_name, item.title)
ConstantInt.Type1 -> mContext.getString(R.string.txt_real_time_tracking)
ConstantInt.Type2 -> mContext.getString(R.string.txt_activity_logs)
ConstantInt.Type3 -> mContext.getString(R.string.txt_notifications_emergencies)
ConstantInt.Type4 -> mContext.getString(R.string.txt_customized_led)
5 -> mContext.getString(R.string.txt_bluetooth_radar)
6 -> mContext.getString(R.string.txt_geofencing)
7 -> mContext.getString(R.string.txt_route_records)
8 -> mContext.getString(R.string.txt_family_sharing)
9 -> mContext.getString(R.string.txt_customer_support)
else -> item.title
}
holder.setText(R.id.tv_subscribe_plan_detail_name, titleName)
checkBox.isChecked = item.status == ConstantInt.Open checkBox.isChecked = item.status == ConstantInt.Open
} }
} }

View File

@@ -128,7 +128,8 @@ interface INetworkService {
@FormUrlEncoded @FormUrlEncoded
@POST("user/login") @POST("user/login")
suspend fun login( suspend fun login(
@Field("email") email: String, @Field("password") password: String, @Field("email") email: String,
@Field("password") password: String,
@Field("languageCode") languageCode: String @Field("languageCode") languageCode: String
): BaseResponse<UserBean> ): BaseResponse<UserBean>
@@ -662,8 +663,7 @@ interface INetworkService {
*/ */
@GET("pet/bindPetList") @GET("pet/bindPetList")
suspend fun getHomeBindPetList( suspend fun getHomeBindPetList(
@Query("userId") userId: String, @Query("userId") userId: String, @Query("languageCode") languageCode: String
@Query("languageCode") languageCode: String
): BaseResponse<MutableList<PetBean>> ): BaseResponse<MutableList<PetBean>>
/** /**
@@ -1150,8 +1150,7 @@ interface INetworkService {
@FormUrlEncoded @FormUrlEncoded
@POST("pay$STRIPE_VERSION_NUMBER/savePaymentMethodInfo") @POST("pay$STRIPE_VERSION_NUMBER/savePaymentMethodInfo")
suspend fun savePaymentMethodInfo( suspend fun savePaymentMethodInfo(
@Field("userId") orderId: String, @Field("userId") orderId: String, @Field("paymentMethodID") paymentMethodID: String
@Field("paymentMethodID") paymentMethodID: String
): BaseResponse<String> ): BaseResponse<String>
/** /**
@@ -1181,14 +1180,14 @@ interface INetworkService {
* 获取套餐计划类型 * 获取套餐计划类型
*/ */
@GET("order$SUBSCRIPTIONS_V3/subscriptions/plan/types") @GET("order$SUBSCRIPTIONS_V3/subscriptions/plan/types")
suspend fun getPackageType(): BaseResponse<MutableList<PackageTypeBean>> suspend fun getPackageType(@Query("userId") userId: String): BaseResponse<MutableList<PackageTypeBean>>
/** /**
* 获取套餐列表 * 获取套餐列表
*/ */
@GET("order$SUBSCRIPTIONS_V3/plan/list") @GET("order$SUBSCRIPTIONS_V3/plan/list")
suspend fun getPackageList( suspend fun getPackageList(
@Query("planTypeName") planTypeName: String @Query("planTypeName") planTypeName: String, @Query("userId") userId: String
): BaseResponse<MutableList<PackageBean>> ): BaseResponse<MutableList<PackageBean>>
/** /**
@@ -1445,7 +1444,8 @@ interface INetworkService {
@FormUrlEncoded @FormUrlEncoded
@POST("user/login") @POST("user/login")
suspend fun accountPasswordLogin( suspend fun accountPasswordLogin(
@Field("phone") phone: String, @Field("password") password: String, @Field("phone") phone: String,
@Field("password") password: String,
@Field("languageCode") languageCode: String @Field("languageCode") languageCode: String
): BaseResponse<UserBean> ): BaseResponse<UserBean>

View File

@@ -1100,15 +1100,15 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
/** /**
* 获取套餐计划类型 * 获取套餐计划类型
*/ */
suspend fun getPackageType() = getResult { suspend fun getPackageType(userId: String) = getResult {
service.getPackageType() service.getPackageType(userId)
} }
/** /**
* 获取套餐列表 * 获取套餐列表
*/ */
suspend fun getPackageList(planTypeName: String) = getResult { suspend fun getPackageList(planTypeName: String, userId: String) = getResult {
service.getPackageList(planTypeName) service.getPackageList(planTypeName, userId)
} }
/** /**

View File

@@ -38,7 +38,7 @@ class DebugActivity : BaseActivity<ActivityDebugBinding>(ActivityDebugBinding::i
//宠物数据 //宠物数据
private var mPetList: MutableList<PetBean>? = null private var mPetList: MutableList<PetBean>? = null
private lateinit var mMutableList: MutableList<MenuTxtBean> private val mMutableList = mutableListOf<MenuTxtBean>()
private lateinit var mAdapter: HowWorkAdapter private lateinit var mAdapter: HowWorkAdapter
private var mCommonListDialog: CommonListDialog? = null private var mCommonListDialog: CommonListDialog? = null
private lateinit var mChangePetListDialogAdapter: ChangePetListDialogAdapter private lateinit var mChangePetListDialogAdapter: ChangePetListDialogAdapter
@@ -56,7 +56,6 @@ class DebugActivity : BaseActivity<ActivityDebugBinding>(ActivityDebugBinding::i
mPetSelectPosition = intent.getIntExtra(ConstantString.Index, 0) mPetSelectPosition = intent.getIntExtra(ConstantString.Index, 0)
setTopBarTitle("Debug") setTopBarTitle("Debug")
mMutableList = mutableListOf()
mAdapter = HowWorkAdapter(mContext, mMutableList) mAdapter = HowWorkAdapter(mContext, mMutableList)
ViewUtil.instance.setRecyclerViewVerticalLinearLayout( ViewUtil.instance.setRecyclerViewVerticalLinearLayout(
@@ -119,7 +118,8 @@ class DebugActivity : BaseActivity<ActivityDebugBinding>(ActivityDebugBinding::i
private fun setPetData() { private fun setPetData() {
val pet = mPetList!![mPetSelectPosition] val pet = mPetList!![mPetSelectPosition]
mViewBinding.debugPetName.text = pet.petName mViewBinding.debugPetName.text = pet.petName
ViewUtil.instance.setPetTypeHead(mContext, ViewUtil.instance.setPetTypeHead(
mContext,
mViewBinding.debugPetHead.appHeadImage, pet.imgurl, pet.petType mViewBinding.debugPetHead.appHeadImage, pet.imgurl, pet.petType
) )
@@ -152,10 +152,10 @@ class DebugActivity : BaseActivity<ActivityDebugBinding>(ActivityDebugBinding::i
val convertLatLon = val convertLatLon =
LonAndLatUtil.convertFromWGS84ToGCJ02(data.latitude, data.longitude) LonAndLatUtil.convertFromWGS84ToGCJ02(data.latitude, data.longitude)
ViewUtil.instance.addMenuBean( ViewUtil.instance.addMenuBean(
mMutableList, "longitude", convertLatLon[1].toString() mMutableList, "longitude", "${data.longitude}(GPS)\n${convertLatLon[1]}"
) )
ViewUtil.instance.addMenuBean( ViewUtil.instance.addMenuBean(
mMutableList, "latitude", convertLatLon[0].toString() mMutableList, "latitude", "${data.latitude}(GPS)\n${convertLatLon[0]}"
) )
} else { } else {
ViewUtil.instance.addMenuBean( ViewUtil.instance.addMenuBean(

View File

@@ -569,8 +569,8 @@ class SureSubscriptionPlanActivity :
mealDesc = mealDesc =
mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanMoney.text.toString() + mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanPer.text.toString() mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanMoney.text.toString() + mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanPer.text.toString()
} }
// totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 2).toDouble() totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 2).toDouble()
totalAmountWithTax = 0.01 // totalAmountWithTax = 0.01
if (AppUtils.isChina()) { if (AppUtils.isChina()) {
if (null == mRechargePayOptionsCn) { if (null == mRechargePayOptionsCn) {

View File

@@ -41,14 +41,16 @@ class SubscriptionManageViewModel : ViewModel() {
fun getPackageType() { fun getPackageType() {
viewModelScope.launch { viewModelScope.launch {
val result = NetworkApi.getPackageType() val useId = MMKVUtil.getString(MMKVKey.UserId)
val result = NetworkApi.getPackageType(useId)
mPackageTypeLiveData.value = result mPackageTypeLiveData.value = result
} }
} }
fun getPackageList(planTypeName: String) { fun getPackageList(planTypeName: String) {
viewModelScope.launch { viewModelScope.launch {
val result = NetworkApi.getPackageList(planTypeName) val useId = MMKVUtil.getString(MMKVKey.UserId)
val result = NetworkApi.getPackageList(planTypeName, useId)
mPackageListLiveData.value = result mPackageListLiveData.value = result
} }
} }

View File

@@ -120,7 +120,7 @@
android:layout_alignBaseline="@id/tv_choose_plan_item_money" android:layout_alignBaseline="@id/tv_choose_plan_item_money"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_18" android:layout_marginEnd="@dimen/dp_18"
android:text="@string/txt_billed_annually" android:text="@string/app_name"
android:textColor="@color/select_color" android:textColor="@color/select_color"
android:textSize="@dimen/textSize10" /> android:textSize="@dimen/textSize10" />

View File

@@ -151,9 +151,7 @@
<string name="txt_init_device_tip">Initial setup may take %s minutes</string> <string name="txt_init_device_tip">Initial setup may take %s minutes</string>
<string name="txt_init_device_dec">1. Move outdoors with device\n2. Wait for LTE &amp; GPS connection\n3. Blue flashing = LTE &amp; GPS active</string> <string name="txt_init_device_dec">1. Move outdoors with device\n2. Wait for LTE &amp; GPS connection\n3. Blue flashing = LTE &amp; GPS active</string>
<string name="txt_init_g40_dec">1. Move outdoors with device\n2. Wait for LTE &amp; GPS connection\n3. Green flashing = LTE &amp; GPS active</string> <string name="txt_init_g40_dec">1. Move outdoors with device\n2. Wait for LTE &amp; GPS connection\n3. Green flashing = LTE &amp; GPS active</string>
<string name="txt_package_permission1">1.Flexible short-term protection\n2.Standard customer support</string>
<string name="txt_package_permission2">1.1 device replacement included\n2.Dedicated customer support\n3.Annual protection coverage</string>
<string name="txt_package_permission3">1.VIP priority support\n2.Fast replacement service (1 included)\n3.Enhanced protection\n4.Hassle-free pet protection</string>
<string name="txt_min_unit_lower">%s min</string> <string name="txt_min_unit_lower">%s min</string>
<string name="txt_duration_min_unit">%s Min</string> <string name="txt_duration_min_unit">%s Min</string>
<string name="start_txt_yes">Yes</string> <string name="start_txt_yes">Yes</string>
@@ -624,7 +622,7 @@
<string name="txt_refunded">Refunded</string> <string name="txt_refunded">Refunded</string>
<string name="txt_renewal_year2">/year on</string> <string name="txt_renewal_year2">/year on</string>
<string name="txt_renewal_month2">/month on</string> <string name="txt_renewal_month2">/month on</string>
<string name="txt_replace_guarantee">Replacement Guarantee</string>
<string name="txt_annual_care_text">Annual Care</string> <string name="txt_annual_care_text">Annual Care</string>
<string name="txt_annual_care_text1">Annual Care:</string> <string name="txt_annual_care_text1">Annual Care:</string>
<string name="txt_led_light_set">LED Light Settings</string> <string name="txt_led_light_set">LED Light Settings</string>
@@ -723,12 +721,7 @@
<string name="txt_add_wifi_tips">Add Wi-Fi zone to prolong care time</string> <string name="txt_add_wifi_tips">Add Wi-Fi zone to prolong care time</string>
<string name="txt_add">Add</string> <string name="txt_add">Add</string>
<string name="txt_already_min_size">Already at minimum size</string> <string name="txt_already_min_size">Already at minimum size</string>
<string name="txt_3_months_subscription">3 Months Flex Plan</string>
<string name="txt_1_year_subscription">1 Year Plus Plan</string>
<string name="txt_2_years_subscription">2 Years Protection+ Plan</string>
<string name="txt_billed_quarterly">Billed quarterly</string>
<string name="txt_billed_annually">Billed annually</string>
<string name="txt_billed_every_2_years">Billed every 2 years</string>
<string name="txt_login_with">Login with</string> <string name="txt_login_with">Login with</string>
<string name="txt_my_card">My Card</string> <string name="txt_my_card">My Card</string>
<string name="txt_edit_my_card">Edit Payment Method</string> <string name="txt_edit_my_card">Edit Payment Method</string>

View File

@@ -94,7 +94,7 @@ class AppUtils {
* 是否是国内 * 是否是国内
*/ */
fun isChina(type: String = SWITCH_PAGE_TYPE): Boolean { fun isChina(type: String = SWITCH_PAGE_TYPE): Boolean {
return true return false
if (isDebug()) { if (isDebug()) {
if (type == SWITCH_MAP_TYPE && MMKVUtil.getBoolean(MMKVKey.OnlyGoogleMap, false)) { if (type == SWITCH_MAP_TYPE && MMKVUtil.getBoolean(MMKVKey.OnlyGoogleMap, false)) {
//只启用谷歌地图 //只启用谷歌地图