appstore+contacts: preview tab chrome in screenshots
- Commit
28328e4b04c590867314638d060d2848779f6711- Author
- vayun-mathur <[email protected]>
- When
- 2026-10-25 20:16 UTC (1 month ago)
- Parents
e5de9d3
Diff
appstore/src/screenshotTest/kotlin/com/vayunmathur/appstore/ui/MetadataPreviews.kt
diff --git a/appstore/src/screenshotTest/kotlin/com/vayunmathur/appstore/ui/MetadataPreviews.kt b/appstore/src/screenshotTest/kotlin/com/vayunmathur/appstore/ui/MetadataPreviews.ktindex dabed1ce56..f1130d7bcf 100644--- a/appstore/src/screenshotTest/kotlin/com/vayunmathur/appstore/ui/MetadataPreviews.kt+++ b/appstore/src/screenshotTest/kotlin/com/vayunmathur/appstore/ui/MetadataPreviews.kt@@ -2,6 +2,7 @@ package com.vayunmathur.appstore.ui import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable+import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import com.android.tools.screenshot.PreviewTest@@ -14,10 +15,22 @@ import com.vayunmathur.appstore.util.AppDetailUiState import com.vayunmathur.appstore.util.AppSection import com.vayunmathur.appstore.util.HomeActions import com.vayunmathur.appstore.util.HomeUiState+import com.vayunmathur.appstore.util.LibraryActions+import com.vayunmathur.appstore.util.LibraryUiState import com.vayunmathur.appstore.util.SearchActions import com.vayunmathur.appstore.util.SearchUiState import com.vayunmathur.appstore.util.SectionLayout+import com.vayunmathur.appstore.util.UpdatesActions+import com.vayunmathur.appstore.util.UpdatesUiState import com.vayunmathur.library.ui.DynamicTheme+import com.vayunmathur.library.ui.IconDownload+import com.vayunmathur.library.ui.IconHome+import com.vayunmathur.library.ui.IconPackage+import com.vayunmathur.library.ui.IconProvider+import com.vayunmathur.library.ui.IconSearch+import com.vayunmathur.library.ui.PagerTab+import com.vayunmathur.library.ui.TabStyle+import com.vayunmathur.library.ui.TabbedPagerScaffold /** Phone-shaped, roughly 1080x2340 at xxhdpi — comfortably above the F-Droid minimum. */ private const val PHONE = "spec:width=411dp,height=891dp,dpi=420"@@ -64,6 +77,11 @@ private fun tile(top: Long, bottom: Long): Drawable = * The last slot goes to the "how apps are checked" page, because comparing what each * source actually guarantees is the thing that distinguishes this store from any other * F-Droid or Play client.+ *+ * Home, Search, Updates and Library render inside [ChromePreview] — the real+ * [TabbedPagerScaffold] with the app's real tabs — so the bottom bar users see is+ * in the shot. Detail and Trust are pushed routes with no tab bar on device, so+ * they render bare, exactly as shipped. Only the selected tab is literal. */ class MetadataPreviews { @@ -71,41 +89,7 @@ class MetadataPreviews { @Preview(name = "1-home", device = PHONE, group = "phone", showSystemUi = true) @Composable fun Preview1Home() {- DynamicTheme(darkTheme = true) {- HomeScreen(- state = HomeUiState(- sections = listOf(- AppSection(- id = "modern-recent",- title = "New from Modern Apps",- subtitle = "The newest builds from this repo",- apps = MODERN,- ),- AppSection(- id = "proprietary-recent",- title = "New in Proprietary",- subtitle = "The newest builds from the Play mirror",- apps = PROPRIETARY,- ),- AppSection(- id = "fdroid-recent",- title = "New on F-Droid",- subtitle = "The newest builds on F-Droid",- apps = FDROID,- layout = SectionLayout.LIST,- ),- ),- categories = listOf("Security", "Internet", "Multimedia", "Writing"),- updateCount = 3,- installedPackages = setOf(- "com.vayunmathur.calculator",- "com.beemdevelopment.aegis",- ),- installedIcons = ICONS,- ),- actions = HomeActions.Noop,- )- }+ ChromePreview(selectedTab = 0) } @PreviewTest@@ -156,18 +140,7 @@ class MetadataPreviews { @Preview(name = "3-search", device = PHONE, group = "phone", showSystemUi = true) @Composable fun Preview3Search() {- DynamicTheme(darkTheme = true) {- SearchScreen(- state = SearchUiState(- query = "password",- results = SEARCH_HITS,- hasSearched = true,- installedPackages = setOf("com.beemdevelopment.aegis"),- installedIcons = ICONS,- ),- actions = SearchActions.Noop,- )- }+ ChromePreview(selectedTab = 1) } @PreviewTest@@ -184,6 +157,128 @@ class MetadataPreviews { ) } }++ @PreviewTest+ @Preview(name = "5-updates", device = PHONE, group = "phone", showSystemUi = true)+ @Composable+ fun Preview5Updates() {+ ChromePreview(selectedTab = 2)+ }++ @PreviewTest+ @Preview(name = "6-library", device = PHONE, group = "phone", showSystemUi = true)+ @Composable+ fun Preview6Library() {+ ChromePreview(selectedTab = 3)+ }+}++@Composable+private fun HomeContent() {+ HomeScreen(+ state = HomeUiState(+ sections = listOf(+ AppSection(+ id = "modern-recent",+ title = "New from Modern Apps",+ subtitle = "The newest builds from this repo",+ apps = MODERN,+ ),+ AppSection(+ id = "proprietary-recent",+ title = "New in Proprietary",+ subtitle = "The newest builds from the Play mirror",+ apps = PROPRIETARY,+ ),+ AppSection(+ id = "fdroid-recent",+ title = "New on F-Droid",+ subtitle = "The newest builds on F-Droid",+ apps = FDROID,+ layout = SectionLayout.LIST,+ ),+ ),+ categories = listOf("Security", "Internet", "Multimedia", "Writing"),+ updateCount = 3,+ installedPackages = setOf(+ "com.vayunmathur.calculator",+ "com.beemdevelopment.aegis",+ ),+ installedIcons = ICONS,+ ),+ actions = HomeActions.Noop,+ )+}++@Composable+private fun SearchContent() {+ SearchScreen(+ state = SearchUiState(+ query = "password",+ results = SEARCH_HITS,+ hasSearched = true,+ installedPackages = setOf("com.beemdevelopment.aegis"),+ installedIcons = ICONS,+ ),+ actions = SearchActions.Noop,+ )+}++@Composable+private fun UpdatesContent() {+ UpdatesScreen(+ state = UpdatesUiState(+ updates = listOf(AEGIS),+ installedIcons = ICONS,+ installedInfos = mapOf(+ "com.beemdevelopment.aegis" to InstalledInfo(+ packageName = "com.beemdevelopment.aegis",+ name = "Aegis Authenticator",+ versionName = "3.4.0",+ versionCode = 340,+ ),+ ),+ lastCheckedAt = 1_785_566_534_600,+ ),+ actions = UpdatesActions.Noop,+ )+}++@Composable+private fun LibraryContent() {+ LibraryScreen(+ state = LibraryUiState(+ apps = MODERN + FDROID,+ installedIcons = ICONS,+ ),+ actions = LibraryActions.Noop,+ )+}++/**+ * The app's real tab chrome around preview screen content: the same+ * [TabbedPagerScaffold] in [TabStyle.BottomNav] with the same five tabs that+ * `AppTabs` declares — the pager starts on [selectedTab], so the bar highlights+ * the shown screen. The Sources tab needs the ViewModel, so it shows an empty+ * page (never visible — only the selected tab renders); everything else is the+ * real screen with literal state.+ */+@Composable+private fun ChromePreview(selectedTab: Int) {+ DynamicTheme(darkTheme = true) {+ val tabs = listOf(+ PagerTab("Home", { IconHome() }) { HomeContent() },+ PagerTab("Search", { IconSearch() }) { SearchContent() },+ PagerTab("Updates", { IconDownload() }) { UpdatesContent() },+ PagerTab("Library", { IconPackage() }) { LibraryContent() },+ PagerTab("Sources", { IconProvider() }) { },+ )+ TabbedPagerScaffold(+ tabs = tabs,+ pagerState = rememberPagerState(initialPage = selectedTab, pageCount = { tabs.size }),+ tabStyle = TabStyle.BottomNav,+ )+ } } /**
contacts/src/screenshotTest/kotlin/com/vayunmathur/contacts/ui/MetadataPreviews.kt
diff --git a/contacts/src/screenshotTest/kotlin/com/vayunmathur/contacts/ui/MetadataPreviews.kt b/contacts/src/screenshotTest/kotlin/com/vayunmathur/contacts/ui/MetadataPreviews.ktindex ae4cba83a5..b3fff96a39 100644--- a/contacts/src/screenshotTest/kotlin/com/vayunmathur/contacts/ui/MetadataPreviews.kt+++ b/contacts/src/screenshotTest/kotlin/com/vayunmathur/contacts/ui/MetadataPreviews.kt@@ -1,6 +1,10 @@ package com.vayunmathur.contacts.ui +import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import com.android.tools.screenshot.PreviewTest import com.vayunmathur.contacts.data.Address@@ -26,6 +30,12 @@ import com.vayunmathur.contacts.util.ContactsActions import com.vayunmathur.contacts.util.GroupWithContacts import com.vayunmathur.contacts.util.GroupsUiState import com.vayunmathur.library.ui.DynamicTheme+import com.vayunmathur.library.ui.IconGroup+import com.vayunmathur.library.ui.IconPerson+import com.vayunmathur.library.ui.IconSettings+import com.vayunmathur.library.ui.PagerTab+import com.vayunmathur.library.ui.TabStyle+import com.vayunmathur.library.ui.TabbedPagerScaffold import kotlinx.datetime.LocalDate /** Phone-shaped, roughly 1080x2340 at xxhdpi — comfortably above the F-Droid minimum. */@@ -134,15 +144,7 @@ class MetadataPreviews { @Preview(name = "1-list", device = PHONE, group = "phone", showSystemUi = true) @Composable fun Preview1List() {- DynamicTheme(darkTheme = true) {- ContactListScreen(- state = ContactListUiState(- contacts = SAMPLE_CONTACTS,- groups = GROUPS,- ),- actions = ContactsActions.Noop,- )- }+ ChromePreview(selectedTab = 0) } @PreviewTest@@ -164,13 +166,50 @@ class MetadataPreviews { @Preview(name = "3-groups", device = PHONE, group = "phone", showSystemUi = true) @Composable fun Preview3Groups() {- DynamicTheme(darkTheme = true) {- GroupsScreen(- state = GroupsUiState(groups = GROUPS.map { groupRow(it) }),- actions = ContactsActions.Noop,- // Friends starts expanded, so the shot shows what a group contains.- expandGroupId = FRIENDS.id,- )- }+ ChromePreview(selectedTab = 1)+ }+}++@Composable+private fun ListContent() {+ ContactListScreen(+ state = ContactListUiState(+ contacts = SAMPLE_CONTACTS,+ groups = GROUPS,+ ),+ actions = ContactsActions.Noop,+ )+}++@Composable+private fun GroupsContent() {+ GroupsScreen(+ state = GroupsUiState(groups = GROUPS.map { groupRow(it) }),+ actions = ContactsActions.Noop,+ // Friends starts expanded, so the shot shows what a group contains.+ expandGroupId = FRIENDS.id,+ )+}++/**+ * The app's real tab chrome around preview screen content: the same+ * [TabbedPagerScaffold] with the same three tabs the activity declares. The+ * Settings tab is ViewModel-coupled with no stateless slice, so it shows an+ * empty page (never visible — only the selected tab renders); list and groups+ * are the real screens with literal state.+ */+@Composable+private fun ChromePreview(selectedTab: Int) {+ DynamicTheme(darkTheme = true) {+ val tabs = listOf(+ PagerTab("Contacts", { IconPerson() }) { ListContent() },+ PagerTab("Groups", { IconGroup() }) { GroupsContent() },+ PagerTab("Settings", { IconSettings() }) { Box(Modifier.fillMaxSize()) },+ )+ TabbedPagerScaffold(+ tabs = tabs,+ pagerState = rememberPagerState(initialPage = selectedTab, pageCount = { tabs.size }),+ tabStyle = TabStyle.BottomNav,+ ) } }
metadata_data/photos/appstore/phone/1.png
diff --git a/metadata_data/photos/appstore/phone/1.png b/metadata_data/photos/appstore/phone/1.pngindex cacdc3ebfb..53838463ac 100644Binary files a/metadata_data/photos/appstore/phone/1.png and b/metadata_data/photos/appstore/phone/1.png differ
metadata_data/photos/appstore/phone/3.png
diff --git a/metadata_data/photos/appstore/phone/3.png b/metadata_data/photos/appstore/phone/3.pngindex 286fb69130..07479362fa 100644Binary files a/metadata_data/photos/appstore/phone/3.png and b/metadata_data/photos/appstore/phone/3.png differ
metadata_data/photos/appstore/phone/5.png
diff --git a/metadata_data/photos/appstore/phone/5.png b/metadata_data/photos/appstore/phone/5.pngnew file mode 100644index 0000000000..c81c00602eBinary files /dev/null and b/metadata_data/photos/appstore/phone/5.png differ
metadata_data/photos/appstore/phone/6.png
diff --git a/metadata_data/photos/appstore/phone/6.png b/metadata_data/photos/appstore/phone/6.pngnew file mode 100644index 0000000000..9d0d2c67f5Binary files /dev/null and b/metadata_data/photos/appstore/phone/6.png differ
metadata_data/photos/contacts/phone/1.png
diff --git a/metadata_data/photos/contacts/phone/1.png b/metadata_data/photos/contacts/phone/1.pngindex 0ed059976b..262da13ef3 100644Binary files a/metadata_data/photos/contacts/phone/1.png and b/metadata_data/photos/contacts/phone/1.png differ
metadata_data/photos/contacts/phone/3.png
diff --git a/metadata_data/photos/contacts/phone/3.png b/metadata_data/photos/contacts/phone/3.pngindex 6f56efd33b..521096ce2a 100644Binary files a/metadata_data/photos/contacts/phone/3.png and b/metadata_data/photos/contacts/phone/3.png differ