mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 00:12:24 +01:00
car: Settings, Messages, the phone screens and Vehicle data scroll right down to the nav bar
This commit is contained in:
1 parent
d915b0ce45
commit
4aac815b2e
5 files changed
+12
-10
No files matched your search
@@ -92,7 +92,7 @@ fun CarSettingsScreen() {
|
|||||||
var chosen by androidx.compose.runtime.saveable.rememberSaveable { androidx.compose.runtime.mutableIntStateOf(0) }
|
var chosen by androidx.compose.runtime.saveable.rememberSaveable { androidx.compose.runtime.mutableIntStateOf(0) }
|
||||||
val listState = androidx.compose.foundation.lazy.rememberLazyListState()
|
val listState = androidx.compose.foundation.lazy.rememberLazyListState()
|
||||||
androidx.compose.runtime.LaunchedEffect(chosen) { listState.scrollToItem(0) }
|
androidx.compose.runtime.LaunchedEffect(chosen) { listState.scrollToItem(0) }
|
||||||
Row(Modifier.fillMaxSize().padding(start = 16.dp, top = 12.dp, bottom = 12.dp)) {
|
Row(Modifier.fillMaxSize().padding(start = 16.dp, top = 12.dp)) {
|
||||||
SettingsRail(listOf(stringResource(R.string.car_group_screen), stringResource(R.string.car_group_nav_bar), stringResource(R.string.car_group_sound), stringResource(R.string.car_group_warnings), stringResource(R.string.car_group_more)), chosen) { chosen = it }
|
SettingsRail(listOf(stringResource(R.string.car_group_screen), stringResource(R.string.car_group_nav_bar), stringResource(R.string.car_group_sound), stringResource(R.string.car_group_warnings), stringResource(R.string.car_group_more)), chosen) { chosen = it }
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
Modifier.weight(1f).fillMaxHeight(),
|
Modifier.weight(1f).fillMaxHeight(),
|
||||||
@@ -370,7 +370,7 @@ private fun SettingsRail(groups: List<String>, chosen: Int, onChoose: (Int) -> U
|
|||||||
val scheme = MaterialTheme.colorScheme
|
val scheme = MaterialTheme.colorScheme
|
||||||
val shape = RoundedCornerShape(24.dp)
|
val shape = RoundedCornerShape(24.dp)
|
||||||
Surface(
|
Surface(
|
||||||
Modifier.width(250.dp).fillMaxHeight().gsPanelShadow(shape),
|
Modifier.width(250.dp).padding(bottom = 12.dp).fillMaxHeight().gsPanelShadow(shape),
|
||||||
shape = shape,
|
shape = shape,
|
||||||
color = scheme.surfaceContainer,
|
color = scheme.surfaceContainer,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ fun MessagesScreen(packageName: String) {
|
|||||||
|
|
||||||
LaunchedEffect(history) { CarNotifications.dismissPopupFrom(packageName) }
|
LaunchedEffect(history) { CarNotifications.dismissPopupFrom(packageName) }
|
||||||
|
|
||||||
Column(Modifier.fillMaxSize().padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
Column(Modifier.fillMaxSize().padding(start = 16.dp, end = 16.dp, top = 16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||||
GsIconButton(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.back), navigator::back)
|
GsIconButton(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.back), navigator::back)
|
||||||
entry?.icon?.let { Image(it, contentDescription = null, modifier = Modifier.size(36.dp).clip(RoundedCornerShape(8.dp))) }
|
entry?.icon?.let { Image(it, contentDescription = null, modifier = Modifier.size(36.dp).clip(RoundedCornerShape(8.dp))) }
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ fun PhoneAppsScreen() {
|
|||||||
value = PhoneApps.cached() ?: withContext(Dispatchers.IO) { PhoneApps.installed(context).also { PhoneApps.warm(context) } }
|
value = PhoneApps.cached() ?: withContext(Dispatchers.IO) { PhoneApps.installed(context).also { PhoneApps.warm(context) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(Modifier.fillMaxSize().padding(horizontal = 20.dp, vertical = 12.dp)) {
|
Column(Modifier.fillMaxSize().padding(start = 20.dp, end = 20.dp, top = 12.dp)) {
|
||||||
ScreenHeader(stringResource(R.string.app_screen_sharing))
|
ScreenHeader(stringResource(R.string.app_screen_sharing))
|
||||||
Spacer(Modifier.height(12.dp))
|
Spacer(Modifier.height(12.dp))
|
||||||
if (!TouchRelayService.enabled) {
|
if (!TouchRelayService.enabled) {
|
||||||
@@ -65,7 +65,7 @@ fun PhoneAppsScreen() {
|
|||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Adaptive(minSize = 108.dp),
|
columns = GridCells.Adaptive(minSize = 108.dp),
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentPadding = PaddingValues(bottom = 8.dp),
|
contentPadding = PaddingValues(bottom = 16.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import app.seb3thehacker.gearslip.GearslipLog
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -138,7 +139,7 @@ fun PhoneDialerScreen() {
|
|||||||
var hasPermissions by remember { mutableStateOf(hasCallPermissions(context)) }
|
var hasPermissions by remember { mutableStateOf(hasCallPermissions(context)) }
|
||||||
var tab by remember { mutableStateOf(TAB_CONTACTS) }
|
var tab by remember { mutableStateOf(TAB_CONTACTS) }
|
||||||
|
|
||||||
Column(Modifier.fillMaxSize().padding(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
Column(Modifier.fillMaxSize().padding(start = 16.dp, end = 16.dp, top = 16.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
// The tabs share the title's row, so the list and keypad get the height back.
|
// The tabs share the title's row, so the list and keypad get the height back.
|
||||||
ScreenHeader(stringResource(R.string.carset_phone)) {
|
ScreenHeader(stringResource(R.string.carset_phone)) {
|
||||||
if (hasPermissions) {
|
if (hasPermissions) {
|
||||||
@@ -155,7 +156,7 @@ fun PhoneDialerScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Box(Modifier.weight(1f).fillMaxWidth()) {
|
Box(Modifier.weight(1f).fillMaxWidth()) {
|
||||||
if (tab == TAB_CONTACTS) ContactsList(context) else Keypad(context)
|
if (tab == TAB_CONTACTS) ContactsList(context) else Box(Modifier.padding(bottom = 16.dp)) { Keypad(context) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,7 +293,7 @@ private fun ContactsList(context: Context) {
|
|||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
)
|
||||||
else -> LazyColumn(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
else -> LazyColumn(Modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
items(filtered) { contact ->
|
items(filtered) { contact ->
|
||||||
ContactRow(contact) { pendingCall = contact }
|
ContactRow(contact) { pendingCall = contact }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.seb3thehacker.gearslip.car
|
package app.seb3thehacker.gearslip.car
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -27,7 +28,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
fun VehicleDataScreen() {
|
fun VehicleDataScreen() {
|
||||||
val readings by CarSensors.readings.collectAsState()
|
val readings by CarSensors.readings.collectAsState()
|
||||||
|
|
||||||
Column(Modifier.fillMaxSize().padding(horizontal = 24.dp, vertical = 16.dp)) {
|
Column(Modifier.fillMaxSize().padding(start = 24.dp, end = 24.dp, top = 16.dp)) {
|
||||||
ScreenHeader("Vehicle data")
|
ScreenHeader("Vehicle data")
|
||||||
Text(
|
Text(
|
||||||
"Raw sensor channel from the connected head unit. Field meaning is a best guess - " +
|
"Raw sensor channel from the connected head unit. Field meaning is a best guess - " +
|
||||||
@@ -46,7 +47,7 @@ fun VehicleDataScreen() {
|
|||||||
return@Column
|
return@Column
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
LazyColumn(contentPadding = PaddingValues(bottom = 16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
items(readings, key = { it.typeId }) { reading -> ReadingRow(reading) }
|
items(readings, key = { it.typeId }) { reading -> ReadingRow(reading) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user