From 4c66199142322bd254ab174786e0e9ee6531b1fb Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 22 Nov 2017 00:53:37 +0100 Subject: [PATCH] Cleanups based on Android Studio analysis. --- .../androidaps/plugins/PumpCombo/ComboFragment.java | 2 +- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 3 --- .../nightscout/androidaps/plugins/PumpCombo/ComboPump.java | 5 ----- .../androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java | 3 --- .../plugins/PumpCombo/activities/PairingActivity.java | 6 +----- 5 files changed, 2 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java index 647bbf6515..365a4db845 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java @@ -157,7 +157,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis double bolusHoursAgo = agoMsc / 60d / 60d / 1000d; // TODO i18n if ((agoMsc < 60 * 1000)) { - lastBolusView.setText(String.format("%.1f U (now)", bolus.amount, (int) bolusMinAgo)); + lastBolusView.setText(String.format("%.1f U (now)", bolus.amount)); } else if (bolusMinAgo < 60) { lastBolusView.setText(String.format("%.1f U (%d min ago)", bolus.amount, (int) bolusMinAgo)); // lastBolusView.setText(getString(R.string.combo_last_bolus, bolus.amount, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index d40b4be56e..184a494da2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -525,7 +525,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf ConfigBuilderPlugin treatmentsInterface = MainApp.getConfigBuilder(); treatmentsInterface.addToHistoryTempBasal(tempStart); - pump.tbrSetTime = state.timestamp; MainApp.bus().post(new EventComboPumpUpdateGUI()); } @@ -632,8 +631,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf pump.lastSuccessfulCmdTime = System.currentTimeMillis(); } - pump.lastCmdResult = commandResult; - if (commandResult.success) { updateLocalData(commandResult); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java index f1054f0f8e..50cfcc42c2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java @@ -18,8 +18,6 @@ class ComboPump { boolean initialized = false; volatile long lastSuccessfulCmdTime; - @Nullable - volatile CommandResult lastCmdResult; public volatile String activity; @NonNull volatile PumpState state = new PumpState(); @@ -28,9 +26,6 @@ class ComboPump { @NonNull volatile BasalProfile basalProfile = new BasalProfile(); - /** Time the active TBR was set (if any). Needed to calculate remaining time in fragment */ - long tbrSetTime; - // Last known history record times to skip over old ones when reading history long lastHistoryBolusTime = PumpHistoryRequest.FULL; long lastHistoryTbrTime = PumpHistoryRequest.FULL; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java index c69fb5bfe5..ea06afbb25 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboTddHistoryDialog.java @@ -7,9 +7,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.text.SimpleDateFormat; import java.util.List; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/activities/PairingActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/activities/PairingActivity.java index c4456d3c8c..29e9d283ba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/activities/PairingActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/activities/PairingActivity.java @@ -100,11 +100,7 @@ public class PairingActivity extends AppCompatActivity { } mDevices.add(item); - new Handler().post(new Runnable() { - public void run() { - mListAdapter.notifyDataSetChanged(); - } - }); + new Handler().post(() -> mListAdapter.notifyDataSetChanged()); } private ScanCallback mBleScanCallback = new ScanCallback() {