From 1f973a7c889aea26fecb8ca29813b0078f67743b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=AD?= <mvdan@mvdan.cc>
Date: Thu, 8 Oct 2015 17:10:57 +0200
Subject: [PATCH] checkstyle: Enable and apply AvoidNestedBlocks

---
 .../views/swap/SwapWorkflowActivity.java      | 34 ++++++++-----------
 config/checkstyle/checkstyle.xml              |  2 +-
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java
index c26b9933e..11346b7cf 100644
--- a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java
+++ b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java
@@ -747,27 +747,23 @@ public class SwapWorkflowActivity extends AppCompatActivity {
             if (service == null) {
                 message = "No swap service";
             } else {
-                {
-                    String bluetooth = service.getBluetoothSwap().isConnected() ? "Y" : " N";
-                    String wifi = service.getWifiSwap().isConnected() ? "Y" : " N";
-                    String mdns = service.getWifiSwap().getBonjour().isConnected() ? "Y" : " N";
-                    message += "Swap { BT: " + bluetooth + ", WiFi: " + wifi + ", mDNS: " + mdns + "}, ";
+                String bluetooth = service.getBluetoothSwap().isConnected() ? "Y" : " N";
+                String wifi = service.getWifiSwap().isConnected() ? "Y" : " N";
+                String mdns = service.getWifiSwap().getBonjour().isConnected() ? "Y" : " N";
+                message += "Swap { BT: " + bluetooth + ", WiFi: " + wifi + ", mDNS: " + mdns + "}, ";
+
+                BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+                bluetooth = "N/A";
+                if (adapter != null) {
+                    Map<Integer, String> scanModes = new HashMap<>(3);
+                    scanModes.put(BluetoothAdapter.SCAN_MODE_CONNECTABLE, "CON");
+                    scanModes.put(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE, "CON_DISC");
+                    scanModes.put(BluetoothAdapter.SCAN_MODE_NONE, "NONE");
+                    bluetooth = "\"" + adapter.getName() + "\" - " + scanModes.get(adapter.getScanMode());
                 }
 
-                {
-                    BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
-                    String bluetooth = "N/A";
-                    if (adapter != null) {
-                        Map<Integer, String> scanModes = new HashMap<>(3);
-                        scanModes.put(BluetoothAdapter.SCAN_MODE_CONNECTABLE, "CON");
-                        scanModes.put(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE, "CON_DISC");
-                        scanModes.put(BluetoothAdapter.SCAN_MODE_NONE, "NONE");
-                        bluetooth = "\"" + adapter.getName() + "\" - " + scanModes.get(adapter.getScanMode());
-                    }
-
-                    String wifi = service.getBonjourFinder().isScanning() ? "Y" : " N";
-                    message += "Find { BT: " + bluetooth + ", WiFi: " + wifi + "}";
-                }
+                wifi = service.getBonjourFinder().isScanning() ? "Y" : " N";
+                message += "Find { BT: " + bluetooth + ", WiFi: " + wifi + "}";
             }
 
             Date now = new Date();
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
index 8fb1856b6..f63e26379 100644
--- a/config/checkstyle/checkstyle.xml
+++ b/config/checkstyle/checkstyle.xml
@@ -49,7 +49,7 @@
         <!--<module name="ModifierOrder" />-->
         <module name="RedundantModifier" />
 
-        <!--<module name="AvoidNestedBlocks" />-->
+        <module name="AvoidNestedBlocks" />
         <!--<module name="EmptyBlock">
             <property name="option" value="text" />
         </module>-->