Skip to content

Commit

Permalink
Merge pull request #939 from yschimke/add_preview
Browse files Browse the repository at this point in the history
Add a preview for Watch List
  • Loading branch information
yschimke authored Oct 9, 2023
2 parents ab0baad + de2f472 commit 0c3e24a
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ import androidx.compose.ui.res.stringResource
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.items
import androidx.wear.compose.material.Scaffold
import androidx.wear.compose.material.TimeText
import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
import com.example.android.wearable.composeadvanced.R
import com.example.android.wearable.composeadvanced.data.WatchLocalDataSource
import com.example.android.wearable.composeadvanced.data.WatchModel
import com.example.android.wearable.composeadvanced.presentation.components.WatchAppChip
import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.compose.layout.ScalingLazyColumn
import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults
import com.google.android.horologist.compose.layout.ScalingLazyColumnState
import com.google.android.horologist.compose.layout.scrollAway
import com.google.android.horologist.compose.material.ToggleChip
import com.google.android.horologist.compose.material.ToggleChipToggleControl

Expand Down Expand Up @@ -88,3 +95,27 @@ fun WatchListScreen(
}
}
}

@WearPreviewDevices
@Composable
@ExperimentalHorologistApi
fun WatchListScreenPreview() {
val columnState = ScalingLazyColumnDefaults.belowTimeText().create()
Scaffold(
timeText = {
TimeText(
modifier = Modifier
.fillMaxSize()
.scrollAway(columnState)
)
}
) {
WatchListScreen(
watches = WatchLocalDataSource().watches,
columnState = columnState,
showVignette = false,
onClickVignetteToggle = {},
onClickWatch = {}
)
}
}

0 comments on commit 0c3e24a

Please sign in to comment.