add StateListener action

This commit is contained in:
Jay 2017-08-23 22:31:59 +08:00
parent 7df8649e47
commit fff5b4a29c

View File

@ -248,6 +248,9 @@ public class PrinterBle {
}
mState = CONNECTING;
if(this.mStateListener != null) {
this.mStateListener.onChange(mState);
}
}
public void stopScan() {
@ -260,7 +263,12 @@ public class PrinterBle {
mAdapter.stopLeScan(mLeScanCB);
}
if (mState == CONNECTING) mState = DISCONNECTED;
if (mState == CONNECTING) {
mState = DISCONNECTED;
if(this.mStateListener != null) {
this.mStateListener.onChange(mState);
}
}
}
/**
@ -390,13 +398,13 @@ public class PrinterBle {
default:
return this;
}
addText("__a" + strAlign + "__");
addText("__&a" + strAlign + "__");
return this;
}
public void setSize(int w, int h) {
if (w < 1 || h < 1 || w > 3 || h > 3) return;
addText(String.format("__s%d,%d__", w, h));
addText(String.format("__&s%d,%d__", w, h));
}
public void resetSize() {