Fix comparing non-primitives.
This commit is contained in:
parent
30372897c0
commit
56423028f6
4 changed files with 12 additions and 7 deletions
|
@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.ConstraintsSafety;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
|
@ -161,17 +163,17 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
|
|||
Double origRate = absoluteRate;
|
||||
if (absoluteRate > maxBasal) {
|
||||
absoluteRate = maxBasal;
|
||||
if (Config.logConstraintsChanges && origPercentRate != Constants.basalPercentOnlyForCheckLimit)
|
||||
if (Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Limiting rate " + origRate + " by maxBasal preference to " + absoluteRate + "U/h");
|
||||
}
|
||||
if (absoluteRate > maxBasalMult * profile.getBasal()) {
|
||||
absoluteRate = Math.floor(maxBasalMult * profile.getBasal() * 100) / 100;
|
||||
if (Config.logConstraintsChanges && origPercentRate != Constants.basalPercentOnlyForCheckLimit)
|
||||
if (Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Limiting rate " + origRate + " by maxBasalMult to " + absoluteRate + "U/h");
|
||||
}
|
||||
if (absoluteRate > profile.getMaxDailyBasal() * maxBasalFromDaily) {
|
||||
absoluteRate = profile.getMaxDailyBasal() * maxBasalFromDaily;
|
||||
if (Config.logConstraintsChanges && origPercentRate != Constants.basalPercentOnlyForCheckLimit)
|
||||
if (Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Limiting rate " + origRate + " by 3 * maxDailyBasal to " + absoluteRate + "U/h");
|
||||
}
|
||||
|
||||
|
@ -180,7 +182,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
|
|||
percentRateAfterConst = Round.ceilTo((double) percentRateAfterConst, 10d).intValue();
|
||||
else percentRateAfterConst = Round.floorTo((double) percentRateAfterConst, 10d).intValue();
|
||||
|
||||
if (Config.logConstraintsChanges && origPercentRate != Constants.basalPercentOnlyForCheckLimit)
|
||||
if (Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Recalculated percent rate " + percentRate + "% to " + percentRateAfterConst + "%");
|
||||
return percentRateAfterConst;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/*
|
||||
{
|
||||
|
@ -188,7 +189,7 @@ public class NSSettingsStatus {
|
|||
return result;
|
||||
}
|
||||
}
|
||||
if (settingsO.has("alarmTimeagoWarnMins") && what == "alarmTimeagoWarnMins"){
|
||||
if (settingsO.has("alarmTimeagoWarnMins") && Objects.equals(what, "alarmTimeagoWarnMins")){
|
||||
Double result = settingsO.getDouble(what);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.crashlytics.android.answers.Answers;
|
|||
import com.crashlytics.android.answers.CustomEvent;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -86,7 +87,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
|
||||
confirmMessage += getString(R.string.bolus) + ": " + insulinAfterConstraints + "U";
|
||||
confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g";
|
||||
if (insulinAfterConstraints - insulin != 0 || carbsAfterConstraints != carbs)
|
||||
if (insulinAfterConstraints - insulin != 0 || !Objects.equals(carbsAfterConstraints, carbs))
|
||||
confirmMessage += "\n" + getString(R.string.constraintapllied);
|
||||
|
||||
final double finalInsulinAfterConstraints = insulinAfterConstraints;
|
||||
|
|
|
@ -55,6 +55,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
@ -1740,7 +1741,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
public void onBindViewHolder(NotificationsViewHolder holder, int position) {
|
||||
Notification notification = notificationsList.get(position);
|
||||
holder.dismiss.setTag(notification);
|
||||
if(notification.text == MainApp.sResources.getString(R.string.nsalarm_staledata))
|
||||
if(Objects.equals(notification.text, MainApp.sResources.getString(R.string.nsalarm_staledata)))
|
||||
holder.dismiss.setText("snooze");
|
||||
holder.text.setText(notification.text);
|
||||
holder.time.setText(DateUtil.timeString(notification.date));
|
||||
|
|
Loading…
Reference in a new issue