diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index 5da167b74b..57b39e4622 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -372,7 +372,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang if (sp.getString(pref.key, "").startsWith("hmac:")) { pref.summary = "******" } else { - if (pref.getKey().contains("pin")) { + if (pref.key.contains("pin")) { pref.summary = rh.gs(R.string.pin_not_set) }else { pref.summary = rh.gs(R.string.password_not_set) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt index ed149949a0..60f0f5006a 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt @@ -65,7 +65,7 @@ class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompa } override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.getItemId()) { + when (item.itemId) { android.R.id.home -> { onBackPressed() return true diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalResultSMB.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalResultSMB.kt index ecef4ad3aa..d45fbfe26c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalResultSMB.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalResultSMB.kt @@ -51,7 +51,7 @@ class DetermineBasalResultSMB private constructor(injector: HasAndroidInjector) aapsLogger.error(LTag.APS, "Error parsing 'deliverAt' date: $date", e) } } - if (result.has("variable_sens")) variableSens = result.getDouble("variable_sens"); + if (result.has("variable_sens")) variableSens = result.getDouble("variable_sens") } catch (e: JSONException) { aapsLogger.error(LTag.APS, "Error parsing determine-basal result JSON", e) } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/SendToDataLayerThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/SendToDataLayerThread.java index ee4c30e0d1..0852b0a6aa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/SendToDataLayerThread.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/SendToDataLayerThread.java @@ -120,7 +120,7 @@ class SendToDataLayerThread extends AsyncTask { } state = 0; } catch (Exception e) { - Log.e(TAG, logPrefix + "Got exception in sendToWear: " + e.toString()); + Log.e(TAG, logPrefix + "Got exception in sendToWear: " + e); } finally { lastlock = 0; lock.unlock(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt index d7991a6707..0262343266 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt @@ -574,17 +574,17 @@ class IobCobCalculatorPlugin @Inject constructor( override fun getTempBasalIncludingConvertedExtended(timestamp: Long): TemporaryBasal? { val tb = repository.getTemporaryBasalActiveAt(timestamp).blockingGet() if (tb is ValueWrapper.Existing) return tb.value - return getConvertedExtended(timestamp); + return getConvertedExtended(timestamp) } override fun getTempBasalIncludingConvertedExtendedForRange(startTime: Long, endTime: Long, calculationStep: Long): Map { - val tempBasals = HashMap(); + val tempBasals = HashMap() val tbs = repository.getTemporaryBasalsDataActiveBetweenTimeAndTime(startTime, endTime).blockingGet() for (t in startTime until endTime step calculationStep) { val tb = tbs.firstOrNull { basal -> basal.timestamp <= t && (basal.timestamp + basal.duration) > t } tempBasals[t] = tb ?: getConvertedExtended(t) } - return tempBasals; + return tempBasals } override fun calculateAbsoluteIobFromBaseBasals(toTime: Long): IobTotal { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.kt index 1eb807dbfc..ea85e983b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/virtual/VirtualPumpFragment.kt @@ -52,10 +52,6 @@ class VirtualPumpFragment : DaggerFragment() { return binding.root } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - } - @Synchronized override fun onResume() { super.onResume() diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java index d3f03ac6a2..b5dfb4044d 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/ReadHistoryCommand.java @@ -109,25 +109,25 @@ public class ReadHistoryCommand extends BaseCommand { if (!history.bolusHistory.isEmpty()) { aapsLogger.debug(LTag.PUMP, "Read bolus history (" + history.bolusHistory.size() + "):"); for (Bolus bolus : history.bolusHistory) { - aapsLogger.debug(LTag.PUMP, new Date(bolus.timestamp) + ": " + bolus.toString()); + aapsLogger.debug(LTag.PUMP, new Date(bolus.timestamp) + ": " + bolus); } } if (!history.pumpAlertHistory.isEmpty()) { aapsLogger.debug(LTag.PUMP, "Read error history (" + history.pumpAlertHistory.size() + "):"); for (PumpAlert pumpAlert : history.pumpAlertHistory) { - aapsLogger.debug(LTag.PUMP, new Date(pumpAlert.timestamp) + ": " + pumpAlert.toString()); + aapsLogger.debug(LTag.PUMP, new Date(pumpAlert.timestamp) + ": " + pumpAlert); } } if (!history.tddHistory.isEmpty()) { aapsLogger.debug(LTag.PUMP, "Read TDD history (" + history.tddHistory.size() + "):"); for (Tdd tdd : history.tddHistory) { - aapsLogger.debug(LTag.PUMP, new Date(tdd.timestamp) + ": " + tdd.toString()); + aapsLogger.debug(LTag.PUMP, new Date(tdd.timestamp) + ": " + tdd); } } if (!history.tbrHistory.isEmpty()) { aapsLogger.debug(LTag.PUMP, "Read TBR history (" + history.tbrHistory.size() + "):"); for (Tbr tbr : history.tbrHistory) { - aapsLogger.debug(LTag.PUMP, new Date(tbr.timestamp) + ": " + tbr.toString()); + aapsLogger.debug(LTag.PUMP, new Date(tbr.timestamp) + ": " + tbr); } } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/PointsWithLabelGraphSeries.java b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/PointsWithLabelGraphSeries.java index 4067810b2c..1a657c01c2 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/PointsWithLabelGraphSeries.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/PointsWithLabelGraphSeries.java @@ -163,10 +163,8 @@ public class PointsWithLabelGraphSeries e double x = graphWidth * ratX; // overdraw - boolean overdraw = false; - if (x > graphWidth) { // end right - overdraw = true; - } + boolean overdraw = x > graphWidth; + // end right if (y < 0) { // end bottom overdraw = true; } diff --git a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt index 71c991a928..e90d6aa675 100644 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt +++ b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryDataUTest.kt @@ -57,7 +57,7 @@ class MedtronicHistoryDataUTest : TestBase() { val fileText = ClassLoader.getSystemResource("tbr_data.json").readText() - val listType: Type = object : TypeToken?>() {}.getType() + val listType: Type = object : TypeToken?>() {}.type val yourClassList: MutableList = gson.fromJson(fileText, listType) for (pumpHistoryEntry in yourClassList) { @@ -100,7 +100,7 @@ class MedtronicHistoryDataUTest : TestBase() { val fileText = ClassLoader.getSystemResource("tbr_data_special.json").readText() - val listType: Type = object : TypeToken?>() {}.getType() + val listType: Type = object : TypeToken?>() {}.type val yourClassList: MutableList = gson.fromJson(fileText, listType) for (pumpHistoryEntry in yourClassList) { diff --git a/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt b/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt index b441accbc1..29a44e961d 100644 --- a/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt +++ b/omnipod-eros/src/androidTest/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/history/ErosHistoryTest.kt @@ -34,7 +34,7 @@ class ErosHistoryTest { @Test fun testInsertionAndRetrieval() { - var history = erosHistory.getAllErosHistoryRecordsFromTimestamp(0L); + var history = erosHistory.getAllErosHistoryRecordsFromTimestamp(0L) assert(history.isEmpty()) val type = PodHistoryEntryType.SET_BOLUS.code.toLong() @@ -42,7 +42,7 @@ class ErosHistoryTest { erosHistory.create(entity) erosHistory.create(ErosHistoryRecordEntity(3000L, PodHistoryEntryType.CANCEL_BOLUS.code.toLong())) - history = erosHistory.getAllErosHistoryRecordsFromTimestamp(0L); + history = erosHistory.getAllErosHistoryRecordsFromTimestamp(0L) assert(history.size == 2) assert(type.equals(history.first().podEntryTypeCode)) diff --git a/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt b/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt index 3061e9566a..019b217aea 100644 --- a/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt +++ b/pump-common/src/main/java/info/nightscout/androidaps/plugins/pump/common/sync/PumpDbEntry.kt @@ -67,10 +67,7 @@ data class PumpDbEntryBolus(override var temporaryId: Long, detailedBolusInfo: DetailedBolusInfo) : this(temporaryId, date, pumpType, serialNumber, null, detailedBolusInfo.insulin, detailedBolusInfo.carbs, - detailedBolusInfo.bolusType) { - - } - + detailedBolusInfo.bolusType) } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java index 4fbc3144bd..2fb334dcfe 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/data/RLMessageType.java @@ -7,5 +7,4 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data; public enum RLMessageType { PowerOn, // for powering on the pump (wakeup) ReadSimpleData, // for checking if pump is readable (for Medtronic we can use GetModel) - ; } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java index a55fa1db19..7cc11da498 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/defs/RLMessageType.java @@ -7,5 +7,4 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs; public enum RLMessageType { PowerOn, // for powering on the pump (wakeup) ReadSimpleData, // for checking if pump is readable (for Medtronic we can use GetModel) - ; } diff --git a/wear/src/main/java/info/nightscout/androidaps/data/RawDisplayData.java b/wear/src/main/java/info/nightscout/androidaps/data/RawDisplayData.java index 024f72f676..ecadbd7d4f 100644 --- a/wear/src/main/java/info/nightscout/androidaps/data/RawDisplayData.java +++ b/wear/src/main/java/info/nightscout/androidaps/data/RawDisplayData.java @@ -22,7 +22,7 @@ import info.nightscout.androidaps.interaction.utils.WearUtil; */ public class RawDisplayData { - private WearUtil wearUtil; + private final WearUtil wearUtil; public RawDisplayData(WearUtil wearUtil) { this.wearUtil = wearUtil; diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.java b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.java index 997adea078..afb2b42bd2 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/Persistence.java @@ -26,10 +26,10 @@ import info.nightscout.shared.logging.LTag; @Singleton public class Persistence { - private Context context; - private AAPSLogger aapsLogger; - private WearUtil wearUtil; - private SharedPreferences preferences; + private final Context context; + private final AAPSLogger aapsLogger; + private final WearUtil wearUtil; + private final SharedPreferences preferences; private final String COMPLICATION_PROVIDER_PREFERENCES_FILE_KEY = "info.nightscout.androidaps.complications.COMPLICATION_PROVIDER_PREFERENCES_FILE_KEY"; diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.java b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.java index 81a5915806..05654ea6ea 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.java +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/utils/WearUtil.java @@ -76,7 +76,7 @@ public class WearUtil { PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AAPS::" + name); wl.acquire(millis); if (debug_wakelocks) - aapsLogger.debug(LTag.WEAR, "getWakeLock: " + name + " " + wl.toString()); + aapsLogger.debug(LTag.WEAR, "getWakeLock: " + name + " " + wl); return wl; } diff --git a/wear/src/main/java/info/nightscout/androidaps/tile/TempTargetTileService.kt b/wear/src/main/java/info/nightscout/androidaps/tile/TempTargetTileService.kt index 6e0ff0e30f..e15b4d2dca 100644 --- a/wear/src/main/java/info/nightscout/androidaps/tile/TempTargetTileService.kt +++ b/wear/src/main/java/info/nightscout/androidaps/tile/TempTargetTileService.kt @@ -3,6 +3,6 @@ package info.nightscout.androidaps.tile class TempTargetTileService : TileBase() { override val resourceVersion = "TempTargetTileService" - override val source = TempTargetSource; + override val source = TempTargetSource } diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java index 1e35d8f827..c28ac459ea 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java @@ -18,7 +18,6 @@ import android.os.Vibrator; import android.preference.PreferenceManager; import android.support.wearable.view.WatchViewStub; import android.text.format.DateFormat; -import android.util.Log; import android.view.Display; import android.view.View; import android.view.WindowInsets; @@ -49,6 +48,8 @@ import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.RawDisplayData; import info.nightscout.androidaps.interaction.utils.Persistence; import info.nightscout.androidaps.interaction.utils.WearUtil; +import info.nightscout.shared.logging.AAPSLogger; +import info.nightscout.shared.logging.LTag; import lecho.lib.hellocharts.view.LineChartView; /** @@ -61,6 +62,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc @Inject WearUtil wearUtil; @Inject Persistence persistence; + @Inject AAPSLogger aapsLogger; public final static IntentFilter INTENT_FILTER; @@ -382,7 +384,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc private void checkVibrateHourly(WatchFaceTime oldTime, WatchFaceTime newTime) { boolean hourlyVibratePref = sharedPrefs.getBoolean("vibrate_Hourly", false); if (hourlyVibratePref && layoutSet && newTime.hasHourChanged(oldTime)) { - Log.i("hourlyVibratePref", "true --> " + newTime.toString()); + aapsLogger.info(LTag.WEAR, "hourlyVibratePref", "true --> " + newTime); Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); long[] vibrationPattern = {0, 150, 125, 100}; vibrator.vibrate(vibrationPattern, -1);