Skip to content

Commit

Permalink
Merge pull request #12 from Dilivva/development
Browse files Browse the repository at this point in the history
Downgrade the minimum sdk to 23
  • Loading branch information
ayodelekehinde authored Aug 7, 2024
2 parents c5753f4 + 6a6575a commit dc78c34
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![badge](https://camo.githubusercontent.com/8ce65a3be14c94be47bceb832f55e376253dde249232136976baacb38b85438c/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d616e64726f69642d3645444238442e7376673f7374796c653d666c6174)
![badge](https://camo.githubusercontent.com/549a60a8c72c6b9ad3229b3d45dbf8cbd0f2bc9493b95463b2004b3546a36923/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d696f732d4344434443442e7376673f7374796c653d666c6174)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/Dilivva/Blueline)](https://github.com/Dilivva/Blueline/releases)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.dilivva/blueline/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.dilivva/blueline)
[![Maven Central](https://img.shields.io/maven-central/v/com.dilivva/blueline.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.dilivva%22%20AND%20a:%22blueline%22)

# BlueLine

Expand Down
37 changes: 20 additions & 17 deletions composeApp/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -36,6 +37,7 @@ import com.dilivva.blueline.builder.buildPrintData
import com.dilivva.blueline.connection.bluetooth.BlueLine
import com.dilivva.blueline.connection.bluetooth.ConnectionError
import com.dilivva.blueline.connection.bluetooth.ConnectionState
import escposprinter.composeapp.generated.resources.Res
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
Expand Down Expand Up @@ -143,11 +145,11 @@ fun ConnectionItem(
var image by remember { mutableStateOf<ImageBitmap?>(null) }
var imageBytes by remember { mutableStateOf(byteArrayOf()) }

// LaunchedEffect(Unit){
// val bytes = Res.readBytes("drawable/label.png")
// imageBytes = bytes
// image = getPlatform().toImage(bytes)
// }
LaunchedEffect(Unit){
val bytes = Res.readBytes("drawable/label.png")
imageBytes = bytes
image = getPlatform().toImage(bytes)
}

Box(
modifier = Modifier.fillMaxWidth().padding(20.dp)
Expand Down Expand Up @@ -213,13 +215,14 @@ fun ConnectionItem(
){
Button(
onClick = {
val (data, preview) = textPrint(imageBytes)
preview?.let {
image = getPlatform().toImage(it)
val toPrint = buildPrintData {
appendImage {
this.imageBytes = imageBytes
}
}
connection.print(data)
connection.print(toPrint.first)
},
enabled = connectionState.canPrint && connectionState.isConnected && !connectionState.isPrinting
enabled = connectionState.canPrint && connectionState.isConnected && !connectionState.isPrinting
){
Text("Print")
}
Expand All @@ -228,13 +231,13 @@ fun ConnectionItem(
}
}

// image?.let {
// Image(
// bitmap = it,
// contentDescription = null,
// modifier = Modifier.fillMaxWidth()
// )
// }
image?.let {
Image(
bitmap = it,
contentDescription = null,
modifier = Modifier.fillMaxWidth()
)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
agp = "8.1.4"
android-compileSdk = "34"
android-minSdk = "26"
android-minSdk = "23"
android-targetSdk = "34"
androidx-activityCompose = "1.8.0"
androidx-appcompat = "1.6.1"
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
@Suppress("UnstableApiUsage")
mavenPublishing {
publishToMavenCentral(SonatypeHost.S01, true)
val versionTxt = "0.0.8"
val versionTxt = "1.0.0"
val isDev = findProperty("env")?.equals("dev") ?: false
val version = if (isDev) "0.0.1-SNAPSHOT" else versionTxt

Expand Down

0 comments on commit dc78c34

Please sign in to comment.