Skip to content
Merged

V3 #3

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId = "com.eva.bluetoothterminalapp"
minSdk = 29
targetSdk = 36
versionCode = 2
versionName = "1.1.0"
versionCode = 3
versionName = "1.1.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -112,34 +112,22 @@ dependencies {
implementation(libs.androidx.activity.compose)
// compose
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.bundles.compose)
//lifecycle compose runtime
implementation(libs.androidx.lifecycle.runtime.compose)
//navigation
implementation(libs.compose.destination.animation)
implementation(libs.compose.destination.core)
ksp(libs.compose.destination.ksp)
//kotlin immutable
implementation(libs.kotlinx.collections.immutable)
//kotlinx datetime
implementation(libs.kotlinx.datetime)
//kotlinx
implementation(libs.bundles.kotlinx)
//splash api
implementation(libs.androidx.core.splashscreen)
// koin
implementation(platform(libs.koin.bom))
implementation(libs.koin.core)
implementation(libs.koin.android)
implementation(libs.koin.compose)
implementation(libs.koin.android.startup)
implementation(libs.bundles.koin)
// shapes
implementation(libs.androidx.graphics.shapes)
// kotlinx-serialization
implementation(libs.kotlinx.serialization.json)
//icons
implementation(libs.androidx.material.icons.extended)
//datastore
implementation(libs.androidx.datastore)
implementation(libs.protobuf.javalite)
Expand All @@ -157,11 +145,11 @@ dependencies {

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:4.26.1"
artifact = libs.protobuf.protoc.compiler.get().toString()
}
plugins {
create("java") {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
artifact = libs.protobuf.protoc.gen.javalite.get().toString()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fun BTClientTopBar(
modifier: Modifier = Modifier,
navigation: @Composable () -> Unit = {},
scrollBehavior: TopAppBarScrollBehavior? = null,
colors: TopAppBarColors = TopAppBarDefaults.mediumTopAppBarColors(),
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),
) {
MediumTopAppBar(
title = { Text(text = stringResource(id = R.string.bt_client_route)) },
Expand All @@ -47,7 +47,7 @@ fun BTClientTopBar(
}


private class ClientConnectionStatePreviewParmas :
private class ClientConnectionStatePreviewParams :
CollectionPreviewParameterProvider<ClientConnectionState>(
listOf(
ClientConnectionState.CONNECTION_CONNECTED,
Expand All @@ -60,7 +60,7 @@ private class ClientConnectionStatePreviewParmas :
@PreviewLightDark
@Composable
private fun AnimatedConnectDisconnectButtonPreview(
@PreviewParameter(ClientConnectionStatePreviewParmas::class)
@PreviewParameter(ClientConnectionStatePreviewParams::class)
state: ClientConnectionState,
) = BlueToothTerminalAppTheme {
BTClientTopBar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun ConnectionProfileTopBar(
modifier: Modifier = Modifier,
navigation: @Composable () -> Unit,
scrollBehavior: TopAppBarScrollBehavior? = null,
colors: TopAppBarColors = TopAppBarDefaults.mediumTopAppBarColors()
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors()
) {
MediumTopAppBar(
title = { Text(text = stringResource(id = R.string.bl_connect_profile_title)) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AssistChipDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -101,7 +102,10 @@ fun BTClientDeviceProfile(
fontFamily = FontFamily.Monospace,
)
Spacer(modifier = Modifier.height(4.dp))
ClientConnectionStateChip(connectionState = connectionState)
ClientConnectionStateChip(
connectionState = connectionState,
elevation = AssistChipDefaults.elevatedAssistChipElevation()
)
}
BTDeviceIconLarge(device = device)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ fun BTDevicesRoute(
}
}

private class BTDeviceClassicalScreenStateParams
: CollectionPreviewParameterProvider<BTDevicesScreenState>(
listOf(
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_AND_AVAILABLE_DEVICES,
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_DEVICE,
PreviewFakes.FAKE_DEVICE_STATE_WITH_NO_DEVICE,
private class BTDeviceClassicalScreenStateParams :
CollectionPreviewParameterProvider<BTDevicesScreenState>(
listOf(
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_AND_AVAILABLE_DEVICES,
PreviewFakes.FAKE_DEVICE_STATE_WITH_PAIRED_DEVICE,
PreviewFakes.FAKE_DEVICE_STATE_WITH_NO_DEVICE,
)
)
)

@PreviewLightDark
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.eva.bluetoothterminalapp.presentation.feature_devices.composables

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
Expand All @@ -14,7 +16,8 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.graphics.shapes.CornerRounding
import androidx.graphics.shapes.RoundedPolygon
Expand All @@ -33,6 +36,9 @@ fun BTDeviceIcon(
deviceName: String? = null,
containerColor: Color = MaterialTheme.colorScheme.onPrimaryContainer,
contentColor: Color = MaterialTheme.colorScheme.primaryContainer,
borderColor: Color = MaterialTheme.colorScheme.primaryFixed,
showBorder: Boolean = false,
innerIconSize: DpSize = DpSize(32.dp, 32.dp),
) {

val pillShape = remember {
Expand All @@ -42,28 +48,39 @@ fun BTDeviceIcon(
)
}

Box(
Surface(
color = containerColor,
contentColor = contentColor,
modifier = modifier
.clip(RoundedPolygonShape(pillShape))
.then(
if (showBorder) Modifier.border(
2.dp,
borderColor,
RoundedPolygonShape(pillShape)
) else Modifier
)
.defaultMinSize(
minWidth = dimensionResource(id = R.dimen.min_device_image_size),
minHeight = dimensionResource(id = R.dimen.min_device_image_size),
)
.clip(RoundedPolygonShape(pillShape))
.background(containerColor),
contentAlignment = Alignment.Center
) {
Icon(
imageVector = device.imageVector,
contentDescription = deviceName?.let {
stringResource(id = R.string.devices_image_type, it)
},
tint = contentColor,
modifier = Modifier.padding(12.dp)
)
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.padding(8.dp)
) {
Icon(
imageVector = device.imageVector,
contentDescription = deviceName?.let {
stringResource(id = R.string.devices_image_type, it)
},
modifier = Modifier.size(innerIconSize)
)
}
}
}

@Preview
@PreviewLightDark
@Composable
private fun BTDeviceIconPreview() = BlueToothTerminalAppTheme {
BTDeviceIcon(device = PreviewFakes.FAKE_DEVICE_MODEL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuDefaults
import androidx.compose.material3.PlainTooltip
import androidx.compose.material3.Text
import androidx.compose.material3.TooltipAnchorPosition
import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.rememberTooltipState
Expand Down Expand Up @@ -49,7 +50,9 @@ fun BTDevicesTopBarMenu(

Box(modifier = modifier) {
TooltipBox(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(
TooltipAnchorPosition.Below
),
tooltip = {
PlainTooltip(
modifier = Modifier.padding(4.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.eva.bluetoothterminalapp.presentation.feature_devices.composables
import androidx.compose.animation.Crossfade
import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
Expand All @@ -25,7 +26,7 @@ fun DevicesScreenModeContainer(
hasPermission: Boolean,
onBTPermissionChanged: (Boolean) -> Unit,
modifier: Modifier = Modifier,
content: @Composable () -> Unit,
content: @Composable BoxScope.() -> Unit,
) {
val screenType by remember(hasPermission, isActive) {
derivedStateOf {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.material3.MediumTopAppBar
import androidx.compose.material3.MenuDefaults
import androidx.compose.material3.PlainTooltip
import androidx.compose.material3.Text
import androidx.compose.material3.TooltipAnchorPosition
import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.TopAppBarColors
Expand Down Expand Up @@ -58,7 +59,9 @@ fun BLEDeviceRouteTopBar(

Box(modifier = modifier) {
TooltipBox(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(
TooltipAnchorPosition.Below
),
tooltip = {
PlainTooltip(
modifier = Modifier.padding(4.dp),
Expand Down
37 changes: 22 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
[versions]
agp = "8.11.1"
agp = "8.13.0"
compose_destination_animation_version = "1.11.9"
compose_destination_core_version = "2.2.0"
coreSplashscreen = "1.0.1"
datastore = "1.1.7"
graphicsShapes = "1.0.1"
kotlin = "2.2.0"
coreKtx = "1.16.0"
kotlin = "2.2.20"
coreKtx = "1.17.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.5.1"
junitVersion = "1.3.0"
espressoCore = "3.7.0"
kotlinxCollectionsImmutable = "0.4.0"
kotlinxDatetime = "0.7.1"
kotlinxSerializationJson = "1.9.0"
ksp = "2.2.0"
lifecycleRuntimeKtx = "2.9.2"
activityCompose = "1.10.1"
composeBom = "2025.07.00"
koinBom = "4.1.0"
lifecycleRuntimeKtx = "2.9.4"
activityCompose = "1.11.0"
composeBom = "2025.09.01"
koinBom = "4.1.1"
materialIconsExtended = "1.7.8"
ksp_version = "2.2.0-2.0.2"
protobufJavalite = "4.31.1"
protobuf_version = "0.9.5"
ksp_version = "2.2.20-2.0.2"
protobufJavalite = "4.32.1"
protobuf-protoc-gen-javalite = "3.0.0"
protobuf_plugin_version = "0.9.5"

[libraries]
#core
Expand Down Expand Up @@ -59,21 +60,27 @@ koin-android-startup = { module = "io.insert-koin:koin-androidx-startup" }
# test
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version = "3.6.1" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version = "espressoCore" }
#datetime
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
# protobuf and datastore
androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "datastore" }
protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobufJavalite" }
protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "protobufJavalite" }
protobuf-protoc-compiler = { module = "com.google.protobuf:protoc", version.ref = "protobufJavalite" }
protobuf-protoc-gen-javalite = { module = "com.google.protobuf:protoc-gen-javalite", version.ref = "protobuf-protoc-gen-javalite" }
# kotlinx serialization
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }


[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
google_devtools_ksp = { id = "com.google.devtools.ksp", version.ref = "ksp_version" }
google_protobuf = { id = "com.google.protobuf", version.ref = "protobuf_version" }
google_protobuf = { id = "com.google.protobuf", version.ref = "protobuf_plugin_version" }
kotlinx_serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

[bundles]
compose = ["androidx-ui", "androidx-ui-graphics", "androidx-ui-tooling-preview", "androidx-material3", "androidx-material-icons-extended"]
koin = ["koin-core", "koin-compose", "koin-android-startup", "koin-android"]
kotlinx = ["kotlinx-collections-immutable", "kotlinx-datetime", "kotlinx-serialization-json"]
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Mar 31 20:03:44 IST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading