mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-28 03:44:22 +01:00
Apply testing fixes
This commit is contained in:
@@ -30,23 +30,10 @@ fun FeatureButton(
|
||||
) {
|
||||
ScreenSection(onClick = onClick) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(160.dp),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Box( modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = stringResource(id = nameCode),
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.fillMaxWidth().align(Alignment.BottomCenter),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Image(
|
||||
painter = painterResource(iconId),
|
||||
contentDescription = stringResource(id = name),
|
||||
@@ -61,14 +48,12 @@ fun FeatureButton(
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Box( modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = stringResource(id = name),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.fillMaxWidth().align(Alignment.TopCenter),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(id = name),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.fillMaxWidth().height(42.dp),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
package no.nordicsemi.android.nrftoolbox
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import no.nordicsemi.android.theme.view.CloseIconAppBar
|
||||
import no.nordicsemi.android.theme.view.TitleAppBar
|
||||
|
||||
@Composable
|
||||
fun HomeScreen() {
|
||||
val viewModel: HomeViewModel = hiltViewModel()
|
||||
|
||||
Column {
|
||||
val context = LocalContext.current
|
||||
CloseIconAppBar(stringResource(id = R.string.app_name)) {
|
||||
(context as? Activity)?.finish()
|
||||
}
|
||||
TitleAppBar(stringResource(id = R.string.app_name))
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@@ -104,7 +99,7 @@ fun HomeScreen() {
|
||||
|
||||
val uriHandler = LocalUriHandler.current
|
||||
FeatureButton(R.drawable.ic_dfu, R.string.dfu_module, R.string.dfu_module_full) {
|
||||
uriHandler.openUri("https://github.com/NordicSemiconductor/Android-nRF-Toolbox")
|
||||
uriHandler.openUri("https://github.com/NordicSemiconductor/Android-DFU-Library")
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<string name="hts_module">HTS</string>
|
||||
<string name="hts_module_full">Health Thermometer</string>
|
||||
<string name="bps_module">BPS</string>
|
||||
<string name="bps_module_full">Blood pressure</string>
|
||||
<string name="bps_module_full">Blood Pressure</string>
|
||||
<string name="rscs_module">RSCS</string>
|
||||
<string name="rscs_module_full">Running Speed and Cadence</string>
|
||||
<string name="prx_module">PRX</string>
|
||||
|
||||
@@ -36,6 +36,20 @@ fun CloseIconAppBar(text: String, onClick: () -> Unit) {
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun TitleAppBar(text: String) {
|
||||
SmallTopAppBar(
|
||||
title = { Text(text) },
|
||||
colors = TopAppBarDefaults.smallTopAppBarColors(
|
||||
scrolledContainerColor = MaterialTheme.colorScheme.primary,
|
||||
containerColor = colorResource(id = R.color.appBarColor),
|
||||
titleContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||
actionIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BackIconAppBar(text: String, onClick: () -> Unit) {
|
||||
SmallTopAppBar(
|
||||
|
||||
@@ -74,7 +74,7 @@ internal fun DeviceDetailsView(device: DiscoveredBluetoothDevice) {
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = device.displayName(),
|
||||
text = device.displayName() ?: "No name",
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
Text(text = device.displayAddress(), style = MaterialTheme.typography.bodyMedium)
|
||||
|
||||
@@ -18,7 +18,7 @@ dependencyResolutionManagement {
|
||||
alias('nordic-dfu').to('no.nordicsemi.android:dfu:1.12.1-beta01')
|
||||
|
||||
version('commonlibraries', '1.0.1')
|
||||
alias('nordic-ui-scanner').to('no.nordicsemi.android.common', 'ui-scanner').versionRef('commonlibraries')
|
||||
alias('nordic-ui-scanner').to('no.nordicsemi.android.common', 'uiscanner').versionRef('commonlibraries')
|
||||
alias('nordic-navigation').to('no.nordicsemi.android.common', 'navigation').versionRef('commonlibraries')
|
||||
alias('nordic-theme').to('no.nordicsemi.android.common', 'theme').versionRef('commonlibraries')
|
||||
|
||||
@@ -91,10 +91,10 @@ include ':lib_service'
|
||||
include ':lib_theme'
|
||||
include ':lib_utils'
|
||||
|
||||
//if (file('../Android-Common-Libraries').exists()) {
|
||||
// includeBuild('../Android-Common-Libraries')
|
||||
//}
|
||||
//
|
||||
//if (file('../Android-BLE-Library').exists()) {
|
||||
// includeBuild('../Android-BLE-Library')
|
||||
//}
|
||||
if (file('../Android-Common-Libraries').exists()) {
|
||||
includeBuild('../Android-Common-Libraries')
|
||||
}
|
||||
|
||||
if (file('../Android-BLE-Library').exists()) {
|
||||
includeBuild('../Android-BLE-Library')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user