Skip to content

Commit

Permalink
Replace checkbox with switch in shortcuts tile name on/off (#5009)
Browse files Browse the repository at this point in the history
* Replace checkbox with switch in shortcuts tile name on/off

* Unused import (ktlint)
  • Loading branch information
jpelgrom authored Jan 26, 2025
1 parent fe36d14 commit 4e8702f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
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

0 comments on commit 4e8702f

Please sign in to comment.