mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-24 01:44:23 +01:00
Add fixes to UART screen
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
android:windowSoftInputMode="stateVisible|adjustResize"
|
||||||
android:theme="@style/AppTheme.SplashScreen">
|
android:theme="@style/AppTheme.SplashScreen">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.compose.material.icons.filled.Close
|
|||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.colorResource
|
import androidx.compose.ui.res.colorResource
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
@@ -103,7 +104,13 @@ fun LoggerIconAppBar(text: String, onClick: () -> Unit, onDisconnectClick: () ->
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
TextButton(onClick = { onDisconnectClick() }) {
|
TextButton(
|
||||||
|
onClick = { onDisconnectClick() },
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onPrimary
|
||||||
|
)
|
||||||
|
) {
|
||||||
Text(stringResource(id = R.string.disconnect))
|
Text(stringResource(id = R.string.disconnect))
|
||||||
}
|
}
|
||||||
IconButton(onClick = { onLoggerClick() }) {
|
IconButton(onClick = { onLoggerClick() }) {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package no.nordicsemi.android.uart.view
|
package no.nordicsemi.android.uart.view
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.Edit
|
import androidx.compose.material.icons.filled.Edit
|
||||||
@@ -37,8 +39,9 @@ internal fun MacroSection(viewState: UARTViewState, onEvent: (UARTViewEvent) ->
|
|||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(16.dp)
|
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
.padding(16.dp)
|
||||||
) {
|
) {
|
||||||
ScreenSection {
|
ScreenSection {
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
@@ -90,10 +90,16 @@ fun LazyListState.isScrolledToTheEnd() = layoutInfo.visibleItemsInfo.lastOrNull(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MessageItemInput(record: UARTRecord) {
|
private fun MessageItemInput(record: UARTRecord) {
|
||||||
Box(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
contentAlignment = Alignment.CenterEnd
|
horizontalAlignment = Alignment.End
|
||||||
) {
|
) {
|
||||||
|
Text(
|
||||||
|
text = record.timeToString(),
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp, bottomStart = 10.dp))
|
.clip(RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp, bottomStart = 10.dp))
|
||||||
@@ -101,12 +107,6 @@ private fun MessageItemInput(record: UARTRecord) {
|
|||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
horizontalAlignment = Alignment.End
|
horizontalAlignment = Alignment.End
|
||||||
) {
|
) {
|
||||||
Text(
|
|
||||||
text = record.timeToString(),
|
|
||||||
style = MaterialTheme.typography.labelSmall,
|
|
||||||
color = MaterialTheme.colorScheme.inverseOnSurface
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
|
||||||
Text(
|
Text(
|
||||||
text = record.text,
|
text = record.text,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
@@ -118,22 +118,22 @@ private fun MessageItemInput(record: UARTRecord) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MessageItemOutput(record: UARTRecord) {
|
private fun MessageItemOutput(record: UARTRecord) {
|
||||||
Box(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
contentAlignment = Alignment.CenterStart
|
horizontalAlignment = Alignment.Start
|
||||||
) {
|
) {
|
||||||
|
Text(
|
||||||
|
text = record.timeToString(),
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp, bottomEnd = 10.dp))
|
.clip(RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp, bottomEnd = 10.dp))
|
||||||
.background(MaterialTheme.colorScheme.primary)
|
.background(MaterialTheme.colorScheme.primary)
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
|
||||||
text = record.timeToString(),
|
|
||||||
style = MaterialTheme.typography.labelSmall,
|
|
||||||
color = MaterialTheme.colorScheme.inverseOnSurface,
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
|
||||||
Text(
|
Text(
|
||||||
text = record.text,
|
text = record.text,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ 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.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import no.nordicsemi.android.material.you.ScreenSection
|
import no.nordicsemi.android.material.you.Card
|
||||||
import no.nordicsemi.android.uart.data.UARTData
|
import no.nordicsemi.android.uart.data.UARTData
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -20,8 +20,17 @@ internal fun UARTContentView(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
ScreenSection(modifier = Modifier.weight(1f)) {
|
Card(
|
||||||
OutputSection(state.displayMessages, onEvent)
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(start = 16.dp, top = 16.dp, end = 16.dp)
|
||||||
|
) {
|
||||||
|
OutputSection(state.displayMessages, onEvent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.size(16.dp))
|
Spacer(modifier = Modifier.size(16.dp))
|
||||||
|
|||||||
Reference in New Issue
Block a user