diff --git a/app/src/main/java/com/mazenrashed/example/MainActivity.kt b/app/src/main/java/com/mazenrashed/example/MainActivity.kt index 604cd91..1f191e8 100644 --- a/app/src/main/java/com/mazenrashed/example/MainActivity.kt +++ b/app/src/main/java/com/mazenrashed/example/MainActivity.kt @@ -81,6 +81,10 @@ class MainActivity : AppCompatActivity() { Toast.makeText(this@MainActivity, "Message: $message", Toast.LENGTH_SHORT).show() } + override fun disconnected() { + Toast.makeText(this@MainActivity, "Disconnected Printer", Toast.LENGTH_SHORT).show() + } + } } diff --git a/app/src/main/java/com/mazenrashed/example/WoosimActivity.kt b/app/src/main/java/com/mazenrashed/example/WoosimActivity.kt index f6d5b5b..19e44bb 100644 --- a/app/src/main/java/com/mazenrashed/example/WoosimActivity.kt +++ b/app/src/main/java/com/mazenrashed/example/WoosimActivity.kt @@ -72,6 +72,10 @@ class WoosimActivity : AppCompatActivity() { Toast.makeText(this@WoosimActivity, "Message: $message", Toast.LENGTH_SHORT).show() } + override fun disconnected() { + Toast.makeText(this@WoosimActivity, "Disconnected printer", Toast.LENGTH_SHORT).show() + } + } } diff --git a/printooth/src/main/java/com/mazenrashed/printooth/utilities/Printing.kt b/printooth/src/main/java/com/mazenrashed/printooth/utilities/Printing.kt index c42ffe9..4e2e399 100644 --- a/printooth/src/main/java/com/mazenrashed/printooth/utilities/Printing.kt +++ b/printooth/src/main/java/com/mazenrashed/printooth/utilities/Printing.kt @@ -44,7 +44,9 @@ class Printing(private var printer: Printer, private var pairedPrinter: PairedPr printingCallback?.printingOrderSentSuccessfully() } - override fun onDeviceDisconnected(device: BluetoothDevice, message: String) {} + override fun onDeviceDisconnected(device: BluetoothDevice, message: String) { + printingCallback?.disconnected() + } override fun onMessage(message: String) { printingCallback?.onMessage(message) diff --git a/printooth/src/main/java/com/mazenrashed/printooth/utilities/PrintingCallback.kt b/printooth/src/main/java/com/mazenrashed/printooth/utilities/PrintingCallback.kt index 77b8110..737d2f6 100644 --- a/printooth/src/main/java/com/mazenrashed/printooth/utilities/PrintingCallback.kt +++ b/printooth/src/main/java/com/mazenrashed/printooth/utilities/PrintingCallback.kt @@ -6,4 +6,5 @@ interface PrintingCallback { fun connectionFailed(error: String) fun onError(error: String) fun onMessage(message: String) + fun disconnected() } \ No newline at end of file