Skip to content

Commit

Permalink
Added Callback Interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrudu committed Jun 25, 2024
1 parent 78ca788 commit 3a30d76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions PrintWrapper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
defaultConfig {
minSdkVersion 25
targetSdkVersion 33
versionCode 7
versionName "1.6"
versionCode 9
versionName "1.8"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import com.zebra.sdk.printer.discovery.DiscoveredPrinter;

public class GetPrinterStatusTask extends ExecutorTask<DiscoveredPrinter, Boolean, PrinterStatus>{
public PrinterStatus printerStatus = null;

public interface GetPrinterStatusTaskCallback
{
void onPrinterStatus(PrinterStatus status);
}

GetPrinterStatusTaskCallback getPrinterStatusTaskCallback = null;

@Override
protected PrinterStatus doInBackground(DiscoveredPrinter... printerParams) {
Expand Down Expand Up @@ -47,7 +53,15 @@ protected PrinterStatus doInBackground(DiscoveredPrinter... printerParams) {

@Override
protected void onPostExecute(PrinterStatus printerStatus) {
if(getPrinterStatusTaskCallback != null)
{
getPrinterStatusTaskCallback.onPrinterStatus(printerStatus);
}
super.onPostExecute(printerStatus);
this.printerStatus = printerStatus;
}

public void setGetPrinterStatusTaskCallback(GetPrinterStatusTaskCallback getPrinterStatusTaskCallback)
{
this.getPrinterStatusTaskCallback = getPrinterStatusTaskCallback;
}
}

0 comments on commit 3a30d76

Please sign in to comment.