From 1d2809de7079c9c893a64475f30e08c6348fba41 Mon Sep 17 00:00:00 2001 From: Manuel Fuhr Date: Sun, 24 Apr 2022 14:25:12 +0200 Subject: [PATCH] Silent code cleanup --- .../main/java/btools/routingapp/BRouterActivity.java | 2 +- .../src/main/java/btools/routingapp/BRouterView.java | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java index a03f65d..e4862da 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java @@ -65,7 +65,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat private Set selectedVias; private List nogoList; private String maptoolDirCandidate; - private Set dialogIds = new HashSet(); + private final Set dialogIds = new HashSet(); private String errorMessage; private String title; private int wpCount; diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index 4fcdc10..df787c3 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -80,7 +80,7 @@ public class BRouterView extends View { private long lastDataTime = System.currentTimeMillis(); private CoordinateReader cor; private int[] imgPixels; - private int memoryClass; + private final int memoryClass; private long lastTs = System.currentTimeMillis(); private long startTime = 0L; @@ -203,10 +203,7 @@ public class BRouterView extends View { int deviceLevel = Build.VERSION.SDK_INT; int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion; - canAccessSdCard = true; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && !Environment.isExternalStorageLegacy()) { - canAccessSdCard = false; - } + canAccessSdCard = Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || Environment.isExternalStorageLegacy(); if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { canAccessSdCard = false; } @@ -393,7 +390,7 @@ public class BRouterView extends View { try { cor.readAllPoints(); } catch (Exception e) { - msg = "Error reading waypoints: " + e.toString(); + msg = "Error reading waypoints: " + e; } int size = cor.allpoints.size(); @@ -962,7 +959,7 @@ public class BRouterView extends View { for (ServiceModeConfig smc : map.values()) { bw.write(smc.toLine()); bw.write('\n'); - msg.append(smc.toString()).append('\n'); + msg.append(smc).append('\n'); } } catch (Exception e) { } finally {