mirror of
https://github.com/home-assistant/android
synced 2024-10-02 22:34:46 +00:00
Begin migrating Wear OS components to Material 3 (#3904)
* First commit of migrating Wear OS components to Material 3 * Tweak more colors, fix some variables, use switches and bold more text * More clean up * Fix color in default chip * Clean up unused code
This commit is contained in:
parent
2641422e50
commit
d3a1f318f8
|
@ -59,6 +59,7 @@ sentry-android = "6.30.0"
|
|||
watchfaceComplicationsDataSourceKtx = "1.1.1"
|
||||
wear = "1.3.0"
|
||||
wear-compose-foundation = "1.2.0"
|
||||
wear-compose-material = "1.0.0-alpha12"
|
||||
wear-protolayout = "1.0.0"
|
||||
wear-tiles = "1.2.0"
|
||||
wear-tooling = "1.0.0-alpha01"
|
||||
|
@ -159,7 +160,7 @@ retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit
|
|||
sentry-android = { module = "io.sentry:sentry-android", version.ref = "sentry-android" }
|
||||
wear = { module = "androidx.wear:wear", version.ref = "wear" }
|
||||
wear-compose-foundation = { module = "androidx.wear.compose:compose-foundation", version.ref = "wear-compose-foundation" }
|
||||
wear-compose-material = { module = "androidx.wear.compose:compose-material", version.ref = "wear-compose-foundation" }
|
||||
wear-compose-material = { module = "androidx.wear.compose:compose-material3", version.ref = "wear-compose-material" }
|
||||
wear-compose-navigation = { module = "androidx.wear.compose:compose-navigation", version.ref = "wear-compose-foundation" }
|
||||
wear-phone-interactions = { module = "androidx.wear:wear-phone-interactions", version.ref = "wearPhoneInteractions" }
|
||||
wear-input = { module = "androidx.wear:wear-input", version.ref = "wearInput" }
|
||||
|
|
|
@ -104,6 +104,8 @@ dependencies {
|
|||
implementation(libs.compose.compiler)
|
||||
implementation(platform(libs.compose.bom))
|
||||
implementation(libs.compose.foundation)
|
||||
implementation(libs.compose.material.icons.core)
|
||||
implementation(libs.compose.material.icons.extended)
|
||||
implementation(libs.compose.uiTooling)
|
||||
implementation(libs.wear.compose.foundation)
|
||||
implementation(libs.wear.compose.material)
|
||||
|
|
|
@ -2,32 +2,33 @@ package io.homeassistant.companion.android.complications.views
|
|||
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.wear.compose.material.Button
|
||||
import androidx.wear.compose.material.ButtonDefaults
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Icon
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleChip
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material3.Button
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.compose.navigation.SwipeDismissableNavHost
|
||||
import androidx.wear.compose.navigation.composable
|
||||
import androidx.wear.compose.navigation.rememberSwipeDismissableNavController
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.common.R
|
||||
import io.homeassistant.companion.android.complications.ComplicationConfigViewModel
|
||||
import io.homeassistant.companion.android.data.SimplifiedEntity
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.getIcon
|
||||
import io.homeassistant.companion.android.util.simplifiedEntity
|
||||
import io.homeassistant.companion.android.views.ChooseEntityView
|
||||
|
@ -107,13 +108,14 @@ fun MainConfigView(
|
|||
icon = {
|
||||
Image(
|
||||
asset = iconBitmap,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
colors = ChipDefaults.secondaryChipColors(),
|
||||
label = {
|
||||
Text(
|
||||
text = stringResource(id = R.string.choose_entity)
|
||||
text = stringResource(id = R.string.choose_entity),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
secondaryLabel = {
|
||||
|
@ -134,7 +136,12 @@ fun MainConfigView(
|
|||
ToggleChip(
|
||||
checked = isChecked,
|
||||
onCheckedChange = onShowTitleClicked,
|
||||
label = { Text(stringResource(R.string.show_entity_title)) },
|
||||
label = {
|
||||
Text(
|
||||
stringResource(R.string.show_entity_title),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
Icon(
|
||||
imageVector = ToggleChipDefaults.switchIcon(isChecked),
|
||||
|
@ -142,7 +149,8 @@ fun MainConfigView(
|
|||
stringResource(R.string.enabled)
|
||||
} else {
|
||||
stringResource(R.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isChecked) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
@ -154,7 +162,12 @@ fun MainConfigView(
|
|||
ToggleChip(
|
||||
checked = isChecked,
|
||||
onCheckedChange = onShowUnitClicked,
|
||||
label = { Text(stringResource(R.string.show_unit_title)) },
|
||||
label = {
|
||||
Text(
|
||||
stringResource(R.string.show_unit_title),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
Icon(
|
||||
imageVector = ToggleChipDefaults.switchIcon(isChecked),
|
||||
|
@ -162,7 +175,8 @@ fun MainConfigView(
|
|||
stringResource(R.string.enabled)
|
||||
} else {
|
||||
stringResource(R.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isChecked) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
@ -174,13 +188,9 @@ fun MainConfigView(
|
|||
Button(
|
||||
modifier = Modifier.padding(top = 8.dp),
|
||||
onClick = { onAcceptClicked() },
|
||||
colors = ButtonDefaults.primaryButtonColors(),
|
||||
enabled = loaded && entity != null
|
||||
) {
|
||||
Image(
|
||||
CommunityMaterial.Icon.cmd_check
|
||||
)
|
||||
}
|
||||
enabled = loaded && entity != null,
|
||||
icon = { Icon(Icons.Filled.Check, stringResource(id = R.string.save)) }
|
||||
) { }
|
||||
}
|
||||
} else {
|
||||
item {
|
||||
|
|
|
@ -18,6 +18,8 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.AbsoluteRoundedCornerShape
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Mic
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -37,12 +39,13 @@ import androidx.compose.ui.unit.sp
|
|||
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
|
||||
import androidx.wear.compose.foundation.lazy.items
|
||||
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
|
||||
import androidx.wear.compose.material.Button
|
||||
import androidx.wear.compose.material.ButtonDefaults
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.LocalContentColor
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Button
|
||||
import androidx.wear.compose.material3.ButtonDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.LocalContentColor
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.compose.navigation.SwipeDismissableNavHost
|
||||
import androidx.wear.compose.navigation.composable
|
||||
import androidx.wear.compose.navigation.rememberSwipeDismissableNavController
|
||||
|
@ -170,14 +173,15 @@ fun ConversationResultView(
|
|||
val inputIsActive = inputMode == AssistViewModelBase.AssistInputMode.VOICE_ACTIVE
|
||||
if (inputIsActive) {
|
||||
KeepScreenOn()
|
||||
val transition = rememberInfiniteTransition()
|
||||
val transition = rememberInfiniteTransition(label = "conversationTransition")
|
||||
val scale by transition.animateFloat(
|
||||
initialValue = 1f,
|
||||
targetValue = 1.2f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(600, easing = LinearEasing),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
)
|
||||
),
|
||||
label = "conversationAnimationFloat"
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
@ -191,17 +195,18 @@ fun ConversationResultView(
|
|||
onClick = { onMicrophoneInput() },
|
||||
colors =
|
||||
if (inputIsActive) {
|
||||
ButtonDefaults.secondaryButtonColors(backgroundColor = Color.Transparent, contentColor = Color.Black)
|
||||
ButtonDefaults.buttonColors(containerColor = Color.Transparent, contentColor = Color.Black)
|
||||
} else {
|
||||
ButtonDefaults.secondaryButtonColors()
|
||||
ButtonDefaults.buttonColors()
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
Icons.Filled.Mic,
|
||||
contentDescription = stringResource(R.string.assist_start_listening),
|
||||
tint = LocalContentColor.current
|
||||
)
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
asset = CommunityMaterial.Icon3.cmd_microphone,
|
||||
contentDescription = stringResource(R.string.assist_start_listening),
|
||||
colorFilter = ColorFilter.tint(LocalContentColor.current)
|
||||
)
|
||||
}
|
||||
) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,13 @@ import androidx.compose.ui.platform.LocalHapticFeedback
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.wear.compose.material.InlineSlider
|
||||
import androidx.wear.compose.material.InlineSliderDefaults
|
||||
import androidx.wear.compose.material.MaterialTheme
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleButton
|
||||
import androidx.wear.compose.material.ToggleButtonDefaults
|
||||
import androidx.wear.compose.material3.ExperimentalWearMaterial3Api
|
||||
import androidx.wear.compose.material3.InlineSlider
|
||||
import androidx.wear.compose.material3.InlineSliderDefaults
|
||||
import androidx.wear.compose.material3.MaterialTheme
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
|
@ -39,7 +40,7 @@ import io.homeassistant.companion.android.common.data.integration.supportsFanSet
|
|||
import io.homeassistant.companion.android.common.data.integration.supportsLightBrightness
|
||||
import io.homeassistant.companion.android.common.data.integration.supportsLightColorTemperature
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.getColorTemperature
|
||||
import io.homeassistant.companion.android.util.onEntityClickedFeedback
|
||||
import io.homeassistant.companion.android.util.onEntityFeedback
|
||||
|
@ -81,13 +82,13 @@ fun DetailsPanelView(
|
|||
haptic
|
||||
)
|
||||
},
|
||||
colors = ToggleButtonDefaults.toggleButtonColors(checkedBackgroundColor = MaterialTheme.colors.secondary.copy(alpha = 0.2f)),
|
||||
colors = ToggleButtonDefaults.toggleButtonColors(checkedBackgroundColor = MaterialTheme.colorScheme.tertiary.copy(alpha = 0.2f)),
|
||||
modifier = Modifier.size(ToggleButtonDefaults.SmallToggleButtonSize)
|
||||
) {
|
||||
Image(
|
||||
asset = entity.getIcon(LocalContext.current),
|
||||
colorFilter = ColorFilter.tint(
|
||||
if (isChecked) MaterialTheme.colors.secondary else wearColorPalette.onSurface
|
||||
if (isChecked) MaterialTheme.colorScheme.tertiary else wearColorScheme.onSurface
|
||||
),
|
||||
contentDescription = stringResource(if (isChecked) R.string.enabled else R.string.disabled)
|
||||
)
|
||||
|
@ -95,7 +96,7 @@ fun DetailsPanelView(
|
|||
} else {
|
||||
Image(
|
||||
asset = entity.getIcon(LocalContext.current),
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -165,6 +166,7 @@ fun DetailsPanelView(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWearMaterial3Api::class)
|
||||
@Composable
|
||||
fun FanSpeedSlider(
|
||||
entity: Entity<*>,
|
||||
|
@ -216,6 +218,7 @@ fun FanSpeedSlider(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWearMaterial3Api::class)
|
||||
@Composable
|
||||
fun BrightnessSlider(
|
||||
entity: Entity<*>,
|
||||
|
@ -266,6 +269,7 @@ fun BrightnessSlider(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWearMaterial3Api::class)
|
||||
@Composable
|
||||
fun ColorTempSlider(
|
||||
attributes: Map<*, *>,
|
||||
|
|
|
@ -8,7 +8,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.wear.compose.foundation.lazy.items
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import io.homeassistant.companion.android.common.data.integration.Entity
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
|
|
|
@ -14,10 +14,10 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Icon
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleChip
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import io.homeassistant.companion.android.common.R
|
||||
|
@ -27,7 +27,7 @@ import io.homeassistant.companion.android.common.data.integration.domain
|
|||
import io.homeassistant.companion.android.common.data.integration.getIcon
|
||||
import io.homeassistant.companion.android.common.data.integration.isActive
|
||||
import io.homeassistant.companion.android.common.util.STATE_UNAVAILABLE
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.WearToggleChip
|
||||
import io.homeassistant.companion.android.util.onEntityClickedFeedback
|
||||
import io.homeassistant.companion.android.util.previewEntity1
|
||||
|
@ -60,7 +60,7 @@ fun EntityUi(
|
|||
appIcon = {
|
||||
Image(
|
||||
asset = iconBitmap,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
|
@ -95,7 +95,8 @@ fun EntityUi(
|
|||
stringResource(R.string.enabled)
|
||||
} else {
|
||||
stringResource(R.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isChecked) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
},
|
||||
colors = WearToggleChip.entityToggleChipBackgroundColors(entity, isChecked)
|
||||
|
@ -107,7 +108,7 @@ fun EntityUi(
|
|||
icon = {
|
||||
Image(
|
||||
asset = iconBitmap,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
|
|
|
@ -21,21 +21,22 @@ import androidx.compose.ui.platform.LocalConfiguration
|
|||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.CircularProgressIndicator
|
||||
import androidx.wear.compose.material.MaterialTheme
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.MaterialTheme
|
||||
import androidx.wear.compose.material3.Text
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.common.data.integration.Entity
|
||||
import io.homeassistant.companion.android.common.util.STATE_UNKNOWN
|
||||
import io.homeassistant.companion.android.home.MainViewModel
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.getIcon
|
||||
import io.homeassistant.companion.android.util.onEntityClickedFeedback
|
||||
import io.homeassistant.companion.android.views.ExpandableListHeader
|
||||
|
@ -82,14 +83,15 @@ fun MainView(
|
|||
icon = {
|
||||
Image(
|
||||
asset = getIcon(cached?.icon, favoriteEntityID.split(".")[0], context),
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
Text(
|
||||
text = cached?.friendlyName ?: favoriteEntityID,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
|
@ -154,7 +156,8 @@ fun MainView(
|
|||
Text(
|
||||
text = stringResource(commonR.string.retry),
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = onRetryLoadEntitiesClicked,
|
||||
|
@ -175,14 +178,14 @@ fun MainView(
|
|||
Text(
|
||||
text = stringResource(commonR.string.no_supported_entities),
|
||||
textAlign = TextAlign.Center,
|
||||
style = MaterialTheme.typography.title3,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
.padding(top = 32.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(commonR.string.no_supported_entities_summary),
|
||||
textAlign = TextAlign.Center,
|
||||
style = MaterialTheme.typography.body2,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
.padding(top = 8.dp)
|
||||
)
|
||||
|
@ -213,7 +216,11 @@ fun MainView(
|
|||
Chip(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
label = {
|
||||
Text(text = area.name)
|
||||
Text(
|
||||
text = area.name,
|
||||
color = Color.Black,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
onNavigationClicked(
|
||||
|
@ -226,7 +233,7 @@ fun MainView(
|
|||
) == null
|
||||
}
|
||||
},
|
||||
colors = ChipDefaults.primaryChipColors()
|
||||
colors = ChipDefaults.primaryChipColors(backgroundColor = wearColorScheme.primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +268,11 @@ fun MainView(
|
|||
).let { Image(asset = it) }
|
||||
},
|
||||
label = {
|
||||
Text(text = mainViewModel.stringForDomain(domain)!!)
|
||||
Text(
|
||||
text = mainViewModel.stringForDomain(domain)!!,
|
||||
color = Color.Black,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
onNavigationClicked(
|
||||
|
@ -272,7 +283,7 @@ fun MainView(
|
|||
domainEntitiesFilter
|
||||
)
|
||||
},
|
||||
colors = ChipDefaults.primaryChipColors()
|
||||
colors = ChipDefaults.primaryChipColors(backgroundColor = wearColorScheme.primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +348,8 @@ fun MainView(
|
|||
},
|
||||
label = {
|
||||
Text(
|
||||
text = stringResource(id = commonR.string.settings)
|
||||
text = stringResource(id = commonR.string.settings),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = onSettingsClicked,
|
||||
|
|
|
@ -3,6 +3,8 @@ package io.homeassistant.companion.android.home.views
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Alignment
|
||||
|
@ -12,18 +14,17 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.wear.compose.material.Button
|
||||
import androidx.wear.compose.material.ButtonDefaults
|
||||
import androidx.wear.compose.material.Picker
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.rememberPickerState
|
||||
import androidx.wear.compose.material3.Button
|
||||
import androidx.wear.compose.material3.ButtonDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.google.android.horologist.annotations.ExperimentalHorologistApi
|
||||
import com.google.android.horologist.composables.picker.toRotaryScrollAdapter
|
||||
import com.google.android.horologist.compose.rotaryinput.rotaryWithSnap
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.intervalToString
|
||||
import io.homeassistant.companion.android.views.ListHeader
|
||||
import io.homeassistant.companion.android.common.R as R
|
||||
|
@ -58,18 +59,17 @@ fun RefreshIntervalPickerView(
|
|||
Text(
|
||||
intervalToString(LocalContext.current, options[it]),
|
||||
fontSize = 24.sp,
|
||||
color = if (it != this.selectedOption) wearColorPalette.onBackground else wearColorPalette.primary
|
||||
color = if (it != this.selectedOption) wearColorScheme.onBackground else wearColorScheme.primary
|
||||
)
|
||||
}
|
||||
Button(
|
||||
onClick = { onSelectInterval(options[state.selectedOption]) },
|
||||
colors = ButtonDefaults.primaryButtonColors(),
|
||||
modifier = Modifier
|
||||
) {
|
||||
Image(
|
||||
CommunityMaterial.Icon.cmd_check
|
||||
)
|
||||
}
|
||||
colors = ButtonDefaults.buttonColors(),
|
||||
modifier = Modifier,
|
||||
icon = {
|
||||
Icon(Icons.Filled.Check, stringResource(id = R.string.save))
|
||||
}
|
||||
) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,13 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import io.homeassistant.companion.android.database.wear.CameraTile
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
|
@ -39,7 +40,10 @@ fun SelectCameraTileView(
|
|||
Chip(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
label = {
|
||||
Text(stringResource(commonR.string.camera_tile_n, index + 1))
|
||||
Text(
|
||||
stringResource(commonR.string.camera_tile_n, index + 1),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
secondaryLabel = if (tile.entityId != null) {
|
||||
{ Text(tile.entityId!!) }
|
||||
|
|
|
@ -6,19 +6,20 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.pluralStringResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Icon
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleChip
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.views.ListHeader
|
||||
import io.homeassistant.companion.android.views.ThemeLazyColumn
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
@ -41,7 +42,10 @@ fun SelectShortcutsTileView(
|
|||
checked = isShowShortcutTextEnabled,
|
||||
onCheckedChange = { onShowShortcutTextEnabled(it) },
|
||||
label = {
|
||||
Text(stringResource(commonR.string.shortcuts_tile_text_setting))
|
||||
Text(
|
||||
stringResource(commonR.string.shortcuts_tile_text_setting),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
appIcon = {
|
||||
Image(
|
||||
|
@ -51,7 +55,7 @@ fun SelectShortcutsTileView(
|
|||
} else {
|
||||
CommunityMaterial.Icon.cmd_alphabetical_off
|
||||
},
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
|
@ -61,7 +65,8 @@ fun SelectShortcutsTileView(
|
|||
stringResource(commonR.string.show)
|
||||
} else {
|
||||
stringResource(commonR.string.hide)
|
||||
}
|
||||
},
|
||||
tint = if (isShowShortcutTextEnabled) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -79,7 +84,10 @@ fun SelectShortcutsTileView(
|
|||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
label = {
|
||||
Text(stringResource(commonR.string.shortcuts_tile_n, index + 1))
|
||||
Text(
|
||||
stringResource(commonR.string.shortcuts_tile_n, index + 1),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
secondaryLabel = {
|
||||
val entityCount = shortcutTileEntitiesCountById[shortcutsTileId] ?: 0
|
||||
|
|
|
@ -11,16 +11,18 @@ import androidx.compose.runtime.CompositionLocalProvider
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.material.Icon
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleChip
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import io.homeassistant.companion.android.common.R
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.database.sensor.Sensor
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.batterySensorManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
|
@ -84,7 +86,8 @@ fun SensorUi(
|
|||
Text(
|
||||
text = stringResource(basicSensor.name),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
|
@ -94,7 +97,8 @@ fun SensorUi(
|
|||
stringResource(R.string.enabled)
|
||||
} else {
|
||||
stringResource(R.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (checked) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
@ -7,10 +7,11 @@ import androidx.compose.runtime.CompositionLocalProvider
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.sensors.SensorReceiver
|
||||
|
@ -38,7 +39,8 @@ fun SensorsView(
|
|||
colors = ChipDefaults.secondaryChipColors(),
|
||||
label = {
|
||||
Text(
|
||||
text = stringResource(manager.name)
|
||||
text = stringResource(manager.name),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = { onClickSensorManager(manager) }
|
||||
|
|
|
@ -8,7 +8,7 @@ import androidx.compose.ui.platform.LocalContext
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Text
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.common.R
|
||||
|
@ -17,7 +17,7 @@ import io.homeassistant.companion.android.common.data.integration.friendlyName
|
|||
import io.homeassistant.companion.android.common.data.integration.getIcon
|
||||
import io.homeassistant.companion.android.database.wear.CameraTile
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.tiles.CameraTile.Companion.DEFAULT_REFRESH_INTERVAL
|
||||
import io.homeassistant.companion.android.util.intervalToString
|
||||
import io.homeassistant.companion.android.views.ListHeader
|
||||
|
@ -46,7 +46,7 @@ fun SetCameraTileView(
|
|||
icon = {
|
||||
Image(
|
||||
asset = icon,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
colors = ChipDefaults.secondaryChipColors(),
|
||||
|
@ -68,7 +68,7 @@ fun SetCameraTileView(
|
|||
icon = {
|
||||
Image(
|
||||
asset = CommunityMaterial.Icon3.cmd_timer_cog,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
colors = ChipDefaults.secondaryChipColors(),
|
||||
|
|
|
@ -6,18 +6,19 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.wear.compose.foundation.lazy.items
|
||||
import androidx.wear.compose.material.Icon
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleChip
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import io.homeassistant.companion.android.common.data.integration.Entity
|
||||
import io.homeassistant.companion.android.common.data.integration.getIcon
|
||||
import io.homeassistant.companion.android.home.MainViewModel
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.views.ExpandableListHeader
|
||||
import io.homeassistant.companion.android.views.ListHeader
|
||||
import io.homeassistant.companion.android.views.ThemeLazyColumn
|
||||
|
@ -84,14 +85,15 @@ private fun FavoriteToggleChip(
|
|||
appIcon = {
|
||||
Image(
|
||||
asset = iconBitmap,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
Text(
|
||||
text = attributes["friendly_name"].toString(),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
|
@ -101,7 +103,8 @@ private fun FavoriteToggleChip(
|
|||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
stringResource(commonR.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (checked) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
@ -2,6 +2,8 @@ package io.homeassistant.companion.android.home.views
|
|||
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
@ -11,14 +13,14 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.wear.compose.material.Button
|
||||
import androidx.wear.compose.material.ButtonDefaults
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Button
|
||||
import androidx.wear.compose.material3.ButtonDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.data.SimplifiedEntity
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.util.getIcon
|
||||
|
@ -75,12 +77,11 @@ fun SetShortcutsTileView(
|
|||
Button(
|
||||
modifier = Modifier.padding(top = 16.dp),
|
||||
onClick = { onShortcutEntitySelectionChange(shortcutEntities.size) },
|
||||
colors = ButtonDefaults.primaryButtonColors()
|
||||
) {
|
||||
Image(
|
||||
CommunityMaterial.Icon3.cmd_plus_thick
|
||||
)
|
||||
}
|
||||
colors = ButtonDefaults.buttonColors(),
|
||||
icon = {
|
||||
Icon(Icons.Filled.Add, stringResource(id = commonR.string.add_shortcut))
|
||||
}
|
||||
) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,13 +8,14 @@ import androidx.compose.ui.graphics.ColorFilter
|
|||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Icon
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.ToggleChip
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material3.Icon
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.IIcon
|
||||
|
@ -22,7 +23,7 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
|
|||
import io.homeassistant.companion.android.common.BuildConfig
|
||||
import io.homeassistant.companion.android.home.MainViewModel
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.previewFavoritesList
|
||||
import io.homeassistant.companion.android.views.ListHeader
|
||||
import io.homeassistant.companion.android.views.ThemeLazyColumn
|
||||
|
@ -41,11 +42,16 @@ fun SecondarySettingsChip(
|
|||
icon = {
|
||||
Image(
|
||||
asset = icon,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
colors = ChipDefaults.secondaryChipColors(),
|
||||
label = { Text(text = label) },
|
||||
label = {
|
||||
Text(
|
||||
text = label,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
secondaryLabel = secondaryLabel?.let {
|
||||
{ Text(text = secondaryLabel) }
|
||||
},
|
||||
|
@ -101,7 +107,12 @@ fun SettingsView(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
checked = isFavoritesOnly,
|
||||
onCheckedChange = { setFavoritesOnly(it) },
|
||||
label = { Text(stringResource(commonR.string.only_favorites)) },
|
||||
label = {
|
||||
Text(
|
||||
stringResource(commonR.string.only_favorites),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
enabled = favorites.isNotEmpty(),
|
||||
toggleControl = {
|
||||
Icon(
|
||||
|
@ -110,13 +121,14 @@ fun SettingsView(
|
|||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
stringResource(commonR.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isFavoritesOnly) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
},
|
||||
appIcon = {
|
||||
Image(
|
||||
asset = CommunityMaterial.Icon2.cmd_home_heart,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -136,7 +148,10 @@ fun SettingsView(
|
|||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
},
|
||||
label = {
|
||||
Text(stringResource(commonR.string.setting_haptic_label))
|
||||
Text(
|
||||
stringResource(commonR.string.setting_haptic_label),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
appIcon = {
|
||||
Image(
|
||||
|
@ -146,17 +161,18 @@ fun SettingsView(
|
|||
} else {
|
||||
CommunityMaterial.Icon3.cmd_watch_vibrate_off
|
||||
},
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
Icon(
|
||||
imageVector = ToggleChipDefaults.checkboxIcon(isHapticEnabled),
|
||||
imageVector = ToggleChipDefaults.switchIcon(isHapticEnabled),
|
||||
contentDescription = if (isHapticEnabled) {
|
||||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
stringResource(commonR.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isHapticEnabled) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -167,7 +183,10 @@ fun SettingsView(
|
|||
checked = isToastEnabled,
|
||||
onCheckedChange = onToastEnabled,
|
||||
label = {
|
||||
Text(stringResource(commonR.string.setting_toast_label))
|
||||
Text(
|
||||
stringResource(commonR.string.setting_toast_label),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
appIcon = {
|
||||
Image(
|
||||
|
@ -177,17 +196,18 @@ fun SettingsView(
|
|||
} else {
|
||||
CommunityMaterial.Icon3.cmd_message_off
|
||||
},
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
Icon(
|
||||
imageVector = ToggleChipDefaults.checkboxIcon(isToastEnabled),
|
||||
contentDescription = if (isHapticEnabled) {
|
||||
imageVector = ToggleChipDefaults.switchIcon(isToastEnabled),
|
||||
contentDescription = if (isToastEnabled) {
|
||||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
stringResource(commonR.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isToastEnabled) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -242,22 +262,26 @@ fun SettingsView(
|
|||
checked = isAssistantAppAllowed,
|
||||
onCheckedChange = onAssistantAppAllowed,
|
||||
label = {
|
||||
Text(stringResource(commonR.string.available_as_assistant_app))
|
||||
Text(
|
||||
stringResource(commonR.string.available_as_assistant_app),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
appIcon = {
|
||||
Image(
|
||||
asset = CommunityMaterial.Icon.cmd_comment_processing_outline,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
toggleControl = {
|
||||
Icon(
|
||||
imageVector = ToggleChipDefaults.switchIcon(isAssistantAppAllowed),
|
||||
contentDescription = if (isFavoritesOnly) {
|
||||
contentDescription = if (isAssistantAppAllowed) {
|
||||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
stringResource(commonR.string.disabled)
|
||||
}
|
||||
},
|
||||
tint = if (isAssistantAppAllowed) wearColorScheme.tertiary else wearColorScheme.onSurface
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -275,7 +299,9 @@ fun SettingsView(
|
|||
},
|
||||
label = {
|
||||
Text(
|
||||
text = stringResource(id = commonR.string.logout)
|
||||
text = stringResource(id = commonR.string.logout),
|
||||
color = Color.Black,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
onClick = onClickLogout,
|
||||
|
|
|
@ -11,13 +11,13 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.common.R
|
||||
import io.homeassistant.companion.android.theme.WearAppTheme
|
||||
import io.homeassistant.companion.android.theme.wearColorPalette
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
import io.homeassistant.companion.android.util.intervalToString
|
||||
import io.homeassistant.companion.android.views.ListHeader
|
||||
import io.homeassistant.companion.android.views.ThemeLazyColumn
|
||||
|
@ -40,7 +40,7 @@ fun TemplateTileSettingsView(
|
|||
icon = {
|
||||
Image(
|
||||
asset = CommunityMaterial.Icon3.cmd_timer_cog,
|
||||
colorFilter = ColorFilter.tint(wearColorPalette.onSurface)
|
||||
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
|
||||
)
|
||||
},
|
||||
colors = ChipDefaults.secondaryChipColors(),
|
||||
|
|
|
@ -11,10 +11,10 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.wear.compose.material.Button
|
||||
import androidx.wear.compose.material.ButtonDefaults
|
||||
import androidx.wear.compose.material.MaterialTheme
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Button
|
||||
import androidx.wear.compose.material3.ButtonDefaults
|
||||
import androidx.wear.compose.material3.MaterialTheme
|
||||
import androidx.wear.compose.material3.Text
|
||||
import androidx.wear.tooling.preview.devices.WearDevices
|
||||
import io.homeassistant.companion.android.R
|
||||
import io.homeassistant.companion.android.views.ThemeLazyColumn
|
||||
|
@ -37,27 +37,39 @@ fun PhoneInstallView(
|
|||
item {
|
||||
Text(
|
||||
text = stringResource(commonR.string.install_phone_to_continue),
|
||||
style = MaterialTheme.typography.title3,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp)
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp)
|
||||
)
|
||||
}
|
||||
item {
|
||||
Button(
|
||||
onClick = onInstall,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(stringResource(commonR.string.install))
|
||||
}
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
label = {
|
||||
Text(
|
||||
stringResource(commonR.string.install),
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
item {
|
||||
Button(
|
||||
onClick = onRefresh,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = ButtonDefaults.secondaryButtonColors()
|
||||
) {
|
||||
Text(stringResource(commonR.string.refresh))
|
||||
}
|
||||
colors = ButtonDefaults.filledTonalButtonColors(),
|
||||
label = {
|
||||
Text(
|
||||
stringResource(commonR.string.refresh),
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
item {
|
||||
Button(
|
||||
|
@ -65,10 +77,15 @@ fun PhoneInstallView(
|
|||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = 16.dp),
|
||||
colors = ButtonDefaults.secondaryButtonColors()
|
||||
) {
|
||||
Text(stringResource(commonR.string.advanced))
|
||||
}
|
||||
colors = ButtonDefaults.filledTonalButtonColors(),
|
||||
label = {
|
||||
Text(
|
||||
stringResource(commonR.string.advanced),
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,46 @@
|
|||
package io.homeassistant.companion.android.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.wear.compose.material.Colors
|
||||
import androidx.wear.compose.material3.ColorScheme
|
||||
|
||||
val Blue = Color(0xFF03A9F4)
|
||||
val BlueDark = Color(0xFF0288D1)
|
||||
val Yellow = Color(0xFFF6C344)
|
||||
val Orange = Color(0xFFFF9800)
|
||||
val Red = Color(0xFFD32F2F)
|
||||
val md_theme_dark_primary = Color(0xFF03A9F4)
|
||||
val md_theme_dark_onPrimary = Color(0xFF00344F)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF004B70)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFFCAE6FF)
|
||||
val md_theme_dark_secondary = Color(0xFF96CCFF)
|
||||
val md_theme_dark_onSecondary = Color(0xFF003353)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF004A75)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFCEE5FF)
|
||||
val md_theme_dark_tertiary = Color(0xFFF6C344)
|
||||
val md_theme_dark_onTertiary = Color(0xFF3F2E00)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF5B4300)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFFFFDF9B)
|
||||
val md_theme_dark_error = Color(0xFFFFB4AB)
|
||||
val md_theme_dark_onError = Color(0xFF690005)
|
||||
val md_theme_dark_onBackground = Color(0xFFA6EEFF)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFC1C7CE)
|
||||
val md_theme_dark_outline = Color(0xFF8B9198)
|
||||
val md_theme_dark_outlineVariant = Color(0xFF41474D)
|
||||
|
||||
internal val wearColorPalette: Colors = Colors(
|
||||
primary = Blue,
|
||||
primaryVariant = BlueDark,
|
||||
secondary = Yellow,
|
||||
secondaryVariant = Orange,
|
||||
error = Red,
|
||||
onPrimary = Color.Black,
|
||||
onSecondary = Color.Black,
|
||||
onError = Color.Black
|
||||
internal val wearColorScheme: ColorScheme = ColorScheme(
|
||||
primary = md_theme_dark_primary,
|
||||
onPrimary = md_theme_dark_onPrimary,
|
||||
primaryContainer = md_theme_dark_primaryContainer,
|
||||
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
|
||||
secondary = md_theme_dark_secondary,
|
||||
onSecondary = md_theme_dark_onSecondary,
|
||||
secondaryContainer = md_theme_dark_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
|
||||
tertiary = md_theme_dark_tertiary,
|
||||
onTertiary = md_theme_dark_onTertiary,
|
||||
tertiaryContainer = md_theme_dark_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
|
||||
error = md_theme_dark_error,
|
||||
onError = md_theme_dark_onError,
|
||||
background = Color.Black,
|
||||
onBackground = md_theme_dark_onBackground,
|
||||
surface = Color.Black,
|
||||
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
|
||||
outline = md_theme_dark_outline,
|
||||
outlineVariant = md_theme_dark_outlineVariant
|
||||
)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package io.homeassistant.companion.android.theme
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.wear.compose.material.MaterialTheme
|
||||
import androidx.wear.compose.material3.MaterialTheme
|
||||
|
||||
@Composable
|
||||
fun WearAppTheme(
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
MaterialTheme(
|
||||
colors = wearColorPalette,
|
||||
colorScheme = wearColorScheme,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
|
|
@ -12,11 +12,10 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
|
|||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
import androidx.compose.ui.unit.LayoutDirection
|
||||
import androidx.wear.compose.material.ContentAlpha
|
||||
import androidx.wear.compose.material.MaterialTheme
|
||||
import androidx.wear.compose.material.ToggleChipColors
|
||||
import androidx.wear.compose.material.ToggleChipDefaults
|
||||
import androidx.wear.compose.material.contentColorFor
|
||||
import androidx.wear.compose.material3.ContentAlpha
|
||||
import androidx.wear.compose.material3.contentColorFor
|
||||
import io.homeassistant.companion.android.common.data.integration.Entity
|
||||
import io.homeassistant.companion.android.common.data.integration.EntityPosition
|
||||
import io.homeassistant.companion.android.common.data.integration.domain
|
||||
|
@ -24,6 +23,7 @@ import io.homeassistant.companion.android.common.data.integration.getCoverPositi
|
|||
import io.homeassistant.companion.android.common.data.integration.getFanSpeed
|
||||
import io.homeassistant.companion.android.common.data.integration.getLightBrightness
|
||||
import io.homeassistant.companion.android.common.data.integration.getLightColor
|
||||
import io.homeassistant.companion.android.theme.wearColorScheme
|
||||
|
||||
object WearToggleChip {
|
||||
/**
|
||||
|
@ -53,18 +53,18 @@ object WearToggleChip {
|
|||
|
||||
val contentBackgroundColor = if (hasColor) {
|
||||
val entityColor = entity.getLightColor()
|
||||
if (entityColor != null) Color(entityColor) else MaterialTheme.colors.primary
|
||||
if (entityColor != null) Color(entityColor) else wearColorScheme.primary
|
||||
} else {
|
||||
MaterialTheme.colors.primary
|
||||
wearColorScheme.primary
|
||||
}
|
||||
|
||||
return when {
|
||||
(hasPosition || hasColor) -> {
|
||||
val checkedStartBackgroundColor = contentBackgroundColor.copy(alpha = 0.5f)
|
||||
.compositeOver(MaterialTheme.colors.surface)
|
||||
val checkedEndBackgroundColor = MaterialTheme.colors.surface.copy(alpha = 0f)
|
||||
.compositeOver(MaterialTheme.colors.surface)
|
||||
val uncheckedBackgroundColor = MaterialTheme.colors.surface
|
||||
.compositeOver(wearColorScheme.outlineVariant)
|
||||
val checkedEndBackgroundColor = wearColorScheme.outlineVariant.copy(alpha = 0f)
|
||||
.compositeOver(wearColorScheme.outlineVariant)
|
||||
val uncheckedBackgroundColor = wearColorScheme.outlineVariant
|
||||
|
||||
var checkedBackgroundColors = listOf(
|
||||
checkedStartBackgroundColor,
|
||||
|
@ -175,15 +175,15 @@ object WearToggleChip {
|
|||
@Composable
|
||||
private fun defaultChipColors(
|
||||
checkedStartBackgroundColor: Color =
|
||||
MaterialTheme.colors.surface.copy(alpha = 0f)
|
||||
.compositeOver(MaterialTheme.colors.surface),
|
||||
wearColorScheme.outlineVariant.copy(alpha = 0f)
|
||||
.compositeOver(wearColorScheme.tertiary),
|
||||
checkedEndBackgroundColor: Color =
|
||||
MaterialTheme.colors.primary.copy(alpha = 0.5f)
|
||||
.compositeOver(MaterialTheme.colors.surface),
|
||||
checkedContentColor: Color = MaterialTheme.colors.onSurface,
|
||||
checkedSecondaryContentColor: Color = MaterialTheme.colors.onSurfaceVariant,
|
||||
checkedToggleControlColor: Color = MaterialTheme.colors.secondary,
|
||||
uncheckedStartBackgroundColor: Color = MaterialTheme.colors.surface,
|
||||
wearColorScheme.primary.copy(alpha = 0.5f)
|
||||
.compositeOver(wearColorScheme.tertiary),
|
||||
checkedContentColor: Color = wearColorScheme.onTertiary,
|
||||
checkedSecondaryContentColor: Color = wearColorScheme.tertiary,
|
||||
checkedToggleControlColor: Color = wearColorScheme.tertiary,
|
||||
uncheckedStartBackgroundColor: Color = wearColorScheme.outlineVariant,
|
||||
uncheckedEndBackgroundColor: Color = uncheckedStartBackgroundColor,
|
||||
uncheckedContentColor: Color = contentColorFor(checkedEndBackgroundColor),
|
||||
uncheckedSecondaryContentColor: Color = uncheckedContentColor,
|
||||
|
|
|
@ -20,7 +20,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.wear.compose.foundation.lazy.items
|
||||
import androidx.wear.compose.material.Chip
|
||||
import androidx.wear.compose.material.ChipDefaults
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.Text
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.common.data.integration.Entity
|
||||
|
|
|
@ -13,8 +13,8 @@ import androidx.compose.ui.graphics.ColorFilter
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.wear.compose.material.LocalContentColor
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.LocalContentColor
|
||||
import androidx.wear.compose.material3.Text
|
||||
import com.mikepenz.iconics.compose.Image
|
||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
|
|
@ -8,9 +8,9 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.wear.compose.material.ListHeader
|
||||
import androidx.wear.compose.material.LocalTextStyle
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material3.ListHeader
|
||||
import androidx.wear.compose.material3.LocalTextStyle
|
||||
import androidx.wear.compose.material3.Text
|
||||
import kotlin.math.floor
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
||||
|
|
Loading…
Reference in a new issue