From 520ca24b540a4c879db748635887963c0850f60e Mon Sep 17 00:00:00 2001 From: Anashuman Singh Date: Fri, 27 Dec 2024 22:42:34 +0530 Subject: [PATCH] fix: make Codacy happy --- app/src/main/java/io/pslab/activity/MainActivity.java | 3 +-- app/src/main/java/io/pslab/communication/PacketHandler.java | 4 ++-- app/src/main/res/values/dimens.xml | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/pslab/activity/MainActivity.java b/app/src/main/java/io/pslab/activity/MainActivity.java index bfae90792..a15250bea 100644 --- a/app/src/main/java/io/pslab/activity/MainActivity.java +++ b/app/src/main/java/io/pslab/activity/MainActivity.java @@ -104,7 +104,6 @@ public class MainActivity extends AppCompatActivity { private PendingIntent mPermissionIntent; private CommunicationHandler communicationHandler; private USBDetachReceiver usbDetachReceiver; - private WifiDisconnectReceiver wifiDisconnectReceiver; private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION"; private static final int TIME_INTERVAL = 2000; private long mBackPressed; @@ -142,7 +141,7 @@ protected void onCreate(Bundle savedInstanceState) { IntentFilter wifiDisconnectFilter = new IntentFilter(); wifiDisconnectFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); - wifiDisconnectReceiver = new WifiDisconnectReceiver(this); + WifiDisconnectReceiver wifiDisconnectReceiver = new WifiDisconnectReceiver(this); registerReceiver(wifiDisconnectReceiver, wifiDisconnectFilter); setSupportActionBar(toolbar); diff --git a/app/src/main/java/io/pslab/communication/PacketHandler.java b/app/src/main/java/io/pslab/communication/PacketHandler.java index 28d8b096d..e02eca98c 100644 --- a/app/src/main/java/io/pslab/communication/PacketHandler.java +++ b/app/src/main/java/io/pslab/communication/PacketHandler.java @@ -299,8 +299,8 @@ public void close() { } else { socketClient.closeConnection(); } - } catch (IOException e) { - throw new RuntimeException(e); + } catch (Exception e) { + Log.e(TAG, "Error closing connection"); } } } \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index ebbd05fff..4ff562cbe 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -271,7 +271,6 @@ 30dp 1dp 40dp - 20dp 20dp 60dp 8dp