diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/G5Model/TransmitterTimeRxMessage.java b/app/src/main/java/com/eveningoutpost/dexdrip/G5Model/TransmitterTimeRxMessage.java index ac824b2049..38fe2bde3d 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/G5Model/TransmitterTimeRxMessage.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/G5Model/TransmitterTimeRxMessage.java @@ -37,7 +37,7 @@ public boolean sessionInProgress() { } public long getRealSessionStartTime(long now) { - return now - ((currentTime - sessionStartTime) * 1000); + return now - ((currentTime - sessionStartTime) * 1000L); } public long getRealSessionStartTime() { diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/StopSensor.java b/app/src/main/java/com/eveningoutpost/dexdrip/StopSensor.java index a0c5957fdb..8cd689a9ec 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/StopSensor.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/StopSensor.java @@ -16,7 +16,11 @@ import com.eveningoutpost.dexdrip.UtilityModels.Inevitable; import com.eveningoutpost.dexdrip.UtilityModels.NanoStatus; import com.eveningoutpost.dexdrip.calibrations.PluggableCalibration; +import com.eveningoutpost.dexdrip.ui.dialog.GenericConfirmDialog; import com.eveningoutpost.dexdrip.utils.ActivityWithMenu; + +import lombok.val; + import static com.eveningoutpost.dexdrip.xdrip.gs; public class StopSensor extends ActivityWithMenu { @@ -43,17 +47,13 @@ public String getMenuName() { } public void addListenerOnButton() { - button = (Button)findViewById(R.id.stop_sensor); - - button.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - stop(); - JoH.startActivity(Home.class); - finish(); - } - - }); + val activity = this; + button.setOnClickListener(v -> GenericConfirmDialog.show(activity, gs(R.string.are_you_sure), "Do you want to stop this sensor session?", () -> { + stop(); + JoH.startActivity(Home.class); + finish(); + })); } public synchronized static void stop() {