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

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

@@ -87,29 +87,10 @@ class ChoosePlanAdapter(
getTextView(R.id.tv_choose_plan_item_power).let {
it.visibility = if (TextUtils.isEmpty(item.description)) View.GONE
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
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.isChecked = !checkBox.isChecked
}
val titleName = when (item.titleCode) {
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)
holder.setText(R.id.tv_subscribe_plan_detail_name, item.title)
checkBox.isChecked = item.status == ConstantInt.Open
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -120,7 +120,7 @@
android:layout_alignBaseline="@id/tv_choose_plan_item_money"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_18"
android:text="@string/txt_billed_annually"
android:text="@string/app_name"
android:textColor="@color/select_color"
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_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_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_duration_min_unit">%s Min</string>
<string name="start_txt_yes">Yes</string>
@@ -624,7 +622,7 @@
<string name="txt_refunded">Refunded</string>
<string name="txt_renewal_year2">/year 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_text1">Annual Care:</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">Add</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_my_card">My Card</string>
<string name="txt_edit_my_card">Edit Payment Method</string>