android/ui: DNS and other styling tweaks
Updates tailscale/corp#18202 Signed-off-by: Percy Wegmann <percy@tailscale.com>pull/286/head
parent
a0e7777958
commit
4ff2b1c216
@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
package com.tailscale.ipn.ui.util
|
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
|
|
||||||
// FeatureStateRepresentation represents the status of a feature
|
|
||||||
// in the UI, by providing a symbol, a title, and a caption.
|
|
||||||
// It is typically implemented as an enumeration.
|
|
||||||
interface FeatureStateRepresentation {
|
|
||||||
@get:DrawableRes val symbolDrawable: Int
|
|
||||||
@get:Composable val tint: Color
|
|
||||||
@get:StringRes val title: Int
|
|
||||||
@get:StringRes val caption: Int
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
package com.tailscale.ipn.ui.view
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.ListItem
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import com.tailscale.ipn.ui.util.FeatureStateRepresentation
|
|
||||||
|
|
||||||
// FeatureStateView is a Composable that displays the contents of
|
|
||||||
// a FeatureStateRepresentation.
|
|
||||||
@Composable
|
|
||||||
fun FeatureStateView(state: FeatureStateRepresentation) {
|
|
||||||
ListItem(
|
|
||||||
leadingContent = {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(state.symbolDrawable),
|
|
||||||
contentDescription = null,
|
|
||||||
tint = state.tint,
|
|
||||||
modifier = Modifier.size(36.dp))
|
|
||||||
},
|
|
||||||
headlineContent = {
|
|
||||||
Text(stringResource(state.title), style = MaterialTheme.typography.titleMedium)
|
|
||||||
},
|
|
||||||
supportingContent = { Text(stringResource(state.caption)) })
|
|
||||||
}
|
|
Loading…
Reference in New Issue