some more cleanup in usb classes

This commit is contained in:
Vincent Breitmoser
2017-10-08 02:05:29 +02:00
parent 31da4c450d
commit 6cc058e25f
6 changed files with 185 additions and 179 deletions

View File

@@ -112,21 +112,26 @@ public abstract class BaseSecurityTokenActivity extends BaseActivity
onSecurityTokenError(error);
}
public void tagDiscovered(final Tag tag) {
public void tagDiscovered(Tag tag) {
// Actual NFC operations are executed in doInBackground to not block the UI thread
if (!mTagHandlingEnabled)
if (!mTagHandlingEnabled) {
return;
}
securityTokenDiscovered(new NfcTransport(tag));
NfcTransport nfcTransport = new NfcTransport(tag);
securityTokenDiscovered(nfcTransport);
}
public void usbDeviceDiscovered(final UsbDevice usbDevice) {
public void usbDeviceDiscovered(UsbDevice usbDevice) {
// Actual USB operations are executed in doInBackground to not block the UI thread
if (!mTagHandlingEnabled)
if (!mTagHandlingEnabled) {
return;
}
UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
securityTokenDiscovered(new UsbTransport(usbDevice, usbManager));
UsbTransport usbTransport = new UsbTransport(usbDevice, usbManager);
securityTokenDiscovered(usbTransport);
}
public void securityTokenDiscovered(final Transport transport) {