photos: use shared scaffolds (no raw Scaffold)
- Commit
e7354f18be9f0d60049cdebcf3de95f571a6d2c9- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-16 02:51 UTC (3 months ago)
- Parents
6715d29
Diff
photos/src/main/java/com/vayunmathur/photos/ui/EditPhotoPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/EditPhotoPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/EditPhotoPage.ktindex f20384e8d9..dcddd53b3b 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/EditPhotoPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/EditPhotoPage.kt@@ -36,6 +36,7 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.DropdownMenu import com.vayunmathur.library.ui.DropdownMenuItem import com.vayunmathur.library.ui.ExperimentalMaterial3Api@@ -43,11 +44,9 @@ import com.vayunmathur.library.ui.IconBack import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconHighlightAlt import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextField-import com.vayunmathur.library.ui.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState@@ -672,57 +671,49 @@ fun EditPhotoPage( } } - Scaffold(- topBar = {- TopAppBar(- title = { Text(stringResource(R.string.title_edit_photo), maxLines = 1) },- navigationIcon = {- IconButton(onClick = { context.finish() }) {- IconBack()- }+ AppScaffold(+ title = { Text(stringResource(R.string.title_edit_photo), maxLines = 1) },+ onNavigateBack = { context.finish() },+ actions = {+ val strokeUndo = isDrawing && inkStrokes.isNotEmpty()+ val strokeRedo = isDrawing && redoStrokes.isNotEmpty()+ IconButton(+ onClick = {+ if (strokeUndo) redoStrokes.add(inkStrokes.removeAt(inkStrokes.size - 1))+ else vm.undo() },- actions = {- val strokeUndo = isDrawing && inkStrokes.isNotEmpty()- val strokeRedo = isDrawing && redoStrokes.isNotEmpty()- IconButton(- onClick = {- if (strokeUndo) redoStrokes.add(inkStrokes.removeAt(inkStrokes.size - 1))- else vm.undo()- },- enabled = strokeUndo || canUndo,- ) { IconUndo() }- IconButton(- onClick = {- if (strokeRedo) inkStrokes.add(redoStrokes.removeAt(redoStrokes.size - 1))- else vm.redo()- },- enabled = strokeRedo || canRedo,- ) {- Text("↻", fontSize = 20.sp)- }- Box {- IconButton(onClick = { showSaveMenu = true }) { IconSave() }- DropdownMenu(expanded = showSaveMenu, onDismissRequest = { showSaveMenu = false }) {- DropdownMenuItem(- text = { Text(stringResource(R.string.action_save)) },- onClick = { showSaveMenu = false; doSave(false) },- )- DropdownMenuItem(- text = { Text(stringResource(R.string.action_save_as_copy)) },- onClick = { showSaveMenu = false; doSave(true, com.vayunmathur.photos.util.ExportFormat.Jpeg) },- )- DropdownMenuItem(- text = { Text(stringResource(R.string.export_as_png)) },- onClick = { showSaveMenu = false; doSave(true, com.vayunmathur.photos.util.ExportFormat.Png) },- )- DropdownMenuItem(- text = { Text(stringResource(R.string.export_as_webp)) },- onClick = { showSaveMenu = false; doSave(true, com.vayunmathur.photos.util.ExportFormat.Webp) },- )- }- }+ enabled = strokeUndo || canUndo,+ ) { IconUndo() }+ IconButton(+ onClick = {+ if (strokeRedo) inkStrokes.add(redoStrokes.removeAt(redoStrokes.size - 1))+ else vm.redo() },- )+ enabled = strokeRedo || canRedo,+ ) {+ Text("↻", fontSize = 20.sp)+ }+ Box {+ IconButton(onClick = { showSaveMenu = true }) { IconSave() }+ DropdownMenu(expanded = showSaveMenu, onDismissRequest = { showSaveMenu = false }) {+ DropdownMenuItem(+ text = { Text(stringResource(R.string.action_save)) },+ onClick = { showSaveMenu = false; doSave(false) },+ )+ DropdownMenuItem(+ text = { Text(stringResource(R.string.action_save_as_copy)) },+ onClick = { showSaveMenu = false; doSave(true, com.vayunmathur.photos.util.ExportFormat.Jpeg) },+ )+ DropdownMenuItem(+ text = { Text(stringResource(R.string.export_as_png)) },+ onClick = { showSaveMenu = false; doSave(true, com.vayunmathur.photos.util.ExportFormat.Png) },+ )+ DropdownMenuItem(+ text = { Text(stringResource(R.string.export_as_webp)) },+ onClick = { showSaveMenu = false; doSave(true, com.vayunmathur.photos.util.ExportFormat.Webp) },+ )+ }+ } }, ) { paddingValues -> val layoutDirection = LocalLayoutDirection.current
photos/src/main/java/com/vayunmathur/photos/ui/GalleryPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/GalleryPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/GalleryPage.ktindex 1e6f1338a5..15fde326b6 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/GalleryPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/GalleryPage.kt@@ -238,6 +238,10 @@ fun GalleryScreen( groupPhotosByMonth(state.searchResults, resources) } + // RAW SCAFFOLD EXCEPTION: top bar is an expandable SearchBar (with in-bar search+ // results) swapped for a selection TopAppBar, and the body is a pinch-to-zoom photo+ // grid wrapped in PullToRefreshBox. Neither AppScaffold (title/actions only) nor+ // LazyListScaffold (LazyColumn body) can represent this without changing the UI. Scaffold( topBar = { Column {
photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.ktindex 9794babee6..510e810fff 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt@@ -102,6 +102,9 @@ fun MapPage( } } + // RAW SCAFFOLD EXCEPTION: full-bleed map main-nav page with only a bottom+ // NavigationBar and no top app bar. AppScaffold always renders a top app bar (which+ // would break the immersive map) and the body is not a LazyColumn. Scaffold(bottomBar = { NavigationBar(Route.Map, backStack) }) { paddingValues -> Box(Modifier.padding(paddingValues).fillMaxSize()) { RasterMap(
photos/src/main/java/com/vayunmathur/photos/ui/PeoplePage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PeoplePage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PeoplePage.ktindex 0142e4b6da..56930825c7 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PeoplePage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PeoplePage.kt@@ -90,6 +90,9 @@ fun PeopleScreen( val showProgress = state.faceTargetCount > 0 && (state.indexing || state.faceScannedCount < state.faceTargetCount) + // RAW SCAFFOLD EXCEPTION: main-nav page with only a bottom NavigationBar and no top+ // app bar. AppScaffold always renders a top app bar (which would break the layout) and+ // the body is a Column (progress + grid), not a LazyColumn. Scaffold( bottomBar = { NavigationBar(Route.People, backStack) }, ) { padding ->
photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.ktindex 942e3bb55c..081c3ab9ae 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt@@ -209,6 +209,9 @@ fun PhotoPage(galleryViewModel: GalleryViewModel, photoMapViewModel: PhotoMapVie val pagerState = rememberPagerState(initialPage = initialIndex.coerceAtLeast(0), pageCount = { photosSorted.size }) + // RAW SCAFFOLD EXCEPTION: bar-less full-screen black media viewer (no top/bottom+ // bar); controls are a bottom overlay inside the pager. AppScaffold always renders a+ // top app bar, which would break the immersive viewer. Scaffold(containerColor = Color.Black) { paddingValues -> HorizontalPager( state = pagerState,@@ -266,6 +269,8 @@ fun PhotoPage(galleryViewModel: GalleryViewModel, photoMapViewModel: PhotoMapVie */ @Composable private fun PendingPhotoView(uri: String, context: Context) {+ // RAW SCAFFOLD EXCEPTION: bar-less full-screen black viewer for a not-yet-indexed image;+ // AppScaffold always renders a top app bar, which would break the immersive viewer. Scaffold(containerColor = Color.Black) { paddingValues -> AsyncImage( model = ImageRequest.Builder(context).data(uri.toUri()).build(),
photos/src/main/java/com/vayunmathur/photos/ui/SecureFolderPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/SecureFolderPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/SecureFolderPage.ktindex b59c0051d4..2f379ac6e1 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/SecureFolderPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/SecureFolderPage.kt@@ -18,12 +18,11 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.ExperimentalMaterial3Api+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text-import com.vayunmathur.library.ui.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState@@ -39,7 +38,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.IconCheck-import com.vayunmathur.library.ui.IconClose import com.vayunmathur.library.ui.IconUnarchive import com.vayunmathur.library.ui.BackupButtons import com.vayunmathur.library.room.SqlCipherDbCodec@@ -66,40 +64,30 @@ fun SecureFolderPage( val selectedIds by secureFolderViewModel.selectedIds.collectAsState() val isSelectionMode = selectedIds.isNotEmpty() - Scaffold(- topBar = {- TopAppBar(- title = {- if (isSelectionMode) {- Text(stringResource(R.string.items_selected, selectedIds.size))- } else {- Text(stringResource(R.string.label_secure_folder))- }- },- navigationIcon = {- if (isSelectionMode) {- IconButton(onClick = { secureFolderViewModel.clearSelection() }) {- IconClose()- }- }- },- actions = {- if (isSelectionMode) {- IconButton(onClick = {- val selectedPhotos = photos.filter { it.id in selectedIds }- secureFolderViewModel.restorePhotos(selectedPhotos)- }) {- IconUnarchive()- }- } else {- BackupButtons(- dbConfigs = listOf("vault-db" to password),- dbCodec = SqlCipherDbCodec,- extraFiles = listOf(File(context.filesDir, "secure_vault"))- )- }+ val closeSelection: (() -> Unit)? =+ if (isSelectionMode) ({ secureFolderViewModel.clearSelection() }) else null+ AppScaffold(+ title = if (isSelectionMode) {+ stringResource(R.string.items_selected, selectedIds.size)+ } else {+ stringResource(R.string.label_secure_folder)+ },+ onClose = closeSelection,+ actions = {+ if (isSelectionMode) {+ IconButton(onClick = {+ val selectedPhotos = photos.filter { it.id in selectedIds }+ secureFolderViewModel.restorePhotos(selectedPhotos)+ }) {+ IconUnarchive() }- )+ } else {+ BackupButtons(+ dbConfigs = listOf("vault-db" to password),+ dbCodec = SqlCipherDbCodec,+ extraFiles = listOf(File(context.filesDir, "secure_vault"))+ )+ } }, bottomBar = { if (!isSelectionMode) NavigationBar(Route.SecureFolder, backStack) } ) { paddingValues ->
photos/src/main/java/com/vayunmathur/photos/ui/TrashPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/TrashPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/TrashPage.ktindex 8085df621a..7596cd9c87 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/TrashPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/TrashPage.kt@@ -16,11 +16,10 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.ExperimentalMaterial3Api+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Text-import com.vayunmathur.library.ui.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState@@ -38,7 +37,6 @@ import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.core.net.toUri-import com.vayunmathur.library.ui.IconClose import com.vayunmathur.library.ui.IconDelete import com.vayunmathur.library.ui.IconUnarchive import com.vayunmathur.library.util.NavBackStack@@ -80,48 +78,40 @@ fun TrashPage(backStack: NavBackStack<Route>, galleryViewModel: GalleryViewModel derivedStateOf { groupPhotosByMonth(trashedPhotos, resources) } } - Scaffold(- topBar = {+ val closeSelection: (() -> Unit)? = if (isSelectionMode) ({ selectedIds.clear() }) else null+ AppScaffold(+ title = if (isSelectionMode) {+ stringResource(com.vayunmathur.photos.R.string.items_selected, selectedIds.size)+ } else {+ stringResource(com.vayunmathur.photos.R.string.label_trash)+ },+ onClose = closeSelection,+ actions = { if (isSelectionMode) {- TopAppBar(- title = { Text(stringResource(com.vayunmathur.photos.R.string.items_selected, selectedIds.size)) },- navigationIcon = {- IconButton(onClick = { selectedIds.clear() }) {- IconClose()- }- },- actions = {- IconButton(onClick = {- val uris = trashedPhotos.filter { it.id in selectedIds }.map { it.uri.toUri() }- val pendingIntent = MediaStore.createTrashRequest(context.contentResolver, uris, false)- trashLauncher.launch(IntentSenderRequest.Builder(pendingIntent.intentSender).build())- }) {- IconUnarchive() // Restore icon- }- IconButton(onClick = {- val uris = trashedPhotos.filter { it.id in selectedIds }.map { it.uri.toUri() }- val pendingIntent = MediaStore.createDeleteRequest(context.contentResolver, uris)- trashLauncher.launch(IntentSenderRequest.Builder(pendingIntent.intentSender).build())- }) {- IconDelete() // Permanent delete icon- }- }- )+ IconButton(onClick = {+ val uris = trashedPhotos.filter { it.id in selectedIds }.map { it.uri.toUri() }+ val pendingIntent = MediaStore.createTrashRequest(context.contentResolver, uris, false)+ trashLauncher.launch(IntentSenderRequest.Builder(pendingIntent.intentSender).build())+ }) {+ IconUnarchive() // Restore icon+ }+ IconButton(onClick = {+ val uris = trashedPhotos.filter { it.id in selectedIds }.map { it.uri.toUri() }+ val pendingIntent = MediaStore.createDeleteRequest(context.contentResolver, uris)+ trashLauncher.launch(IntentSenderRequest.Builder(pendingIntent.intentSender).build())+ }) {+ IconDelete() // Permanent delete icon+ } } else {- TopAppBar(- title = { Text(stringResource(com.vayunmathur.photos.R.string.label_trash)) },- actions = {- if (trashedPhotos.isNotEmpty()) {- IconButton(onClick = {- val uris = trashedPhotos.map { it.uri.toUri() }- val pendingIntent = MediaStore.createDeleteRequest(context.contentResolver, uris)- trashLauncher.launch(IntentSenderRequest.Builder(pendingIntent.intentSender).build())- }) {- IconDelete()- }- }+ if (trashedPhotos.isNotEmpty()) {+ IconButton(onClick = {+ val uris = trashedPhotos.map { it.uri.toUri() }+ val pendingIntent = MediaStore.createDeleteRequest(context.contentResolver, uris)+ trashLauncher.launch(IntentSenderRequest.Builder(pendingIntent.intentSender).build())+ }) {+ IconDelete() }- )+ } } }, bottomBar = { if (!isSelectionMode) NavigationBar(Route.Trash, backStack) }
photos/src/main/java/com/vayunmathur/photos/ui/VideoEditPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/VideoEditPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/VideoEditPage.ktindex e7553a4dc3..b61a95155c 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/VideoEditPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/VideoEditPage.kt@@ -53,10 +53,10 @@ import androidx.media3.common.util.UnstableApi import androidx.media3.exoplayer.ExoPlayer import androidx.media3.ui.compose.PlayerSurface import androidx.media3.ui.compose.SURFACE_TYPE_TEXTURE_VIEW+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Button import com.vayunmathur.library.ui.CircularProgressIndicator import com.vayunmathur.library.ui.FilledTonalButton-import com.vayunmathur.library.ui.IconBack import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconContentCut import com.vayunmathur.library.ui.IconCrop@@ -72,11 +72,9 @@ import com.vayunmathur.library.ui.IconVolumeUp import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.RangeSlider-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Slider import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton-import com.vayunmathur.library.ui.TopAppBar import com.vayunmathur.photos.R import com.vayunmathur.photos.data.VideoEditState import com.vayunmathur.photos.data.VideoFilterPreset@@ -122,22 +120,15 @@ fun VideoEditPage(vm: VideoEditViewModel, id: Long, uri: String?) { return } - Scaffold(- containerColor = Color.Black,- topBar = {- TopAppBar(- title = { Text(stringResource(R.string.title_edit_video), maxLines = 1) },- navigationIcon = {- IconButton(onClick = { activity?.finish() }) { IconBack() }- },- actions = {- IconButton(onClick = { showSaveDialog = true }, enabled = !exporting) { IconSave() }- },- )+ AppScaffold(+ title = { Text(stringResource(R.string.title_edit_video), maxLines = 1) },+ onNavigateBack = { activity?.finish() },+ actions = {+ IconButton(onClick = { showSaveDialog = true }, enabled = !exporting) { IconSave() } }, ) { padding -> Column(- modifier = Modifier.fillMaxSize().padding(padding),+ modifier = Modifier.fillMaxSize().background(Color.Black).padding(padding), ) { Box( modifier = Modifier.fillMaxWidth().weight(1f),
photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.ktindex b07bcbfdad..64fe8cb030 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt@@ -150,6 +150,9 @@ fun WallpaperPage( viewModel.load(uriToLoad) } + // RAW SCAFFOLD EXCEPTION: immersive black wallpaper preview with a transparent,+ // white-tinted TopAppBar (title + back). AppScaffold exposes no top-bar color slot, so+ // the transparent/white immersive bar cannot be preserved. Scaffold( containerColor = Color.Black, topBar = {