Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace checkbox with switch in shortcuts tile name on/off #5009

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.itemsIndexed
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.CheckboxButton
import androidx.wear.compose.material3.SwitchButton
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 as commonR
import io.homeassistant.companion.android.theme.WearAppTheme
import io.homeassistant.companion.android.theme.getCheckboxButtonColors
import io.homeassistant.companion.android.theme.getFilledTonalButtonColors
import io.homeassistant.companion.android.theme.getSwitchButtonColors
import io.homeassistant.companion.android.theme.wearColorScheme
import io.homeassistant.companion.android.views.ListHeader
import io.homeassistant.companion.android.views.ThemeLazyColumn
Expand All @@ -35,7 +35,7 @@ fun SelectShortcutsTileView(
ListHeader(id = commonR.string.shortcut_tiles)
}
item {
CheckboxButton(
SwitchButton(
modifier = Modifier.fillMaxWidth(),
checked = isShowShortcutTextEnabled,
onCheckedChange = { onShowShortcutTextEnabled(it) },
Expand All @@ -51,7 +51,7 @@ fun SelectShortcutsTileView(
colorFilter = ColorFilter.tint(wearColorScheme.onSurface)
)
},
colors = getCheckboxButtonColors()
colors = getSwitchButtonColors()
)
}
item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.homeassistant.companion.android.theme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.CheckboxButtonDefaults
import androidx.wear.compose.material3.ColorScheme
import androidx.wear.compose.material3.SliderDefaults
import androidx.wear.compose.material3.SwitchButtonDefaults
Expand Down Expand Up @@ -50,14 +49,6 @@ internal val wearColorScheme: ColorScheme = ColorScheme(
outlineVariant = md_theme_dark_outlineVariant
)

@Composable
fun getCheckboxButtonColors() = CheckboxButtonDefaults.checkboxButtonColors(
checkedBoxColor = wearColorScheme.onTertiary,
checkedCheckmarkColor = wearColorScheme.tertiary,
checkedContainerColor = wearColorScheme.surfaceContainerHigh,
uncheckedContentColor = wearColorScheme.surfaceContainerLow
)

@Composable
fun getSwitchButtonColors() = SwitchButtonDefaults.switchButtonColors(
checkedThumbColor = wearColorScheme.tertiary,
Expand Down
Loading