format code
This commit is contained in:
parent
dca769861e
commit
a4c214c1db
@ -38,15 +38,15 @@ class MainActivity : Activity() {
|
||||
|
||||
ble?.setOnStateChangeListener {
|
||||
System.out.println("Now State is >>>> " + it)
|
||||
if(it == PrinterBle.CONNECTING) {
|
||||
if (it == PrinterBle.CONNECTING) {
|
||||
disconnectBtn.isEnabled = true
|
||||
}
|
||||
if(it == PrinterBle.CONNECTED) {
|
||||
if (it == PrinterBle.CONNECTED) {
|
||||
btn.isEnabled = true
|
||||
connectBtn.isEnabled = false
|
||||
disconnectBtn.isEnabled = true
|
||||
}
|
||||
if(it == PrinterBle.DISCONNECTED) {
|
||||
if (it == PrinterBle.DISCONNECTED) {
|
||||
btn.isEnabled = false
|
||||
connectBtn.isEnabled = true
|
||||
disconnectBtn.isEnabled = false
|
||||
@ -65,7 +65,7 @@ class MainActivity : Activity() {
|
||||
btn.setOnClickListener {
|
||||
val txt: String = intxt.text.toString()
|
||||
ble?.setAlign(PrinterBle.ALIGN_CENTER)?.addText(txt)
|
||||
ble?.sendQueue()
|
||||
ble?.sendQueue()
|
||||
}
|
||||
|
||||
connectBtn.setOnClickListener {
|
||||
@ -86,16 +86,16 @@ class MainActivity : Activity() {
|
||||
}
|
||||
|
||||
fun scanConnect() {
|
||||
if(ble?.init()!!){
|
||||
if (ble?.init()!!) {
|
||||
ble?.startScan()
|
||||
}
|
||||
}
|
||||
|
||||
fun disconnect() {
|
||||
if(ble?.mState!! == PrinterBle.SCANNING) {
|
||||
if (ble?.mState!! == PrinterBle.SCANNING) {
|
||||
ble?.stopScan()
|
||||
}
|
||||
if(ble?.mState!! == PrinterBle.CONNECTED) {
|
||||
if (ble?.mState!! == PrinterBle.CONNECTED) {
|
||||
ble?.disconnect()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user