From 52595b25fef58bda22ec0e0f9f5f5566a5070c96 Mon Sep 17 00:00:00 2001 From: MM20 <15646950+MM2-0@users.noreply.github.com> Date: Thu, 25 Aug 2022 19:20:39 +0200 Subject: [PATCH] Fix snackbars not disappearing --- .../de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt | 3 ++- .../launcher2/ui/launcher/search/calendar/CalendarItem.kt | 7 ++----- .../launcher2/ui/launcher/search/contacts/ContactItem.kt | 7 ++----- .../de/mm20/launcher2/ui/launcher/search/files/FileItem.kt | 2 +- .../launcher2/ui/launcher/search/shortcut/ShortcutItem.kt | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt index 4037f9e6..2550fa18 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt @@ -8,6 +8,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.* import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarResult import androidx.compose.material3.Text import androidx.compose.runtime.* @@ -288,7 +289,7 @@ fun AppItem( val result = snackbarHostState.showSnackbar( message = context.getString(R.string.msg_item_hidden, app.label), actionLabel = context.getString(R.string.action_undo), - + duration = SnackbarDuration.Short, ) if(result == SnackbarResult.ActionPerformed) { viewModel.unhide() diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt index c99e1034..cc841ef3 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt @@ -9,10 +9,7 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.* -import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.SnackbarResult -import androidx.compose.material3.Text +import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -209,7 +206,7 @@ fun CalendarItem( val result = snackbarHostState.showSnackbar( message = context.getString(R.string.msg_item_hidden, calendar.label), actionLabel = context.getString(R.string.action_undo), - + duration = SnackbarDuration.Short, ) if(result == SnackbarResult.ActionPerformed) { viewModel.unhide() diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt index 70d73df0..d08331f6 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt @@ -10,10 +10,7 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.* -import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.SnackbarResult -import androidx.compose.material3.Text +import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -268,7 +265,7 @@ fun ContactItem( val result = snackbarHostState.showSnackbar( message = context.getString(R.string.msg_item_hidden, contact.label), actionLabel = context.getString(R.string.action_undo), - + duration = SnackbarDuration.Short, ) if(result == SnackbarResult.ActionPerformed) { viewModel.unhide() diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt index 7e7c6761..5cf39efe 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt @@ -251,7 +251,7 @@ fun FileItem( val result = snackbarHostState.showSnackbar( message = context.getString(R.string.msg_item_hidden, file.label), actionLabel = context.getString(R.string.action_undo), - + duration = SnackbarDuration.Short, ) if(result == SnackbarResult.ActionPerformed) { viewModel.unhide() diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt index 4897cb0b..8502aab0 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt @@ -170,7 +170,7 @@ fun AppShortcutItem( val result = snackbarHostState.showSnackbar( message = context.getString(R.string.msg_item_hidden, shortcut.label), actionLabel = context.getString(R.string.action_undo), - + duration = SnackbarDuration.Short, ) if(result == SnackbarResult.ActionPerformed) { viewModel.unhide()