remove hard coded strings
TODO: Do not use regex on gplapi to extract mi android version, use actual string instead.
This commit is contained in:
@@ -21,13 +21,14 @@ package com.aurora.store.view.epoxy.views.details
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.airbnb.epoxy.ModelProp
|
||||
import com.airbnb.epoxy.ModelView
|
||||
import com.airbnb.epoxy.OnViewRecycled
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.databinding.ViewInfoBinding
|
||||
import com.aurora.store.view.epoxy.views.BaseModel
|
||||
import com.aurora.store.view.epoxy.views.BaseView
|
||||
import java.util.Locale
|
||||
|
||||
@ModelView(
|
||||
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
||||
@@ -41,16 +42,14 @@ class InfoView @JvmOverloads constructor(
|
||||
|
||||
@ModelProp(options = [ModelProp.Option.IgnoreRequireHashCode])
|
||||
fun badge(info: Map.Entry<String, String>) {
|
||||
binding.txtTitle.text = info.key
|
||||
.replace("_", " ")
|
||||
.lowercase(Locale.getDefault())
|
||||
.replaceFirstChar {
|
||||
if (it.isLowerCase()) {
|
||||
it.titlecase(Locale.getDefault())
|
||||
} else {
|
||||
it.toString()
|
||||
}
|
||||
}
|
||||
binding.txtTitle.text = when (info.key) {
|
||||
"DOWNLOAD" -> ContextCompat.getString(context, R.string.app_info_downloads)
|
||||
"UPDATED_ON" -> ContextCompat.getString(context, R.string.app_info_updated_on)
|
||||
"REQUIRES" -> ContextCompat.getString(context, R.string.app_info_min_android)
|
||||
"TARGET" -> ContextCompat.getString(context, R.string.app_info_target_android)
|
||||
else -> info.key
|
||||
}
|
||||
|
||||
binding.txtSubtitle.text = info.value
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ class DetailsMoreFragment : BaseFragment<FragmentDetailsMoreBinding>() {
|
||||
add(
|
||||
InfoViewModel_()
|
||||
.id(UUID.randomUUID().toString())
|
||||
.badge(mapOf("targets" to "API ${app.targetSdk}").entries.first())
|
||||
.badge(mapOf("TARGET" to "${app.targetSdk}").entries.first())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,6 +357,10 @@
|
||||
<string name="android_market_desc">Android Market was an online store offering software applications designed for Android devices, retired in 2017.</string>
|
||||
<string name="failed_apk_export">Failed to export APKs</string>
|
||||
<string name="no_apps_available">No apps available</string>
|
||||
<string name="app_info_downloads">"Downloads"</string>
|
||||
<string name="app_info_updated_on">"Last updated"</string>
|
||||
<string name="app_info_min_android">"Minimum Android Version"</string>
|
||||
<string name="app_info_target_android">"Target API Level"</string>
|
||||
|
||||
<!-- InstallerFragment -->
|
||||
<string name="session_installer_subtitle">Session based installer for bundled/split APKs</string>
|
||||
|
||||
Reference in New Issue
Block a user