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

Switch to Wear Device specific preview #3906

Merged
merged 1 commit into from
Oct 2, 2023
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
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ wear = "1.3.0"
wear-compose-foundation = "1.2.0"
wear-protolayout = "1.0.0"
wear-tiles = "1.2.0"
wear-tooling = "1.0.0-alpha01"
wearPhoneInteractions = "1.0.1"
wearInput = "1.2.0-alpha02"
webkit = "1.8.0"
Expand Down Expand Up @@ -165,6 +166,7 @@ wear-protolayout-main = { module = "androidx.wear.protolayout:protolayout", vers
wear-protolayout-material = { module = "androidx.wear.protolayout:protolayout-material", version.ref = "wear-protolayout" }
wear-remote-interactions = { module = "androidx.wear:wear-remote-interactions", version.ref = "wear-remote-interactions" }
wear-tiles = { module = "androidx.wear.tiles:tiles", version.ref = "wear-tiles" }
wear-tooling = { module = "androidx.wear:wear-tooling-preview", version.ref = "wear-tooling" }
webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" }

[bundles]
Expand Down
1 change: 1 addition & 0 deletions wear/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ dependencies {
implementation(libs.wear.compose.foundation)
implementation(libs.wear.compose.material)
implementation(libs.wear.compose.navigation)
implementation(libs.wear.tooling)

implementation(libs.bundles.horologist)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material.Button
Expand All @@ -21,6 +20,7 @@ import androidx.wear.compose.material.ToggleChipDefaults
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
Expand Down Expand Up @@ -190,7 +190,7 @@ fun MainConfigView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
fun PreviewMainConfigView() {
MainConfigView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -47,6 +46,7 @@ import androidx.wear.compose.material.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
Expand Down Expand Up @@ -274,7 +274,7 @@ fun ConversationPipelinesView(
}
}

@Preview(device = Devices.WEAR_OS_SMALL_ROUND)
@Preview(device = WearDevices.SMALL_ROUND)
@Composable
fun PreviewSpeechBubble() {
ScalingLazyColumn(horizontalAlignment = Alignment.Start) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ import androidx.compose.ui.hapticfeedback.HapticFeedback
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material.Icon
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.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
Expand Down Expand Up @@ -360,7 +359,7 @@ private fun onSliderChangedFeedback(
)
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewDetailsPaneView() {
CompositionLocalProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Devices
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.tooling.preview.devices.WearDevices
import io.homeassistant.companion.android.common.data.integration.Entity
import io.homeassistant.companion.android.theme.WearAppTheme
import io.homeassistant.companion.android.util.playPreviewEntityScene1
Expand Down Expand Up @@ -100,7 +100,7 @@ private fun PreviewEntityListView() {
)
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewEntityListScenes() {
EntityViewList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Devices
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.tooling.preview.devices.WearDevices
import com.mikepenz.iconics.compose.Image
import io.homeassistant.companion.android.common.R
import io.homeassistant.companion.android.common.data.integration.Entity
Expand Down Expand Up @@ -144,7 +144,7 @@ fun EntityUi(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewEntityUI() {
Column {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -18,6 +17,7 @@ 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.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
Expand Down Expand Up @@ -73,7 +73,7 @@ fun RefreshIntervalPickerView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewRefreshIntervalPickerView() {
CompositionLocalProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Devices
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.tooling.preview.devices.WearDevices
import io.homeassistant.companion.android.database.wear.CameraTile
import io.homeassistant.companion.android.theme.WearAppTheme
import io.homeassistant.companion.android.views.ListHeader
Expand Down Expand Up @@ -55,7 +55,7 @@ fun SelectCameraTileView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSelectCameraTileViewOne() {
SelectCameraTileView(
Expand All @@ -66,7 +66,7 @@ private fun PreviewSelectCameraTileViewOne() {
)
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSelectCameraTileViewEmpty() {
SelectCameraTileView(tiles = emptyList(), onSelectTile = {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.wear.compose.foundation.lazy.itemsIndexed
import androidx.wear.compose.material.Chip
Expand All @@ -15,6 +14,7 @@ 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.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
Expand Down Expand Up @@ -96,7 +96,7 @@ fun SelectShortcutsTileView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSelectShortcutsTileView() {
SelectShortcutsTileView(
Expand All @@ -111,7 +111,7 @@ private fun PreviewSelectShortcutsTileView() {
)
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSelectShortcutsTileEmptyView() {
SelectShortcutsTileView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material.CircularProgressIndicator
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
Expand Down Expand Up @@ -71,7 +71,7 @@ fun SensorManagerUi(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSensorManagerUI() {
CompositionLocalProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.homeassistant.companion.android.home.views

import android.Manifest
import android.annotation.SuppressLint
import android.os.Build
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
Expand All @@ -11,18 +12,19 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Devices
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.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.util.batterySensorManager
import kotlinx.coroutines.runBlocking

@SuppressLint("InlinedApi")
@Composable
fun SensorUi(
sensor: Sensor?,
Expand Down Expand Up @@ -98,7 +100,7 @@ fun SensorUi(
)
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSensorUI() {
val context = LocalContext.current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +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.tooling.preview.Devices
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.tooling.preview.devices.WearDevices
import io.homeassistant.companion.android.common.sensors.SensorManager
import io.homeassistant.companion.android.sensors.SensorReceiver
import io.homeassistant.companion.android.theme.WearAppTheme
Expand Down Expand Up @@ -55,7 +55,7 @@ fun getSensorManagers(): List<SensorManager> {
return SensorReceiver.MANAGERS.sortedBy { context.getString(it.name) }.filter { it.hasSensor(context) }
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSensorsView() {
CompositionLocalProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Devices
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.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
Expand Down Expand Up @@ -87,7 +87,7 @@ fun SetShortcutsTileView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSetTileShortcutsView() {
SetShortcutsTileView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +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.tooling.preview.Devices
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.tooling.preview.devices.WearDevices
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
Expand Down Expand Up @@ -297,7 +297,7 @@ fun SettingsView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewSettingsView() {
SettingsView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Devices
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.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
Expand Down Expand Up @@ -69,7 +69,7 @@ fun TemplateTileSettingsView(
}
}

@Preview(device = Devices.WEAR_OS_LARGE_ROUND)
@Preview(device = WearDevices.LARGE_ROUND)
@Composable
private fun PreviewTemplateTileSettingView() {
CompositionLocalProvider {
Expand Down
Loading