Skip to content

Commit 6c71109

Browse files
committed
v2.0.10 : annotations @nullable added
1 parent 9082adb commit 6c71109

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothConnections.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.dantsu.escposprinter.connection.bluetooth;
22

3+
import android.annotation.SuppressLint;
34
import android.bluetooth.BluetoothAdapter;
45
import android.bluetooth.BluetoothDevice;
56

7+
import androidx.annotation.Nullable;
8+
69
import java.util.Set;
710

811
public class BluetoothConnections {
@@ -19,6 +22,8 @@ public BluetoothConnections() {
1922
* Get a list of bluetooth devices available.
2023
* @return Return an array of BluetoothConnection instance
2124
*/
25+
@SuppressLint("MissingPermission")
26+
@Nullable
2227
public BluetoothConnection[] getList() {
2328
if (this.bluetoothAdapter == null) {
2429
return null;

escposprinter/src/main/java/com/dantsu/escposprinter/connection/bluetooth/BluetoothPrintersConnections.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.bluetooth.BluetoothClass;
55
import android.bluetooth.BluetoothDevice;
66

7+
import androidx.annotation.Nullable;
8+
79
import com.dantsu.escposprinter.exceptions.EscPosConnectionException;
810

911
public class BluetoothPrintersConnections extends BluetoothConnections {
@@ -13,6 +15,7 @@ public class BluetoothPrintersConnections extends BluetoothConnections {
1315
*
1416
* @return a EscPosPrinterCommands instance
1517
*/
18+
@Nullable
1619
public static BluetoothConnection selectFirstPaired() {
1720
BluetoothPrintersConnections printers = new BluetoothPrintersConnections();
1821
BluetoothConnection[] bluetoothPrinters = printers.getList();
@@ -36,6 +39,7 @@ public static BluetoothConnection selectFirstPaired() {
3639
* @return an array of EscPosPrinterCommands
3740
*/
3841
@SuppressLint("MissingPermission")
42+
@Nullable
3943
public BluetoothConnection[] getList() {
4044
BluetoothConnection[] bluetoothDevicesList = super.getList();
4145

escposprinter/src/main/java/com/dantsu/escposprinter/connection/usb/UsbConnections.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.hardware.usb.UsbDevice;
55
import android.hardware.usb.UsbManager;
66

7+
import androidx.annotation.Nullable;
8+
79
import java.util.Collection;
810

911
public class UsbConnections {
@@ -22,6 +24,7 @@ public UsbConnections(Context context) {
2224
* Get a list of USB devices available.
2325
* @return Return an array of UsbConnection instance
2426
*/
27+
@Nullable
2528
public UsbConnection[] getList() {
2629
if (this.usbManager == null) {
2730
return null;

escposprinter/src/main/java/com/dantsu/escposprinter/connection/usb/UsbDeviceHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
import android.hardware.usb.UsbEndpoint;
66
import android.hardware.usb.UsbInterface;
77

8+
import androidx.annotation.Nullable;
9+
810
public class UsbDeviceHelper {
911
/**
1012
* Find the correct USB interface for printing
1113
*
1214
* @param usbDevice USB device
1315
* @return correct USB interface for printing, null if not found
1416
*/
17+
@Nullable
1518
static public UsbInterface findPrinterInterface(UsbDevice usbDevice) {
1619
if (usbDevice == null) {
1720
return null;
@@ -32,6 +35,7 @@ static public UsbInterface findPrinterInterface(UsbDevice usbDevice) {
3235
* @param usbInterface USB interface
3336
* @return Input endpoint or null if not found
3437
*/
38+
@Nullable
3539
static public UsbEndpoint findEndpointIn(UsbInterface usbInterface) {
3640
if (usbInterface != null) {
3741
int endpointsCount = usbInterface.getEndpointCount();

escposprinter/src/main/java/com/dantsu/escposprinter/connection/usb/UsbPrintersConnections.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.hardware.usb.UsbConstants;
55
import android.hardware.usb.UsbDevice;
66

7+
import androidx.annotation.Nullable;
8+
79
import com.dantsu.escposprinter.exceptions.EscPosConnectionException;
810

911
public class UsbPrintersConnections extends UsbConnections {
@@ -22,6 +24,7 @@ public UsbPrintersConnections(Context context) {
2224
*
2325
* @return a UsbConnection instance
2426
*/
27+
@Nullable
2528
public static UsbConnection selectFirstConnected(Context context) {
2629
UsbPrintersConnections printers = new UsbPrintersConnections(context);
2730
UsbConnection[] bluetoothPrinters = printers.getList();
@@ -39,6 +42,7 @@ public static UsbConnection selectFirstConnected(Context context) {
3942
*
4043
* @return an array of UsbConnection
4144
*/
45+
@Nullable
4246
public UsbConnection[] getList() {
4347
UsbConnection[] usbConnections = super.getList();
4448

0 commit comments

Comments
 (0)