Cleanups based on Android Studio analysis.

This commit is contained in:
Johannes Mockenhaupt 2017-11-22 00:53:37 +01:00
parent 8b81925ccb
commit 4c66199142
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
5 changed files with 2 additions and 17 deletions

View file

@ -157,7 +157,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
double bolusHoursAgo = agoMsc / 60d / 60d / 1000d; double bolusHoursAgo = agoMsc / 60d / 60d / 1000d;
// TODO i18n // TODO i18n
if ((agoMsc < 60 * 1000)) { 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) { } else if (bolusMinAgo < 60) {
lastBolusView.setText(String.format("%.1f U (%d min ago)", bolus.amount, (int) bolusMinAgo)); lastBolusView.setText(String.format("%.1f U (%d min ago)", bolus.amount, (int) bolusMinAgo));
// lastBolusView.setText(getString(R.string.combo_last_bolus, bolus.amount, // lastBolusView.setText(getString(R.string.combo_last_bolus, bolus.amount,

View file

@ -525,7 +525,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
ConfigBuilderPlugin treatmentsInterface = MainApp.getConfigBuilder(); ConfigBuilderPlugin treatmentsInterface = MainApp.getConfigBuilder();
treatmentsInterface.addToHistoryTempBasal(tempStart); treatmentsInterface.addToHistoryTempBasal(tempStart);
pump.tbrSetTime = state.timestamp;
MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventComboPumpUpdateGUI());
} }
@ -632,8 +631,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
pump.lastSuccessfulCmdTime = System.currentTimeMillis(); pump.lastSuccessfulCmdTime = System.currentTimeMillis();
} }
pump.lastCmdResult = commandResult;
if (commandResult.success) { if (commandResult.success) {
updateLocalData(commandResult); updateLocalData(commandResult);
} }

View file

@ -18,8 +18,6 @@ class ComboPump {
boolean initialized = false; boolean initialized = false;
volatile long lastSuccessfulCmdTime; volatile long lastSuccessfulCmdTime;
@Nullable
volatile CommandResult lastCmdResult;
public volatile String activity; public volatile String activity;
@NonNull @NonNull
volatile PumpState state = new PumpState(); volatile PumpState state = new PumpState();
@ -28,9 +26,6 @@ class ComboPump {
@NonNull @NonNull
volatile BasalProfile basalProfile = new BasalProfile(); 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 // Last known history record times to skip over old ones when reading history
long lastHistoryBolusTime = PumpHistoryRequest.FULL; long lastHistoryBolusTime = PumpHistoryRequest.FULL;
long lastHistoryTbrTime = PumpHistoryRequest.FULL; long lastHistoryTbrTime = PumpHistoryRequest.FULL;

View file

@ -7,9 +7,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.List; import java.util.List;

View file

@ -100,11 +100,7 @@ public class PairingActivity extends AppCompatActivity {
} }
mDevices.add(item); mDevices.add(item);
new Handler().post(new Runnable() { new Handler().post(() -> mListAdapter.notifyDataSetChanged());
public void run() {
mListAdapter.notifyDataSetChanged();
}
});
} }
private ScanCallback mBleScanCallback = new ScanCallback() { private ScanCallback mBleScanCallback = new ScanCallback() {