android/ui: fix time formatting strings and main view states (#204)
* android: fix time display localizations and show magic dns name Updates tailscale/corp#18202 Localizations and some simplifications of the "in x time" conversion strings for node expiry. We'll also now render the magicDNS name in the list of addresses. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com> * android: move the composablestringformatter to it's own file Updates tailscale/corp#18202 This class deserves it's own file and some documentation Signed-off-by: Jonathan Nobels <jonathan@tailscale.com> * android: show selfNode as connected only when it is connected Updates tailscale/corp#18202 The selfNode connected state is now properly shown in the nodes list now that we're showing the nodes even when you're not connected to your tailnet. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com> --------- Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>pull/207/head
parent
2c694b7159
commit
4df18951a6
@ -0,0 +1,21 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package com.tailscale.ipn.ui.util
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.tailscale.ipn.R
|
||||
|
||||
|
||||
// Convenience wrapper for passing formatted strings to Composables
|
||||
class ComposableStringFormatter(@StringRes val stringRes: Int = R.string.template, private vararg val params: Any) {
|
||||
|
||||
// Convenience constructor for passing a non-formatted string directly
|
||||
constructor(string: String) : this(stringRes = R.string.template, string)
|
||||
|
||||
// Returns the fully formatted string
|
||||
@Composable
|
||||
fun getString(): String = stringResource(id = stringRes, *params)
|
||||
}
|
Loading…
Reference in New Issue