Commit 9a21e4d 1 parent c66a64a commit 9a21e4d Copy full SHA for 9a21e4d
File tree 2 files changed +14
-0
lines changed
app/src/main/java/app/grapheneos/camera/ui/composable/screen/ui
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import androidx.compose.material3.SnackbarHost
30
30
import androidx.compose.material3.SnackbarHostState
31
31
import androidx.compose.material3.Text
32
32
import androidx.compose.runtime.Composable
33
+ import androidx.compose.runtime.DisposableEffect
33
34
import androidx.compose.runtime.remember
34
35
35
36
import androidx.compose.ui.Alignment
@@ -74,6 +75,13 @@ fun ExtendedGalleryScreen(
74
75
snackBarMessage = viewModel.snackBarMessage,
75
76
)
76
77
78
+ // Clear snackbar message on dispose
79
+ DisposableEffect (Unit ) {
80
+ onDispose {
81
+ viewModel.hideSnackBar()
82
+ }
83
+ }
84
+
77
85
BackHandler {
78
86
if (viewModel.selectMode) {
79
87
viewModel.exitSelectionMode()
Original file line number Diff line number Diff line change @@ -110,6 +110,12 @@ fun GalleryScreen(
110
110
snackBarMessage = viewModel.snackBarMessage
111
111
)
112
112
113
+ DisposableEffect (Unit ) {
114
+ onDispose {
115
+ viewModel.hideSnackBar()
116
+ }
117
+ }
118
+
113
119
val backgroundColor by animateColorAsState(
114
120
label = " background_color_animation" ,
115
121
targetValue = if (viewModel.inFocusMode) Color .Black else AppColor .BackgroundColor ,
You can’t perform that action at this time.
0 commit comments