From ce8bcdf495631fb2e8fdcce856f0eefb23cc7a1c Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Mon, 12 Nov 2018 14:07:50 +0100 Subject: [PATCH] Annotations added --- .../nrftoolbox/gls/GlucoseActivity.java | 2 +- .../BleProfileExpandableListActivity.java | 28 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/no/nordicsemi/android/nrftoolbox/gls/GlucoseActivity.java b/app/src/main/java/no/nordicsemi/android/nrftoolbox/gls/GlucoseActivity.java index f73a33ca..a55390ae 100644 --- a/app/src/main/java/no/nordicsemi/android/nrftoolbox/gls/GlucoseActivity.java +++ b/app/src/main/java/no/nordicsemi/android/nrftoolbox/gls/GlucoseActivity.java @@ -139,7 +139,7 @@ public class GlucoseActivity extends BleProfileExpandableListActivity implements } @Override - public void onDeviceDisconnected(final BluetoothDevice device) { + public void onDeviceDisconnected(@NonNull final BluetoothDevice device) { super.onDeviceDisconnected(device); setOperationInProgress(false); runOnUiThread(() -> mBatteryLevelView.setText(R.string.not_available)); diff --git a/app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleProfileExpandableListActivity.java b/app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleProfileExpandableListActivity.java index 2a2b957e..2a52ea09 100644 --- a/app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleProfileExpandableListActivity.java +++ b/app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleProfileExpandableListActivity.java @@ -50,6 +50,7 @@ import no.nordicsemi.android.nrftoolbox.app.ExpandableListActivity; import no.nordicsemi.android.nrftoolbox.scanner.ScannerFragment; import no.nordicsemi.android.nrftoolbox.utility.DebugLogger; +@SuppressWarnings("unused") public abstract class BleProfileExpandableListActivity extends ExpandableListActivity implements BleManagerCallbacks, ScannerFragment.OnDeviceSelectedListener { private static final String TAG = "BaseProfileActivity"; @@ -100,6 +101,7 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct /** * You may do some initialization here. This method is called from {@link #onCreate(Bundle)} before the view was created. */ + @SuppressWarnings("unused") protected void onInitialize(final Bundle savedInstanceState) { // empty default implementation } @@ -119,6 +121,7 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct * @param savedInstanceState contains the data it most recently supplied in {@link #onSaveInstanceState(Bundle)}. * Note: Otherwise it is null. */ + @SuppressWarnings("unused") protected void onViewCreated(final Bundle savedInstanceState) { // empty default implementation } @@ -171,6 +174,7 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct * @param itemId the menu item id * @return true if action has been handled */ + @SuppressWarnings("unused") protected boolean onOptionsItemSelected(final int itemId) { // Overwrite when using menu other than R.menu.help return false; @@ -260,7 +264,7 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct } @Override - public void onDeviceConnecting(final BluetoothDevice device) { + public void onDeviceConnecting(@NonNull final BluetoothDevice device) { runOnUiThread(() -> { mDeviceNameView.setText(mDeviceName != null ? mDeviceName : getString(R.string.not_available)); mConnectButton.setText(R.string.action_connecting); @@ -268,18 +272,18 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct } @Override - public void onDeviceConnected(final BluetoothDevice device) { + public void onDeviceConnected(@NonNull final BluetoothDevice device) { mDeviceConnected = true; runOnUiThread(() -> mConnectButton.setText(R.string.action_disconnect)); } @Override - public void onDeviceDisconnecting(final BluetoothDevice device) { + public void onDeviceDisconnecting(@NonNull final BluetoothDevice device) { runOnUiThread(() -> mConnectButton.setText(R.string.action_disconnecting)); } @Override - public void onDeviceDisconnected(final BluetoothDevice device) { + public void onDeviceDisconnected(@NonNull final BluetoothDevice device) { mDeviceConnected = false; mBleManager.close(); runOnUiThread(() -> { @@ -289,43 +293,43 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct } @Override - public void onLinkLossOccurred(final BluetoothDevice device) { + public void onLinkLossOccurred(@NonNull final BluetoothDevice device) { mDeviceConnected = false; } @Override - public void onServicesDiscovered(final BluetoothDevice device, boolean optionalServicesFound) { + public void onServicesDiscovered(@NonNull final BluetoothDevice device, boolean optionalServicesFound) { // this may notify user or show some views } @Override - public void onDeviceReady(final BluetoothDevice device) { + public void onDeviceReady(@NonNull final BluetoothDevice device) { // empty default implementation } @Override - public void onBondingRequired(final BluetoothDevice device) { + public void onBondingRequired(@NonNull final BluetoothDevice device) { showToast(R.string.bonding); } @Override - public void onBonded(final BluetoothDevice device) { + public void onBonded(@NonNull final BluetoothDevice device) { showToast(R.string.bonded); } @Override - public void onBondingFailed(final BluetoothDevice device) { + public void onBondingFailed(@NonNull final BluetoothDevice device) { showToast(R.string.bonding_failed); } @Override - public void onError(final BluetoothDevice device, final String message, final int errorCode) { + public void onError(@NonNull final BluetoothDevice device, @NonNull final String message, final int errorCode) { DebugLogger.e(TAG, "Error occurred: " + message + ", error code: " + errorCode); showToast(message + " (" + errorCode + ")"); } @Override - public void onDeviceNotSupported(final BluetoothDevice device) { + public void onDeviceNotSupported(@NonNull final BluetoothDevice device) { showToast(R.string.not_supported); }