Display message if favorites or tag is empty

This commit is contained in:
MM20 2022-09-23 23:14:51 +02:00
parent 1f0db6c03e
commit d50013e490
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
3 changed files with 35 additions and 1 deletions

View File

@ -650,6 +650,8 @@
<string name="apps_profile_main">Personal</string>
<string name="apps_profile_work">Work</string>
<string name="favorites">Favorites</string>
<string name="favorites_empty">Pinned and frequently used items will appear here</string>
<string name="favorites_empty_tag">There are no items with this tag</string>
<string name="create_app_shortcut">Create shortcut</string>
<string name="frequently_used_show_in_favorites">Show in favorites</string>
<string name="frequently_used_rows">Number of rows</string>

View File

@ -85,6 +85,25 @@ fun SearchColumn(
showLabels = showLabels,
key = "favorites",
reverse = reverse,
before = if (favorites.isEmpty()) {
{
Text(
modifier = Modifier
.fillMaxWidth()
.padding(
top = if (!reverse) 28.dp else 16.dp,
start = 16.dp,
end = 16.dp,
bottom = if (reverse) 28.dp else 16.dp,
),
text = stringResource(
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.outline
)
}
} else null,
after = {
Row(
modifier = Modifier

View File

@ -27,7 +27,20 @@ fun FavoritesWidget() {
var showEditFavoritesDialog by remember { mutableStateOf(false) }
Column {
SearchResultGrid(favorites)
if (favorites.isNotEmpty()) {
SearchResultGrid(favorites)
} else {
Text(
modifier = Modifier
.fillMaxWidth()
.padding(top = 28.dp, start = 16.dp, end = 16.dp, bottom = 16.dp),
text = stringResource(
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.outline
)
}
Row(
modifier = Modifier
.fillMaxWidth()