Location search screen: at animations
This commit is contained in:
parent
edcf5a70bb
commit
997f7d29d0
@ -1,6 +1,8 @@
|
|||||||
package de.mm20.launcher2.ui.settings.locations
|
package de.mm20.launcher2.ui.settings.locations
|
||||||
|
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@ -65,50 +67,47 @@ fun LocationsSettingsScreen() {
|
|||||||
viewModel.setOsmLocations(it)
|
viewModel.setOsmLocations(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
for (plugin in plugins) {
|
AnimatedVisibility(plugins.isNotEmpty()) {
|
||||||
val state = plugin.state
|
Column {
|
||||||
if (state is PluginState.SetupRequired) {
|
for (plugin in plugins) {
|
||||||
Banner(
|
val state = plugin.state
|
||||||
modifier = Modifier.padding(16.dp),
|
if (state is PluginState.SetupRequired) {
|
||||||
text = state.message
|
Banner(
|
||||||
?: stringResource(id = R.string.plugin_state_setup_required),
|
modifier = Modifier.padding(16.dp),
|
||||||
icon = Icons.Rounded.ErrorOutline,
|
text = state.message
|
||||||
primaryAction = {
|
?: stringResource(id = R.string.plugin_state_setup_required),
|
||||||
TextButton(onClick = {
|
icon = Icons.Rounded.ErrorOutline,
|
||||||
try {
|
primaryAction = {
|
||||||
state.setupActivity.send()
|
TextButton(onClick = {
|
||||||
} catch (e: PendingIntent.CanceledException) {
|
try {
|
||||||
CrashReporter.logException(e)
|
state.setupActivity.send()
|
||||||
|
} catch (e: PendingIntent.CanceledException) {
|
||||||
|
CrashReporter.logException(e)
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Text(stringResource(id = R.string.plugin_action_setup))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}) {
|
)
|
||||||
Text(stringResource(id = R.string.plugin_action_setup))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
SwitchPreference(
|
||||||
|
title = plugin.plugin.label,
|
||||||
|
enabled = enabledPlugins != null && state is PluginState.Ready,
|
||||||
|
summary = (state as? PluginState.Ready)?.text
|
||||||
|
?: (state as? PluginState.SetupRequired)?.message
|
||||||
|
?: plugin.plugin.description,
|
||||||
|
value = enabledPlugins?.contains(plugin.plugin.authority) == true && state is PluginState.Ready,
|
||||||
|
onValueChanged = {
|
||||||
|
viewModel.setPluginEnabled(plugin.plugin.authority, it)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SwitchPreference(
|
|
||||||
title = plugin.plugin.label,
|
|
||||||
enabled = enabledPlugins != null && state is PluginState.Ready,
|
|
||||||
summary = (state as? PluginState.Ready)?.text
|
|
||||||
?: (state as? PluginState.SetupRequired)?.message
|
|
||||||
?: plugin.plugin.description,
|
|
||||||
value = enabledPlugins?.contains(plugin.plugin.authority) == true && state is PluginState.Ready,
|
|
||||||
onValueChanged = {
|
|
||||||
viewModel.setPluginEnabled(plugin.plugin.authority, it)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
PreferenceCategory {
|
PreferenceCategory {
|
||||||
if (5000 < radius) {
|
|
||||||
Banner(
|
|
||||||
modifier = Modifier.padding(16.dp),
|
|
||||||
icon = Icons.Rounded.WarningAmber,
|
|
||||||
text = stringResource(R.string.preference_search_locations_radius_large_radius_warning)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
ListPreference(
|
ListPreference(
|
||||||
title = stringResource(R.string.length_unit),
|
title = stringResource(R.string.length_unit),
|
||||||
items = listOf(
|
items = listOf(
|
||||||
@ -121,6 +120,13 @@ fun LocationsSettingsScreen() {
|
|||||||
viewModel.setImperialUnits(it)
|
viewModel.setImperialUnits(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
AnimatedVisibility(5000 < radius) {
|
||||||
|
Banner(
|
||||||
|
modifier = Modifier.padding(16.dp),
|
||||||
|
icon = Icons.Rounded.WarningAmber,
|
||||||
|
text = stringResource(R.string.preference_search_locations_radius_large_radius_warning)
|
||||||
|
)
|
||||||
|
}
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
title = stringResource(R.string.preference_search_locations_radius),
|
title = stringResource(R.string.preference_search_locations_radius),
|
||||||
value = radius,
|
value = radius,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user