diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-07-23 20:02:54 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-07-28 13:52:59 +0000 |
| commit | 0ece9c84aca91b62be35c8b3cd9c232404998158 (patch) | |
| tree | 87db566a9bd0c78082e9c57aa34bdf8cb80e9cf9 /android/src | |
| parent | b9e3914c3e6b47fbe26583cf700b1620f64582cd (diff) | |
| download | mullvadvpn-0ece9c84aca91b62be35c8b3cd9c232404998158.tar.xz mullvadvpn-0ece9c84aca91b62be35c8b3cd9c232404998158.zip | |
Remove obsoleted `RemainingTimeLabel`
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/RemainingTimeLabel.kt | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/RemainingTimeLabel.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/RemainingTimeLabel.kt deleted file mode 100644 index c24bf4ed48..0000000000 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/RemainingTimeLabel.kt +++ /dev/null @@ -1,47 +0,0 @@ -package net.mullvad.mullvadvpn.ui - -import android.content.Context -import android.view.View -import android.widget.TextView -import net.mullvad.mullvadvpn.R -import net.mullvad.mullvadvpn.util.TimeLeftFormatter -import org.joda.time.DateTime -import org.joda.time.Duration - -class RemainingTimeLabel(val context: Context, val view: View) { - private val resources = context.resources - private val formatter = TimeLeftFormatter(resources) - - private val expiredColor = context.getColor(R.color.red) - private val normalColor = context.getColor(R.color.white60) - - private val label = view.findViewById<TextView>(R.id.label) - - var accountExpiry: DateTime? = null - set(value) { - field = value - updateLabel() - } - - private fun updateLabel() { - val expiry = accountExpiry - - if (expiry != null) { - val remainingTime = Duration(DateTime.now(), expiry) - - if (remainingTime.isShorterThan(Duration.ZERO)) { - label.setText(R.string.out_of_time) - label.setTextColor(expiredColor) - } else { - label.setText(formatter.format(expiry, remainingTime)) - label.setTextColor(normalColor) - } - } else { - label.text = "" - } - } - - private fun getRemainingText(pluralId: Int, quantity: Int): String { - return resources.getQuantityString(pluralId, quantity, quantity) - } -} |
