Change empty favorites styling
This commit is contained in:
parent
766758a09d
commit
d07f0b3049
@ -18,8 +18,8 @@ fun Banner(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
text: String,
|
text: String,
|
||||||
icon: ImageVector,
|
icon: ImageVector,
|
||||||
primaryAction: @Composable () -> Unit,
|
primaryAction: (@Composable () -> Unit)? = null,
|
||||||
secondaryAction: @Composable () -> Unit = {}
|
secondaryAction: (@Composable () -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@ -44,21 +44,23 @@ fun Banner(
|
|||||||
style = MaterialTheme.typography.labelMedium
|
style = MaterialTheme.typography.labelMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
FlowRow(
|
if (secondaryAction != null || primaryAction != null) {
|
||||||
Modifier
|
FlowRow(
|
||||||
.align(Alignment.End)
|
Modifier
|
||||||
.padding(8.dp),
|
.align(Alignment.End)
|
||||||
crossAxisSpacing = 8.dp,
|
.padding(8.dp),
|
||||||
crossAxisAlignment = FlowCrossAxisAlignment.End,
|
crossAxisSpacing = 8.dp,
|
||||||
mainAxisAlignment = MainAxisAlignment.End
|
crossAxisAlignment = FlowCrossAxisAlignment.End,
|
||||||
) {
|
mainAxisAlignment = MainAxisAlignment.End
|
||||||
Box {
|
) {
|
||||||
secondaryAction()
|
Box {
|
||||||
}
|
secondaryAction?.invoke()
|
||||||
Box(modifier = Modifier.padding(start = 8.dp)) {
|
}
|
||||||
primaryAction()
|
Box(modifier = Modifier.padding(start = 8.dp)) {
|
||||||
}
|
primaryAction?.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import androidx.compose.material.icons.rounded.Work
|
|||||||
import androidx.compose.material3.FilterChip
|
import androidx.compose.material3.FilterChip
|
||||||
import androidx.compose.material3.FloatingActionButtonDefaults
|
import androidx.compose.material3.FloatingActionButtonDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.SmallFloatingActionButton
|
import androidx.compose.material3.SmallFloatingActionButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@ -45,6 +44,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import de.mm20.launcher2.search.SavableSearchable
|
import de.mm20.launcher2.search.SavableSearchable
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
|
import de.mm20.launcher2.ui.component.Banner
|
||||||
import de.mm20.launcher2.ui.component.LauncherCard
|
import de.mm20.launcher2.ui.component.LauncherCard
|
||||||
import de.mm20.launcher2.ui.component.MissingPermissionBanner
|
import de.mm20.launcher2.ui.component.MissingPermissionBanner
|
||||||
import de.mm20.launcher2.ui.component.PartialLauncherCard
|
import de.mm20.launcher2.ui.component.PartialLauncherCard
|
||||||
@ -53,7 +53,6 @@ import de.mm20.launcher2.ui.launcher.search.calculator.CalculatorItem
|
|||||||
import de.mm20.launcher2.ui.launcher.search.common.grid.GridItem
|
import de.mm20.launcher2.ui.launcher.search.common.grid.GridItem
|
||||||
import de.mm20.launcher2.ui.launcher.search.common.list.ListItem
|
import de.mm20.launcher2.ui.launcher.search.common.list.ListItem
|
||||||
import de.mm20.launcher2.ui.launcher.search.favorites.SearchFavoritesVM
|
import de.mm20.launcher2.ui.launcher.search.favorites.SearchFavoritesVM
|
||||||
import de.mm20.launcher2.ui.launcher.search.hidden.HiddenResults
|
|
||||||
import de.mm20.launcher2.ui.launcher.search.unitconverter.UnitConverterItem
|
import de.mm20.launcher2.ui.launcher.search.unitconverter.UnitConverterItem
|
||||||
import de.mm20.launcher2.ui.launcher.search.website.WebsiteItem
|
import de.mm20.launcher2.ui.launcher.search.website.WebsiteItem
|
||||||
import de.mm20.launcher2.ui.launcher.search.wikipedia.WikipediaItem
|
import de.mm20.launcher2.ui.launcher.search.wikipedia.WikipediaItem
|
||||||
@ -121,20 +120,12 @@ fun SearchColumn(
|
|||||||
reverse = reverse,
|
reverse = reverse,
|
||||||
before = if (favorites.isEmpty()) {
|
before = if (favorites.isEmpty()) {
|
||||||
{
|
{
|
||||||
Text(
|
Banner(
|
||||||
modifier = Modifier
|
modifier = Modifier.padding(16.dp),
|
||||||
.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(
|
text = stringResource(
|
||||||
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
|
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
|
||||||
),
|
),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
icon = if (selectedTag == null) Icons.Rounded.Star else Icons.Rounded.Tag,
|
||||||
color = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else null,
|
} else null,
|
||||||
@ -191,7 +182,10 @@ fun SearchColumn(
|
|||||||
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
||||||
onClick = { showEditFavoritesDialog = true }
|
onClick = { showEditFavoritesDialog = true }
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Rounded.Edit, contentDescription = null)
|
Icon(
|
||||||
|
imageVector = Icons.Rounded.Edit,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +247,10 @@ fun SearchColumn(
|
|||||||
{
|
{
|
||||||
MissingPermissionBanner(
|
MissingPermissionBanner(
|
||||||
modifier = Modifier.padding(8.dp),
|
modifier = Modifier.padding(8.dp),
|
||||||
text = stringResource(R.string.missing_permission_appshortcuts_search, stringResource(R.string.app_name)),
|
text = stringResource(
|
||||||
|
R.string.missing_permission_appshortcuts_search,
|
||||||
|
stringResource(R.string.app_name)
|
||||||
|
),
|
||||||
onClick = { viewModel.requestAppShortcutPermission(context as AppCompatActivity) },
|
onClick = { viewModel.requestAppShortcutPermission(context as AppCompatActivity) },
|
||||||
secondaryAction = {
|
secondaryAction = {
|
||||||
OutlinedButton(onClick = {
|
OutlinedButton(onClick = {
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
|
import de.mm20.launcher2.ui.component.Banner
|
||||||
import de.mm20.launcher2.ui.launcher.modals.EditFavoritesSheet
|
import de.mm20.launcher2.ui.launcher.modals.EditFavoritesSheet
|
||||||
import de.mm20.launcher2.ui.launcher.search.common.grid.SearchResultGrid
|
import de.mm20.launcher2.ui.launcher.search.common.grid.SearchResultGrid
|
||||||
|
|
||||||
@ -45,15 +46,12 @@ fun FavoritesWidget() {
|
|||||||
if (favorites.isNotEmpty()) {
|
if (favorites.isNotEmpty()) {
|
||||||
SearchResultGrid(favorites)
|
SearchResultGrid(favorites)
|
||||||
} else {
|
} else {
|
||||||
Text(
|
Banner(
|
||||||
modifier = Modifier
|
modifier = Modifier.padding(16.dp),
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 28.dp, start = 16.dp, end = 16.dp, bottom = 16.dp),
|
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
|
if (selectedTag == null) R.string.favorites_empty else R.string.favorites_empty_tag
|
||||||
),
|
),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
icon = if (selectedTag == null) Icons.Rounded.Star else Icons.Rounded.Tag,
|
||||||
color = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (pinnedTags.isNotEmpty() || favoritesEditButton) {
|
if (pinnedTags.isNotEmpty() || favoritesEditButton) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user