Skip to content

Commit ad6eb99

Browse files
authored
Merge pull request #3 from tuuhin/v3
V3
2 parents 114fd0f + cb044a7 commit ad6eb99

File tree

11 files changed

+89
-66
lines changed

11 files changed

+89
-66
lines changed

app/build.gradle.kts

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android {
1919
applicationId = "com.eva.bluetoothterminalapp"
2020
minSdk = 29
2121
targetSdk = 36
22-
versionCode = 2
23-
versionName = "1.1.0"
22+
versionCode = 3
23+
versionName = "1.1.1"
2424

2525
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2626
vectorDrawables {
@@ -112,34 +112,22 @@ dependencies {
112112
implementation(libs.androidx.activity.compose)
113113
// compose
114114
implementation(platform(libs.androidx.compose.bom))
115-
implementation(libs.androidx.ui)
116-
implementation(libs.androidx.ui.graphics)
117-
implementation(libs.androidx.ui.tooling.preview)
118-
implementation(libs.androidx.material3)
115+
implementation(libs.bundles.compose)
119116
//lifecycle compose runtime
120117
implementation(libs.androidx.lifecycle.runtime.compose)
121118
//navigation
122119
implementation(libs.compose.destination.animation)
123120
implementation(libs.compose.destination.core)
124121
ksp(libs.compose.destination.ksp)
125-
//kotlin immutable
126-
implementation(libs.kotlinx.collections.immutable)
127-
//kotlinx datetime
128-
implementation(libs.kotlinx.datetime)
122+
//kotlinx
123+
implementation(libs.bundles.kotlinx)
129124
//splash api
130125
implementation(libs.androidx.core.splashscreen)
131126
// koin
132127
implementation(platform(libs.koin.bom))
133-
implementation(libs.koin.core)
134-
implementation(libs.koin.android)
135-
implementation(libs.koin.compose)
136-
implementation(libs.koin.android.startup)
128+
implementation(libs.bundles.koin)
137129
// shapes
138130
implementation(libs.androidx.graphics.shapes)
139-
// kotlinx-serialization
140-
implementation(libs.kotlinx.serialization.json)
141-
//icons
142-
implementation(libs.androidx.material.icons.extended)
143131
//datastore
144132
implementation(libs.androidx.datastore)
145133
implementation(libs.protobuf.javalite)
@@ -157,11 +145,11 @@ dependencies {
157145

158146
protobuf {
159147
protoc {
160-
artifact = "com.google.protobuf:protoc:4.26.1"
148+
artifact = libs.protobuf.protoc.compiler.get().toString()
161149
}
162150
plugins {
163151
create("java") {
164-
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
152+
artifact = libs.protobuf.protoc.gen.javalite.get().toString()
165153
}
166154
}
167155

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_connect/bt_client/composables/BTClientTopBar.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fun BTClientTopBar(
2828
modifier: Modifier = Modifier,
2929
navigation: @Composable () -> Unit = {},
3030
scrollBehavior: TopAppBarScrollBehavior? = null,
31-
colors: TopAppBarColors = TopAppBarDefaults.mediumTopAppBarColors(),
31+
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),
3232
) {
3333
MediumTopAppBar(
3434
title = { Text(text = stringResource(id = R.string.bt_client_route)) },
@@ -47,7 +47,7 @@ fun BTClientTopBar(
4747
}
4848

4949

50-
private class ClientConnectionStatePreviewParmas :
50+
private class ClientConnectionStatePreviewParams :
5151
CollectionPreviewParameterProvider<ClientConnectionState>(
5252
listOf(
5353
ClientConnectionState.CONNECTION_CONNECTED,
@@ -60,7 +60,7 @@ private class ClientConnectionStatePreviewParmas :
6060
@PreviewLightDark
6161
@Composable
6262
private fun AnimatedConnectDisconnectButtonPreview(
63-
@PreviewParameter(ClientConnectionStatePreviewParmas::class)
63+
@PreviewParameter(ClientConnectionStatePreviewParams::class)
6464
state: ClientConnectionState,
6565
) = BlueToothTerminalAppTheme {
6666
BTClientTopBar(

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_connect/bt_profile/composable/ConnectionProfileTopBar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun ConnectionProfileTopBar(
2525
modifier: Modifier = Modifier,
2626
navigation: @Composable () -> Unit,
2727
scrollBehavior: TopAppBarScrollBehavior? = null,
28-
colors: TopAppBarColors = TopAppBarDefaults.mediumTopAppBarColors()
28+
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors()
2929
) {
3030
MediumTopAppBar(
3131
title = { Text(text = stringResource(id = R.string.bl_connect_profile_title)) },

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_connect/composables/BTClientDeviceProfile.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.Spacer
1616
import androidx.compose.foundation.layout.fillMaxWidth
1717
import androidx.compose.foundation.layout.height
1818
import androidx.compose.foundation.layout.padding
19+
import androidx.compose.material3.AssistChipDefaults
1920
import androidx.compose.material3.Card
2021
import androidx.compose.material3.CardDefaults
2122
import androidx.compose.material3.MaterialTheme
@@ -101,7 +102,10 @@ fun BTClientDeviceProfile(
101102
fontFamily = FontFamily.Monospace,
102103
)
103104
Spacer(modifier = Modifier.height(4.dp))
104-
ClientConnectionStateChip(connectionState = connectionState)
105+
ClientConnectionStateChip(
106+
connectionState = connectionState,
107+
elevation = AssistChipDefaults.elevatedAssistChipElevation()
108+
)
105109
}
106110
BTDeviceIconLarge(device = device)
107111
}

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_devices/BTDevicesRoute.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ fun BTDevicesRoute(
145145
}
146146
}
147147

148-
private class BTDeviceClassicalScreenStateParams
149-
: CollectionPreviewParameterProvider<BTDevicesScreenState>(
150-
listOf(
151-
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_AND_AVAILABLE_DEVICES,
152-
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_DEVICE,
153-
PreviewFakes.FAKE_DEVICE_STATE_WITH_NO_DEVICE,
148+
private class BTDeviceClassicalScreenStateParams :
149+
CollectionPreviewParameterProvider<BTDevicesScreenState>(
150+
listOf(
151+
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_AND_AVAILABLE_DEVICES,
152+
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_DEVICE,
153+
PreviewFakes.FAKE_DEVICE_STATE_WITH_NO_DEVICE,
154+
)
154155
)
155-
)
156156

157157
@PreviewLightDark
158158
@Composable

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_devices/composables/BTDeviceIcon.kt

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.eva.bluetoothterminalapp.presentation.feature_devices.composables
22

3-
import androidx.compose.foundation.background
3+
import androidx.compose.foundation.border
44
import androidx.compose.foundation.layout.Box
55
import androidx.compose.foundation.layout.defaultMinSize
66
import androidx.compose.foundation.layout.padding
7+
import androidx.compose.foundation.layout.size
78
import androidx.compose.material3.Icon
89
import androidx.compose.material3.MaterialTheme
10+
import androidx.compose.material3.Surface
911
import androidx.compose.runtime.Composable
1012
import androidx.compose.runtime.remember
1113
import androidx.compose.ui.Alignment
@@ -14,7 +16,8 @@ import androidx.compose.ui.draw.clip
1416
import androidx.compose.ui.graphics.Color
1517
import androidx.compose.ui.res.dimensionResource
1618
import androidx.compose.ui.res.stringResource
17-
import androidx.compose.ui.tooling.preview.Preview
19+
import androidx.compose.ui.tooling.preview.PreviewLightDark
20+
import androidx.compose.ui.unit.DpSize
1821
import androidx.compose.ui.unit.dp
1922
import androidx.graphics.shapes.CornerRounding
2023
import androidx.graphics.shapes.RoundedPolygon
@@ -33,6 +36,9 @@ fun BTDeviceIcon(
3336
deviceName: String? = null,
3437
containerColor: Color = MaterialTheme.colorScheme.onPrimaryContainer,
3538
contentColor: Color = MaterialTheme.colorScheme.primaryContainer,
39+
borderColor: Color = MaterialTheme.colorScheme.primaryFixed,
40+
showBorder: Boolean = false,
41+
innerIconSize: DpSize = DpSize(32.dp, 32.dp),
3642
) {
3743

3844
val pillShape = remember {
@@ -42,28 +48,39 @@ fun BTDeviceIcon(
4248
)
4349
}
4450

45-
Box(
51+
Surface(
52+
color = containerColor,
53+
contentColor = contentColor,
4654
modifier = modifier
55+
.clip(RoundedPolygonShape(pillShape))
56+
.then(
57+
if (showBorder) Modifier.border(
58+
2.dp,
59+
borderColor,
60+
RoundedPolygonShape(pillShape)
61+
) else Modifier
62+
)
4763
.defaultMinSize(
4864
minWidth = dimensionResource(id = R.dimen.min_device_image_size),
4965
minHeight = dimensionResource(id = R.dimen.min_device_image_size),
5066
)
51-
.clip(RoundedPolygonShape(pillShape))
52-
.background(containerColor),
53-
contentAlignment = Alignment.Center
5467
) {
55-
Icon(
56-
imageVector = device.imageVector,
57-
contentDescription = deviceName?.let {
58-
stringResource(id = R.string.devices_image_type, it)
59-
},
60-
tint = contentColor,
61-
modifier = Modifier.padding(12.dp)
62-
)
68+
Box(
69+
contentAlignment = Alignment.Center,
70+
modifier = Modifier.padding(8.dp)
71+
) {
72+
Icon(
73+
imageVector = device.imageVector,
74+
contentDescription = deviceName?.let {
75+
stringResource(id = R.string.devices_image_type, it)
76+
},
77+
modifier = Modifier.size(innerIconSize)
78+
)
79+
}
6380
}
6481
}
6582

66-
@Preview
83+
@PreviewLightDark
6784
@Composable
6885
private fun BTDeviceIconPreview() = BlueToothTerminalAppTheme {
6986
BTDeviceIcon(device = PreviewFakes.FAKE_DEVICE_MODEL)

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_devices/composables/BTDevicesTopBarMenu.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import androidx.compose.material3.MaterialTheme
1717
import androidx.compose.material3.MenuDefaults
1818
import androidx.compose.material3.PlainTooltip
1919
import androidx.compose.material3.Text
20+
import androidx.compose.material3.TooltipAnchorPosition
2021
import androidx.compose.material3.TooltipBox
2122
import androidx.compose.material3.TooltipDefaults
2223
import androidx.compose.material3.rememberTooltipState
@@ -49,7 +50,9 @@ fun BTDevicesTopBarMenu(
4950

5051
Box(modifier = modifier) {
5152
TooltipBox(
52-
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
53+
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(
54+
TooltipAnchorPosition.Below
55+
),
5356
tooltip = {
5457
PlainTooltip(
5558
modifier = Modifier.padding(4.dp),

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_devices/composables/DevicesScreenModeContainer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.eva.bluetoothterminalapp.presentation.feature_devices.composables
33
import androidx.compose.animation.Crossfade
44
import androidx.compose.animation.core.tween
55
import androidx.compose.foundation.layout.Box
6+
import androidx.compose.foundation.layout.BoxScope
67
import androidx.compose.foundation.layout.padding
78
import androidx.compose.material3.Surface
89
import androidx.compose.runtime.Composable
@@ -25,7 +26,7 @@ fun DevicesScreenModeContainer(
2526
hasPermission: Boolean,
2627
onBTPermissionChanged: (Boolean) -> Unit,
2728
modifier: Modifier = Modifier,
28-
content: @Composable () -> Unit,
29+
content: @Composable BoxScope.() -> Unit,
2930
) {
3031
val screenType by remember(hasPermission, isActive) {
3132
derivedStateOf {

app/src/main/java/com/eva/bluetoothterminalapp/presentation/feature_le_connect/composables/BLEDeviceRouteTopBar.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import androidx.compose.material3.MediumTopAppBar
1414
import androidx.compose.material3.MenuDefaults
1515
import androidx.compose.material3.PlainTooltip
1616
import androidx.compose.material3.Text
17+
import androidx.compose.material3.TooltipAnchorPosition
1718
import androidx.compose.material3.TooltipBox
1819
import androidx.compose.material3.TooltipDefaults
1920
import androidx.compose.material3.TopAppBarColors
@@ -58,7 +59,9 @@ fun BLEDeviceRouteTopBar(
5859

5960
Box(modifier = modifier) {
6061
TooltipBox(
61-
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
62+
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(
63+
TooltipAnchorPosition.Below
64+
),
6265
tooltip = {
6366
PlainTooltip(
6467
modifier = Modifier.padding(4.dp),

gradle/libs.versions.toml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
[versions]
2-
agp = "8.11.1"
2+
agp = "8.13.0"
33
compose_destination_animation_version = "1.11.9"
44
compose_destination_core_version = "2.2.0"
55
coreSplashscreen = "1.0.1"
66
datastore = "1.1.7"
77
graphicsShapes = "1.0.1"
8-
kotlin = "2.2.0"
9-
coreKtx = "1.16.0"
8+
kotlin = "2.2.20"
9+
coreKtx = "1.17.0"
1010
junit = "4.13.2"
11-
junitVersion = "1.2.1"
12-
espressoCore = "3.5.1"
11+
junitVersion = "1.3.0"
12+
espressoCore = "3.7.0"
1313
kotlinxCollectionsImmutable = "0.4.0"
1414
kotlinxDatetime = "0.7.1"
1515
kotlinxSerializationJson = "1.9.0"
1616
ksp = "2.2.0"
17-
lifecycleRuntimeKtx = "2.9.2"
18-
activityCompose = "1.10.1"
19-
composeBom = "2025.07.00"
20-
koinBom = "4.1.0"
17+
lifecycleRuntimeKtx = "2.9.4"
18+
activityCompose = "1.11.0"
19+
composeBom = "2025.09.01"
20+
koinBom = "4.1.1"
2121
materialIconsExtended = "1.7.8"
22-
ksp_version = "2.2.0-2.0.2"
23-
protobufJavalite = "4.31.1"
24-
protobuf_version = "0.9.5"
22+
ksp_version = "2.2.20-2.0.2"
23+
protobufJavalite = "4.32.1"
24+
protobuf-protoc-gen-javalite = "3.0.0"
25+
protobuf_plugin_version = "0.9.5"
2526

2627
[libraries]
2728
#core
@@ -59,21 +60,27 @@ koin-android-startup = { module = "io.insert-koin:koin-androidx-startup" }
5960
# test
6061
junit = { group = "junit", name = "junit", version.ref = "junit" }
6162
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
62-
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version = "3.6.1" }
63+
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version = "espressoCore" }
6364
#datetime
6465
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
6566
# protobuf and datastore
6667
androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "datastore" }
6768
protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobufJavalite" }
6869
protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "protobufJavalite" }
70+
protobuf-protoc-compiler = { module = "com.google.protobuf:protoc", version.ref = "protobufJavalite" }
71+
protobuf-protoc-gen-javalite = { module = "com.google.protobuf:protoc-gen-javalite", version.ref = "protobuf-protoc-gen-javalite" }
6972
# kotlinx serialization
7073
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
7174

72-
7375
[plugins]
7476
android-application = { id = "com.android.application", version.ref = "agp" }
7577
jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
7678
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
7779
google_devtools_ksp = { id = "com.google.devtools.ksp", version.ref = "ksp_version" }
78-
google_protobuf = { id = "com.google.protobuf", version.ref = "protobuf_version" }
80+
google_protobuf = { id = "com.google.protobuf", version.ref = "protobuf_plugin_version" }
7981
kotlinx_serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
82+
83+
[bundles]
84+
compose = ["androidx-ui", "androidx-ui-graphics", "androidx-ui-tooling-preview", "androidx-material3", "androidx-material-icons-extended"]
85+
koin = ["koin-core", "koin-compose", "koin-android-startup", "koin-android"]
86+
kotlinx = ["kotlinx-collections-immutable", "kotlinx-datetime", "kotlinx-serialization-json"]

0 commit comments

Comments
 (0)