Skip to content

Commit

Permalink
v2.0.10 : annotations @nullable added
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck ALARY committed Feb 12, 2021
1 parent 9082adb commit 6c71109
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.dantsu.escposprinter.connection.bluetooth;

import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;

import androidx.annotation.Nullable;

import java.util.Set;

public class BluetoothConnections {
Expand All @@ -19,6 +22,8 @@ public BluetoothConnections() {
* Get a list of bluetooth devices available.
* @return Return an array of BluetoothConnection instance
*/
@SuppressLint("MissingPermission")
@Nullable
public BluetoothConnection[] getList() {
if (this.bluetoothAdapter == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;

import androidx.annotation.Nullable;

import com.dantsu.escposprinter.exceptions.EscPosConnectionException;

public class BluetoothPrintersConnections extends BluetoothConnections {
Expand All @@ -13,6 +15,7 @@ public class BluetoothPrintersConnections extends BluetoothConnections {
*
* @return a EscPosPrinterCommands instance
*/
@Nullable
public static BluetoothConnection selectFirstPaired() {
BluetoothPrintersConnections printers = new BluetoothPrintersConnections();
BluetoothConnection[] bluetoothPrinters = printers.getList();
Expand All @@ -36,6 +39,7 @@ public static BluetoothConnection selectFirstPaired() {
* @return an array of EscPosPrinterCommands
*/
@SuppressLint("MissingPermission")
@Nullable
public BluetoothConnection[] getList() {
BluetoothConnection[] bluetoothDevicesList = super.getList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;

import androidx.annotation.Nullable;

import java.util.Collection;

public class UsbConnections {
Expand All @@ -22,6 +24,7 @@ public UsbConnections(Context context) {
* Get a list of USB devices available.
* @return Return an array of UsbConnection instance
*/
@Nullable
public UsbConnection[] getList() {
if (this.usbManager == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;

import androidx.annotation.Nullable;

public class UsbDeviceHelper {
/**
* Find the correct USB interface for printing
*
* @param usbDevice USB device
* @return correct USB interface for printing, null if not found
*/
@Nullable
static public UsbInterface findPrinterInterface(UsbDevice usbDevice) {
if (usbDevice == null) {
return null;
Expand All @@ -32,6 +35,7 @@ static public UsbInterface findPrinterInterface(UsbDevice usbDevice) {
* @param usbInterface USB interface
* @return Input endpoint or null if not found
*/
@Nullable
static public UsbEndpoint findEndpointIn(UsbInterface usbInterface) {
if (usbInterface != null) {
int endpointsCount = usbInterface.getEndpointCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;

import androidx.annotation.Nullable;

import com.dantsu.escposprinter.exceptions.EscPosConnectionException;

public class UsbPrintersConnections extends UsbConnections {
Expand All @@ -22,6 +24,7 @@ public UsbPrintersConnections(Context context) {
*
* @return a UsbConnection instance
*/
@Nullable
public static UsbConnection selectFirstConnected(Context context) {
UsbPrintersConnections printers = new UsbPrintersConnections(context);
UsbConnection[] bluetoothPrinters = printers.getList();
Expand All @@ -39,6 +42,7 @@ public static UsbConnection selectFirstConnected(Context context) {
*
* @return an array of UsbConnection
*/
@Nullable
public UsbConnection[] getList() {
UsbConnection[] usbConnections = super.getList();

Expand Down

0 comments on commit 6c71109

Please sign in to comment.