Release GPS2Audio v2.5.44 POI category fix
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
package de.waypointaudio.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Edit
|
||||
import androidx.compose.material.icons.filled.Explore
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import de.waypointaudio.R
|
||||
import androidx.compose.foundation.clickable
|
||||
|
||||
/**
|
||||
* Modi des vereinten Kartenmoduls (v2.2.1).
|
||||
*
|
||||
* EXPLORER — Live-Standort + read-only Wegpunkte (kein PTT, kein Atmo).
|
||||
* EDITOR — Bestehender Karteneditor (Long-Press neue Wegpunkte, Track-Aufzeichnung).
|
||||
*
|
||||
* ROUTE/IMPORT sind v2.2.1 noch nicht eigenständige Modi — Import/Drafts laufen
|
||||
* weiterhin über das Overflow-Menü bzw. den Karteneditor.
|
||||
*/
|
||||
enum class MapMode { EXPLORER, EDITOR }
|
||||
|
||||
/**
|
||||
* Kompakte Segmented-Control für die TopAppBar.
|
||||
* Wird im Title-Slot der jeweiligen Map/Explorer-TopAppBar gerendert, damit die
|
||||
* gemeinsame Visualisierung „eine Karte mit Modusumschalter" entsteht.
|
||||
*/
|
||||
@Composable
|
||||
fun MapModeSegmentedHeader(
|
||||
current: MapMode,
|
||||
onChange: (MapMode) -> Unit,
|
||||
subtitle: String? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
contentColor: androidx.compose.ui.graphics.Color? = null
|
||||
) {
|
||||
val on = contentColor ?: MaterialTheme.colorScheme.onPrimary
|
||||
val container = on.copy(alpha = 0.14f)
|
||||
val selectedContainer = on.copy(alpha = 0.28f)
|
||||
|
||||
androidx.compose.foundation.layout.Column(modifier = modifier) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
color = container
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(horizontal = 4.dp, vertical = 3.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(2.dp)
|
||||
) {
|
||||
Segment(
|
||||
label = stringResource(R.string.map_mode_explorer),
|
||||
icon = Icons.Filled.Explore,
|
||||
selected = current == MapMode.EXPLORER,
|
||||
selectedColor = selectedContainer,
|
||||
contentColor = on,
|
||||
onClick = { if (current != MapMode.EXPLORER) onChange(MapMode.EXPLORER) }
|
||||
)
|
||||
Segment(
|
||||
label = stringResource(R.string.map_mode_editor),
|
||||
icon = Icons.Filled.Edit,
|
||||
selected = current == MapMode.EDITOR,
|
||||
selectedColor = selectedContainer,
|
||||
contentColor = on,
|
||||
onClick = { if (current != MapMode.EDITOR) onChange(MapMode.EDITOR) }
|
||||
)
|
||||
}
|
||||
}
|
||||
if (subtitle != null) {
|
||||
Spacer(Modifier.height(1.dp))
|
||||
Text(
|
||||
text = subtitle,
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = on.copy(alpha = 0.8f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Segment(
|
||||
label: String,
|
||||
icon: androidx.compose.ui.graphics.vector.ImageVector,
|
||||
selected: Boolean,
|
||||
selectedColor: androidx.compose.ui.graphics.Color,
|
||||
contentColor: androidx.compose.ui.graphics.Color,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
color = if (selected) selectedColor else androidx.compose.ui.graphics.Color.Transparent,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable(onClick = onClick)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(horizontal = 10.dp, vertical = 5.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(
|
||||
icon,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(16.dp),
|
||||
tint = contentColor
|
||||
)
|
||||
Spacer(Modifier.width(4.dp))
|
||||
Text(
|
||||
text = label,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = contentColor
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user