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

Provide Compose preview for Play Store listing screens #2542

Merged
merged 4 commits into from
May 23, 2022
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
Binary file modified app/src/full/play/listings/en-US/graphics/wear-screenshots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.homeassistant.companion.android.onboarding.welcome

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -26,6 +27,7 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.google.android.material.composethemeadapter.MdcTheme
import io.homeassistant.companion.android.R
import io.homeassistant.companion.android.common.R as commonR

Expand Down Expand Up @@ -98,7 +100,10 @@ fun WelcomeView(
}

@Composable
@Preview
@Preview(showSystemUi = true)
@Preview(showSystemUi = true, uiMode = UI_MODE_NIGHT_YES)
private fun PreviewWelcome() {
WelcomeView(onContinue = {})
MdcTheme {
WelcomeView(onContinue = {})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.Text
import io.homeassistant.companion.android.common.data.integration.Entity
import io.homeassistant.companion.android.theme.WearAppTheme
import io.homeassistant.companion.android.util.playPreviewEntityScene1
import io.homeassistant.companion.android.util.playPreviewEntityScene2
import io.homeassistant.companion.android.util.playPreviewEntityScene3
import io.homeassistant.companion.android.util.previewEntity1
import io.homeassistant.companion.android.util.previewEntity2
import io.homeassistant.companion.android.common.R as commonR
Expand Down Expand Up @@ -90,3 +93,17 @@ private fun PreviewEntityListView() {
isToastEnabled = false
)
}

@Preview
@Composable
private fun PreviewEntityListScenes() {
EntityViewList(
entityLists = mapOf(stringResource(commonR.string.scenes) to listOf(playPreviewEntityScene1, playPreviewEntityScene2, playPreviewEntityScene3)),
entityListsOrder = listOf(stringResource(commonR.string.scenes)),
entityListFilter = { true },
onEntityClicked = { _, _ -> },
onEntityLongClicked = { _ -> },
isHapticEnabled = false,
isToastEnabled = false
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ val previewEntityList = mapOf(
val previewFavoritesList = listOf("light.first", "scene.first")

val simplifiedEntity = SimplifiedEntity(previewEntity1.entityId, attributes["friendly_name"].toString(), attributes["icon"].toString())

val playPreviewEntityScene1 = Entity("scene.first", "on", mapOf("friendly_name" to "Cleaning mode"), calendar, calendar, mapOf())
val playPreviewEntityScene2 = Entity("scene.second", "on", mapOf("friendly_name" to "Colorful"), calendar, calendar, mapOf())
val playPreviewEntityScene3 = Entity("scene.third", "on", mapOf("friendly_name" to "Goodbye"), calendar, calendar, mapOf())