Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ldavidsp committed Dec 23, 2023
1 parent 33d13bb commit 09f7e9a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class MainActivity : AppCompatActivity() {
printable.add(TextPrintable.Builder().setCenter("Jose David Solorzano").setNewLine())


HomeflowPrinter(this@MainActivity, printable).printBluetooth()
HomeflowPrinter(this@MainActivity, printable).printAsyncBlueTooth()
}

printerPermission()
Expand Down
4 changes: 2 additions & 2 deletions printer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
id 'maven-publish'
}

def libraryVersionCode = 210
def libraryVersionName = "2.1.0"
def libraryVersionCode = 220
def libraryVersionName = "2.2.0"

android {
compileSdk 34
Expand Down
18 changes: 18 additions & 0 deletions printer/src/main/java/com/homeflow/printer/HomeflowPrinter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ class HomeflowPrinter(private var mActivity: Activity, private var printables: M
printer.disconnectPrinter()
}

/**
* Print async bluetooth.
*/
fun printAsyncBlueTooth() {
Thread {
try {
val printer = EscPosPrinter(BluetoothPrintersConnections.selectFirstPaired(), 203, 48f, 32)
printer.printFormattedText(rows(printables))
} catch (e: Exception) {
e.printStackTrace()
}
}.start()
}

fun printAsyncBlueTooth2() {
//val printer = AsyncEscPosPrinter(printerConnection, 203, 48f, 32)
}

/**
* Print USB
*/
Expand Down

0 comments on commit 09f7e9a

Please sign in to comment.