diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 92002eab4d..ff3fc89a4a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -312,7 +312,7 @@ class ActionsFragment : DaggerFragment() { for (customAction in customActions) { if (!customAction.isEnabled) continue - val btn = SingleClickButton(currentContext, null, android.R.attr.buttonStyle) + val btn = SingleClickButton(currentContext, null, R.attr.customBtnStyle) btn.text = rh.gs(customAction.name) val layoutParams = LinearLayout.LayoutParams( diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 8ecba9d5ad..d6ca34ab63 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -582,7 +582,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList for (event in events) if (event.isEnabled && event.trigger.shouldRun()) context?.let { context -> - SingleClickButton(context).also { + SingleClickButton(context, null, R.attr.customBtnStyle).also { it.setTextColor(rh.gac(context, R.attr.treatmentButton)) it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f) it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l -> diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt index 4d157a874a..12f240b1e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt @@ -97,11 +97,11 @@ class IobCobOref1Worker( val bucketedData = ads.bucketedData val autosensDataTable = ads.autosensDataTable if (bucketedData == null || bucketedData.size < 3) { - aapsLogger.debug(LTag.AUTOSENS, "Aborting calculation thread (No bucketed data available): ${data.from}") + aapsLogger.debug(LTag.AUTOSENS, {"Aborting calculation thread (No bucketed data available): ${data.from}"}) return Result.success(workDataOf("Error" to "Aborting calculation thread (No bucketed data available): ${data.from}")) } val prevDataTime = ads.roundUpTime(bucketedData[bucketedData.size - 3].timestamp) - aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + dateUtil.dateAndTimeString(prevDataTime)) + aapsLogger.debug(LTag.AUTOSENS, {"Prev data time: " + dateUtil.dateAndTimeString(prevDataTime)}) var previous = autosensDataTable[prevDataTime] // start from oldest to be able sub cob for (i in bucketedData.size - 4 downTo 0) { @@ -156,15 +156,15 @@ class IobCobOref1Worker( val hourAgoData = ads.getAutosensDataAtTime(hourAgo) if (hourAgoData != null) { val initialIndex = autosensDataTable.indexOfKey(hourAgoData.time) - aapsLogger.debug(LTag.AUTOSENS, ">>>>> bucketed_data.size()=" + bucketedData.size + " i=" + i + " hourAgoData=" + hourAgoData.toString()) + aapsLogger.debug(LTag.AUTOSENS, { ">>>>> bucketed_data.size()=" + bucketedData.size + " i=" + i + " hourAgoData=" + hourAgoData.toString()}) var past = 1 try { while (past < 12) { val ad = autosensDataTable.valueAt(initialIndex + past) - aapsLogger.debug(LTag.AUTOSENS, ">>>>> past=" + past + " ad=" + ad?.toString()) + aapsLogger.debug(LTag.AUTOSENS, {">>>>> past=" + past + " ad=" + ad?.toString()}) if (ad == null) { - aapsLogger.debug(LTag.AUTOSENS, autosensDataTable.toString()) - aapsLogger.debug(LTag.AUTOSENS, bucketedData.toString()) + aapsLogger.debug(LTag.AUTOSENS, {autosensDataTable.toString()}) + aapsLogger.debug(LTag.AUTOSENS, {bucketedData.toString()}) //aapsLogger.debug(LTag.AUTOSENS, iobCobCalculatorPlugin.getBgReadingsDataTable().toString()) val notification = Notification(Notification.SEND_LOGFILES, rh.gs(R.string.sendlogfiles), Notification.LOW) rxBus.send(EventNewNotification(notification)) @@ -319,14 +319,12 @@ class IobCobOref1Worker( if (bgTime < dateUtil.now()) autosensDataTable.put(bgTime, autosensData) aapsLogger.debug( LTag.AUTOSENS, - "Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + ads.lastDataTime( - dateUtil - ) + {"Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + ads.lastDataTime(dateUtil)} ) val sensitivity = activePlugin.activeSensitivity.detectSensitivity(ads, oldestTimeWithData, bgTime) aapsLogger.debug(LTag.AUTOSENS, "Sensitivity result: $sensitivity") autosensData.autosensResult = sensitivity - aapsLogger.debug(LTag.AUTOSENS, autosensData.toString()) + aapsLogger.debug(LTag.AUTOSENS, {autosensData.toString()}) } data.iobCobCalculator.ads = ads Thread { @@ -335,7 +333,7 @@ class IobCobOref1Worker( }.start() } finally { rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.IOB_COB_OREF, 100, data.cause)) - aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: ${data.from}") + aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA thread ended: ${data.from}"}) profiler.log(LTag.AUTOSENS, "IobCobOref1Thread", start) } return Result.success() diff --git a/build.gradle b/build.gradle index 5aafa2b9ae..74187f4030 100644 --- a/build.gradle +++ b/build.gradle @@ -7,9 +7,9 @@ buildscript { rxjava_version = '3.1.5' rxandroid_version = '3.0.0' rxkotlin_version = '3.0.1' - room_version = '2.4.2' + room_version = '2.4.3' lifecycle_version = '2.5.0' - dagger_version = '2.42' + dagger_version = '2.43' coroutines_version = '1.6.4' activity_version = '1.4.0' fragmentktx_version = '1.4.1' diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt index 5d65bae4e8..3199406c19 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt @@ -57,7 +57,7 @@ class AutosensDataStore { synchronized(autosensDataTable) { for (index in autosensDataTable.size() - 1 downTo 0) { if (autosensDataTable.keyAt(index) > time) { - aapsLogger.debug(LTag.AUTOSENS, "Removing from autosensDataTable: " + dateUtil.dateAndTimeAndSecondsString(autosensDataTable.keyAt(index))) + aapsLogger.debug(LTag.AUTOSENS, {"Removing from autosensDataTable: " + dateUtil.dateAndTimeAndSecondsString(autosensDataTable.keyAt(index))}) autosensDataTable.removeAt(index) } else { break @@ -135,10 +135,10 @@ class AutosensDataStore { return null } return if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) { - aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastData=" + dateUtil.dateAndTimeAndSecondsString(data.time)) + aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastData=" + dateUtil.dateAndTimeAndSecondsString(data.time)}) null } else { - aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA ($reason) $data") + aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA ($reason) $data"}) data } } @@ -164,7 +164,7 @@ class AutosensDataStore { .compatGetBgReadingsDataFromTime(start, to + T.mins(2).msecs(), false) .blockingGet() .filter { it.value >= 39 } - aapsLogger.debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size + " Start date: " + dateUtil.dateAndTimeString(start) + " End date: " + dateUtil.dateAndTimeString(to)) + aapsLogger.debug(LTag.AUTOSENS, {"BG data loaded. Size: " + bgReadings.size + " Start date: " + dateUtil.dateAndTimeString(start) + " End date: " + dateUtil.dateAndTimeString(to)}) createBucketedData(aapsLogger, dateUtil) rxBus.send(EventBucketedDataCreated()) } @@ -270,7 +270,7 @@ class AutosensDataStore { } val bData: MutableList = ArrayList() bData.add(InMemoryGlucoseValue(bgReadings[0])) - aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgReadings[0].timestamp) + " lastBgTime: " + "none-first-value" + " " + bgReadings[0].toString()) + aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgReadings[0].timestamp) + " lastBgTime: " + "none-first-value" + " " + bgReadings[0].toString()}) var j = 0 for (i in 1 until bgReadings.size) { val bgTime = bgReadings[i].timestamp @@ -293,7 +293,7 @@ class AutosensDataStore { val newBgReading = InMemoryGlucoseValue(nextBgTime, nextBg.roundToLong().toDouble(), true) //console.error("Interpolated", bData[j]); bData.add(newBgReading) - aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()) + aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()}) elapsedMinutes -= 5 lastBg = nextBg lastBgTime = nextBgTime @@ -301,14 +301,14 @@ class AutosensDataStore { j++ val newBgReading = InMemoryGlucoseValue(bgTime, bgReadings[i].value) bData.add(newBgReading) - aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()) + aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()}) } abs(elapsedMinutes) > 2 -> { j++ val newBgReading = InMemoryGlucoseValue(bgTime, bgReadings[i].value) bData.add(newBgReading) - aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()) + aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()}) } else -> { @@ -327,7 +327,7 @@ class AutosensDataStore { val previous = bData[i + 1] val mSecDiff = current.timestamp - previous.timestamp val adjusted = (mSecDiff - T.mins(5).msecs()) / 1000 - aapsLogger.debug(LTag.AUTOSENS, "Adjusting bucketed data time. Current: " + dateUtil.dateAndTimeAndSecondsString(current.timestamp) + " to: " + dateUtil.dateAndTimeAndSecondsString(previous.timestamp + T.mins(5).msecs()) + " by " + adjusted + " sec") + aapsLogger.debug(LTag.AUTOSENS, {"Adjusting bucketed data time. Current: " + dateUtil.dateAndTimeAndSecondsString(current.timestamp) + " to: " + dateUtil.dateAndTimeAndSecondsString(previous.timestamp + T.mins(5).msecs()) + " by " + adjusted + " sec"}) if (abs(adjusted) > 90) { // too big adjustment, fallback to non 5 min data aapsLogger.debug(LTag.AUTOSENS, "Fallback to non 5 min data") diff --git a/core/src/main/res/values-night/styles.xml b/core/src/main/res/values-night/styles.xml index 3a9fe781b5..dfd244db24 100644 --- a/core/src/main/res/values-night/styles.xml +++ b/core/src/main/res/values-night/styles.xml @@ -248,6 +248,8 @@ @color/white @style/CommonSpinnerItemStyle + + @style/GrayButton diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index 0c9e53b9b7..5c5146e42d 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -218,4 +218,6 @@ + + \ No newline at end of file diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index b831de330c..a471a947dc 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -249,6 +249,8 @@ @color/white @style/CommonSpinnerItemStyle + + @style/GrayButton