feat: display the instance uptime on initial instance selection

This commit is contained in:
Bnyro 2023-12-17 16:47:34 +01:00
parent c545d744bd
commit 1a5b74cab3
2 changed files with 6 additions and 3 deletions

View File

@ -29,13 +29,15 @@ class InstancesAdapter(
override fun onBindViewHolder(holder: InstancesViewHolder, position: Int) { override fun onBindViewHolder(holder: InstancesViewHolder, position: Int) {
val instance = instances[position] val instance = instances[position]
holder.binding.apply { holder.binding.apply {
var instanceText = "${instance.name} ${instance.locations}" var instanceText = "${instance.name} ${instance.locations}"
if (instance.cdn) instanceText += " (\uD83C\uDF10 CDN)" if (instance.cdn) instanceText += " (\uD83C\uDF10 CDN)"
if (instance.registrationDisabled) { if (instance.registrationDisabled) {
instanceText += instanceText +=
" (${root.context.getString(R.string.registration_disabled)})" " (${root.context.getString(R.string.registration_disabled)})"
} }
instanceText += ", " + root.context.getString(R.string.uptime, instance.uptimeMonth)
radioButton.text = instanceText radioButton.text = instanceText
radioButton.setOnCheckedChangeListener(null) radioButton.setOnCheckedChangeListener(null)
radioButton.isChecked = selectedInstanceIndex == position radioButton.isChecked = selectedInstanceIndex == position
radioButton.setOnCheckedChangeListener { _, isChecked -> radioButton.setOnCheckedChangeListener { _, isChecked ->

View File

@ -500,6 +500,7 @@
<string name="time_in_minutes">Time in minutes</string> <string name="time_in_minutes">Time in minutes</string>
<string name="invalid_input">Invalid input</string> <string name="invalid_input">Invalid input</string>
<string name="add_to_group">Add to group</string> <string name="add_to_group">Add to group</string>
<string name="uptime">%.2f%% uptime</string>
<!-- Notification channel strings --> <!-- Notification channel strings -->
<string name="download_channel_name">Download Service</string> <string name="download_channel_name">Download Service</string>