mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add server-based localization of subscription names and badge information.
This commit is contained in:
committed by
Greyson Parrelli
parent
56c502c9bf
commit
70355aa70e
@@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.subscription
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
@@ -21,20 +20,12 @@ import java.util.Locale
|
||||
*/
|
||||
data class Subscription(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val badge: Badge,
|
||||
val price: FiatMoney,
|
||||
val level: Int,
|
||||
) {
|
||||
|
||||
fun getTitle(context: Context): String {
|
||||
return when (level) {
|
||||
500 -> context.getString(R.string.SubscribeFragment__sustainer_i)
|
||||
1000 -> context.getString(R.string.SubscribeFragment__sustainer_ii)
|
||||
2000 -> context.getString(R.string.SubscribeFragment__sustainer_iii)
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun register(adapter: MappingAdapter) {
|
||||
adapter.registerFactory(Model::class.java, MappingAdapter.LayoutFactory({ ViewHolder(it) }, R.layout.subscription_preference))
|
||||
@@ -90,7 +81,7 @@ data class Subscription(
|
||||
badge.setBadge(model.subscription.badge)
|
||||
}
|
||||
|
||||
title.text = model.subscription.getTitle(context)
|
||||
title.text = model.subscription.name
|
||||
tagline.text = context.getString(R.string.Subscription__earn_a_s_badge, model.subscription.badge.name)
|
||||
|
||||
val formattedPrice = FiatMoneyUtil.format(
|
||||
|
||||
Reference in New Issue
Block a user