Add edit buttons to search bar actions
This commit is contained in:
parent
3463b3b800
commit
1071868206
@ -1,23 +1,27 @@
|
|||||||
package de.mm20.launcher2.ui.launcher.searchbar
|
package de.mm20.launcher2.ui.launcher.searchbar
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.rounded.Edit
|
||||||
import androidx.compose.material3.AssistChip
|
import androidx.compose.material3.AssistChip
|
||||||
|
import androidx.compose.material3.FloatingActionButtonDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.SmallFloatingActionButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import de.mm20.launcher2.searchactions.actions.SearchAction
|
import de.mm20.launcher2.searchactions.actions.SearchAction
|
||||||
import de.mm20.launcher2.ui.component.SearchActionIcon
|
import de.mm20.launcher2.ui.component.SearchActionIcon
|
||||||
|
import de.mm20.launcher2.ui.settings.SettingsActivity
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchBarActions(
|
fun SearchBarActions(
|
||||||
@ -30,19 +34,23 @@ fun SearchBarActions(
|
|||||||
LazyRow(
|
LazyRow(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(48.dp)
|
.height(48.dp)
|
||||||
.padding(bottom = if (reverse) 4.dp else 12.dp, top = if (reverse) 12.dp else 4.dp),
|
.padding(bottom = if (reverse) 0.dp else 8.dp, top = if (reverse) 8.dp else 0.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
contentPadding = PaddingValues(horizontal = 8.dp)
|
contentPadding = PaddingValues(start = 8.dp, end = 4.dp)
|
||||||
) {
|
) {
|
||||||
items(actions) {
|
items(actions) {
|
||||||
AssistChip(
|
AssistChip(
|
||||||
modifier = Modifier.padding(horizontal = 4.dp),
|
modifier = Modifier.padding(4.dp),
|
||||||
onClick = {
|
onClick = {
|
||||||
it.start(context)
|
it.start(context)
|
||||||
},
|
},
|
||||||
label = { Text(it.label) },
|
label = { Text(it.label) },
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
SearchActionIcon(icon = it.icon, color = it.iconColor, customIcon = it.customIcon)
|
SearchActionIcon(
|
||||||
|
icon = it.icon,
|
||||||
|
color = it.iconColor,
|
||||||
|
customIcon = it.customIcon
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/*leadingIcon = {
|
/*leadingIcon = {
|
||||||
val icon = it.icon
|
val icon = it.icon
|
||||||
@ -64,6 +72,22 @@ fun SearchBarActions(
|
|||||||
}*/
|
}*/
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
item {
|
||||||
|
SmallFloatingActionButton(
|
||||||
|
modifier = Modifier.padding(start = 4.dp),
|
||||||
|
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
||||||
|
onClick = {
|
||||||
|
context.startActivity(
|
||||||
|
Intent(context, SettingsActivity::class.java).apply {
|
||||||
|
putExtra(SettingsActivity.EXTRA_ROUTE, "settings/search/searchactions")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
|
||||||
|
Icon(imageVector = Icons.Rounded.Edit, contentDescription = null)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user