diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4f40d65323..ff5347fce5 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -126,9 +126,6 @@
-
-
-
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
index 479bd6045c..9a5d86db99 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
@@ -70,7 +70,6 @@ class MainActivity : NoSplashAppCompatActivity() {
private val disposable = CompositeDisposable()
@Inject lateinit var aapsSchedulers: AapsSchedulers
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var androidPermission: AndroidPermission
@Inject lateinit var sp: SP
@Inject lateinit var versionCheckerUtils: VersionCheckerUtils
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt
index b78b3084d7..bd01ce6abc 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt
@@ -7,6 +7,10 @@ import android.net.ConnectivityManager
import android.net.wifi.WifiManager
import android.os.Build
import androidx.lifecycle.ProcessLifecycleOwner
+import androidx.work.Data
+import androidx.work.ExistingPeriodicWorkPolicy
+import androidx.work.PeriodicWorkRequest
+import androidx.work.WorkManager
import com.uber.rxdogtag.RxDogTag
import dagger.android.AndroidInjector
import dagger.android.DaggerApplication
@@ -27,14 +31,11 @@ import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionChec
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore
import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin
-import info.nightscout.androidaps.receivers.BTReceiver
-import info.nightscout.androidaps.receivers.ChargingStateReceiver
-import info.nightscout.androidaps.receivers.KeepAliveReceiver.KeepAliveManager
-import info.nightscout.androidaps.receivers.NetworkChangeReceiver
-import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver
+import info.nightscout.androidaps.receivers.*
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.LocalAlertUtils
import info.nightscout.androidaps.utils.ProcessLifecycleListener
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.locale.LocaleHelper
@@ -48,6 +49,7 @@ import io.reactivex.rxjava3.plugins.RxJavaPlugins
import net.danlew.android.joda.JodaTimeAndroid
import java.io.IOException
import java.net.SocketException
+import java.util.concurrent.TimeUnit
import javax.inject.Inject
class MainApp : DaggerApplication() {
@@ -62,7 +64,6 @@ class MainApp : DaggerApplication() {
@Inject lateinit var config: Config
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var configBuilder: ConfigBuilder
- @Inject lateinit var keepAliveManager: KeepAliveManager
@Inject lateinit var plugins: List<@JvmSuppressWildcards PluginBase>
@Inject lateinit var compatDBHelper: CompatDBHelper
@Inject lateinit var repository: AppRepository
@@ -73,6 +74,7 @@ class MainApp : DaggerApplication() {
@Inject lateinit var notificationStore: NotificationStore
@Inject lateinit var processLifecycleListener: ProcessLifecycleListener
@Inject lateinit var profileSwitchPlugin: ThemeSwitcherPlugin
+ @Inject lateinit var localAlertUtils: LocalAlertUtils
override fun onCreate() {
super.onCreate()
@@ -118,7 +120,17 @@ class MainApp : DaggerApplication() {
// Register all tabs in app here
pluginStore.plugins = plugins
configBuilder.initialize()
- keepAliveManager.setAlarm(this)
+
+ WorkManager.getInstance(this).enqueueUniquePeriodicWork(
+ "KeepAlive",
+ ExistingPeriodicWorkPolicy.REPLACE,
+ PeriodicWorkRequest.Builder(KeepAliveWorker::class.java, 15, TimeUnit.MINUTES)
+ .setInputData(Data.Builder().putString("schedule", "KeepAlive").build())
+ .setInitialDelay(5, TimeUnit.SECONDS)
+ .build()
+ )
+ localAlertUtils.shortenSnoozeInterval()
+ localAlertUtils.preSnoozeAlarms()
doMigrations()
uel.log(UserEntry.Action.START_AAPS, UserEntry.Sources.Aaps)
}
@@ -190,7 +202,6 @@ class MainApp : DaggerApplication() {
override fun onTerminate() {
aapsLogger.debug(LTag.CORE, "onTerminate")
unregisterActivityLifecycleCallbacks(activityMonitor)
- keepAliveManager.cancelAlarm(this)
alarmSoundServiceHelper.stopService(this)
super.onTerminate()
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt
index 66be4af5c9..94063a611f 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt
@@ -54,7 +54,6 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var aapsSchedulers: AapsSchedulers
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var defaultValueHelper: DefaultValueHelper
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/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
index 22322c5bb9..03c3362d9a 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
@@ -38,7 +38,6 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
@Inject lateinit var defaultProfile: DefaultProfile
@Inject lateinit var defaultProfileDPV: DefaultProfileDPV
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var repository: AppRepository
diff --git a/app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt b/app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt
index 9d6615a362..72edb82bc1 100644
--- a/app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt
@@ -2,12 +2,11 @@ package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
+import info.nightscout.androidaps.plugins.aps.loop.CarbSuggestionReceiver
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBluetoothStateReceiver
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBroadcastReceiver
-import info.nightscout.androidaps.plugins.aps.loop.CarbSuggestionReceiver
import info.nightscout.androidaps.receivers.*
-
@Module
@Suppress("unused")
abstract class ReceiversModule {
@@ -16,8 +15,7 @@ abstract class ReceiversModule {
@ContributesAndroidInjector abstract fun contributesBTReceiver(): BTReceiver
@ContributesAndroidInjector abstract fun contributesChargingStateReceiver(): ChargingStateReceiver
@ContributesAndroidInjector abstract fun contributesDataReceiver(): DataReceiver
- @ContributesAndroidInjector abstract fun contributesKeepAliveReceiver(): KeepAliveReceiver
- @ContributesAndroidInjector abstract fun contributesKeepAliveWorker(): KeepAliveReceiver.KeepAliveWorker
+ @ContributesAndroidInjector abstract fun contributesKeepAliveWorker(): KeepAliveWorker
@ContributesAndroidInjector abstract fun contributesRileyLinkBluetoothStateReceiver(): RileyLinkBluetoothStateReceiver
@ContributesAndroidInjector abstract fun contributesSmsReceiver(): SmsReceiver
@ContributesAndroidInjector abstract fun contributesTimeDateOrTZChangeReceiver(): TimeDateOrTZChangeReceiver
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
index cb26aa1a5a..3d6e2850fd 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
@@ -116,16 +116,16 @@ class FillDialog : DialogFragmentWithDate() {
if (insulinAfterConstraints > 0) {
actions.add(rh.gs(R.string.fillwarning))
actions.add("")
- actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(rh, R.color.colorInsulinButton))
+ actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(context, rh, R.attr.insulinButtonColor))
if (abs(insulinAfterConstraints - insulin) > 0.01)
- actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
}
val siteChange = binding.fillCatheterChange.isChecked
if (siteChange)
- actions.add(rh.gs(R.string.record_pump_site_change).formatColor(rh, R.color.actionsConfirm))
+ actions.add(rh.gs(R.string.record_pump_site_change).formatColor(context, rh, R.attr.actionsConfirmColor))
val insulinChange = binding.fillCartridgeChange.isChecked
if (insulinChange)
- actions.add(rh.gs(R.string.record_insulin_cartridge_change).formatColor(rh, R.color.actionsConfirm))
+ actions.add(rh.gs(R.string.record_insulin_cartridge_change).formatColor(context, rh, R.attr.actionsConfirmColor))
val notes: String = binding.notesLayout.notes.text.toString()
if (notes.isNotEmpty())
actions.add(rh.gs(R.string.notes_label) + ": " + notes)
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
index a4172a8727..53e5474dd1 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
@@ -172,16 +172,17 @@ class InsulinDialog : DialogFragmentWithDate() {
val eatingSoonChecked = binding.startEatingSoonTt.isChecked
if (insulinAfterConstraints > 0) {
- actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(rh, R.color.bolus))
+ actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(context, rh, R.attr.bolusColor))
if (recordOnlyChecked)
- actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(context, rh, R.attr.warningColor))
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
- actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
}
val eatingSoonTTDuration = defaultValueHelper.determineEatingSoonTTDuration()
val eatingSoonTT = defaultValueHelper.determineEatingSoonTT()
if (eatingSoonChecked)
- actions.add(rh.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, eatingSoonTTDuration) + ")").formatColor(rh, R.color.tempTargetConfirmation))
+ actions.add(rh.gs(R.string.temptargetshort) + ": " + (DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, eatingSoonTTDuration) + ")")
+ .formatColor(context, rh, R.attr.tempTargetConfirmation))
val timeOffset = binding.time.value.toInt()
val time = dateUtil.now() + T.mins(timeOffset.toLong()).msecs()
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
index aba8fb579f..438ed77193 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
@@ -118,7 +118,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
actions.add(rh.gs(R.string.tempbasal_label) + ": " + rh.gs(R.string.pump_basebasalrate, absolute))
actions.add(rh.gs(R.string.duration) + ": " + rh.gs(R.string.format_mins, durationInMinutes))
if (abs(absolute - basalAbsoluteInput) > 0.01)
- actions.add(rh.gs(R.string.constraintapllied).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.constraintapllied).formatColor(context, rh, R.attr.warningColor))
}
activity?.let { activity ->
OKDialog.showConfirmation(activity, rh.gs(R.string.tempbasal_label), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
index 55fd9a773b..5ca98c146b 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
@@ -128,16 +128,16 @@ class TreatmentDialog : DialogFragmentWithDate() {
val carbsAfterConstraints = constraintChecker.applyCarbsConstraints(Constraint(carbs)).value()
if (insulinAfterConstraints > 0) {
- actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(rh, R.color.bolus))
+ actions.add(rh.gs(R.string.bolus) + ": " + DecimalFormatter.toPumpSupportedBolus(insulinAfterConstraints, activePlugin.activePump, rh).formatColor(context, rh, R.attr.bolusColor))
if (recordOnlyChecked)
- actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.bolusrecordedonly).formatColor(context, rh, R.attr.warningColor))
if (abs(insulinAfterConstraints - insulin) > pumpDescription.pumpType.determineCorrectBolusStepSize(insulinAfterConstraints))
- actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.bolusconstraintappliedwarn, insulin, insulinAfterConstraints).formatColor(context, rh, R.attr.warningColor))
}
if (carbsAfterConstraints > 0) {
- actions.add(rh.gs(R.string.carbs) + ": " + rh.gs(R.string.format_carbs, carbsAfterConstraints).formatColor(rh, R.color.carbs))
+ actions.add(rh.gs(R.string.carbs) + ": " + rh.gs(R.string.format_carbs, carbsAfterConstraints).formatColor(context, rh, R.attr.carbsColor))
if (carbsAfterConstraints != carbs)
- actions.add(rh.gs(R.string.carbsconstraintapplied).formatColor(rh, R.color.warning))
+ actions.add(rh.gs(R.string.carbsconstraintapplied).formatColor(context, rh, R.attr.warningColor))
}
if (insulinAfterConstraints > 0 || carbsAfterConstraints > 0) {
activity?.let { activity ->
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
index 86e139c647..e5ff65ffda 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
@@ -468,12 +468,12 @@ class WizardDialog : DaggerDialogFragment() {
}
if (wizard.calculatedTotalInsulin > 0.0 || carbsAfterConstraint > 0.0) {
- val insulinText = if (wizard.calculatedTotalInsulin > 0.0) rh.gs(R.string.formatinsulinunits, wizard.calculatedTotalInsulin).formatColor(rh, R.color.bolus) else ""
- val carbsText = if (carbsAfterConstraint > 0.0) rh.gs(R.string.format_carbs, carbsAfterConstraint).formatColor(rh, R.color.carbs) else ""
+ val insulinText = if (wizard.calculatedTotalInsulin > 0.0) rh.gs(R.string.formatinsulinunits, wizard.calculatedTotalInsulin).formatColor(context, rh, R.attr.bolusColor) else ""
+ val carbsText = if (carbsAfterConstraint > 0.0) rh.gs(R.string.format_carbs, carbsAfterConstraint).formatColor(context, rh, R.attr.carbsColor) else ""
binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.result_insulin_carbs, insulinText, carbsText))
binding.okcancel.ok.visibility = View.VISIBLE
} else {
- binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.missing_carbs, wizard.carbsEquivalent.toInt()).formatColor(rh, R.color.carbs))
+ binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.missing_carbs, wizard.carbsEquivalent.toInt()).formatColor(context, rh, R.attr.carbsColor))
binding.okcancel.ok.visibility = View.INVISIBLE
}
binding.percentUsed.text = rh.gs(R.string.format_percent, wizard.percentageCorrection)
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/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt
index 982a662d4a..f25e01c0db 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt
@@ -142,7 +142,7 @@ class OverviewData @Inject constructor(
fun lastBgColor(context: Context?): Int {
return when {
isLow -> rh.gac(context, R.attr.bgLow)
- isHigh -> rh.gac(context, R.attr.bgHigh)
+ isHigh -> rh.gac(context, R.attr.highColor)
else -> rh.gac(context, R.attr.bgInRange)
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
index 254901adc5..f3455580ee 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
@@ -66,7 +66,7 @@ class StatusLightHandler @Inject constructor(
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
} else {
careportal_battery_level?.text = rh.gs(R.string.notavailable)
- careportal_battery_level?.setTextColor(Color.WHITE)
+ careportal_battery_level?.setTextColor(rh.gac(careportal_battery_level.context, R.attr.defaultTextColor))
}
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
index f3f7b150bb..680bbd2727 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
@@ -31,7 +31,6 @@ import javax.inject.Inject
class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin
@Inject lateinit var otp: OneTimePassword
@Inject lateinit var uel: UserEntryLogger
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 8860bcc635..46f0323149 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
@@ -589,17 +589,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/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
index c4249955ed..264a999eb8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
@@ -143,7 +143,7 @@ class BGSourceFragment : DaggerFragment() {
val previous = glucoseValues[position - 1]
val diff = previous.timestamp - glucoseValue.timestamp
if (diff < T.secs(20).msecs())
- holder.binding.root.setBackgroundColor(rh.gc(R.color.errorAlertBackground))
+ holder.binding.root.setBackgroundColor(rh.gac(context, R.attr.bgsourceError))
}
holder.binding.root.setOnLongClickListener {
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
deleted file mode 100644
index e20ebcb414..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt
+++ /dev/null
@@ -1,198 +0,0 @@
-package info.nightscout.androidaps.receivers
-
-import android.app.AlarmManager
-import android.app.PendingIntent
-import android.app.PendingIntent.CanceledException
-import android.app.PendingIntent.FLAG_IMMUTABLE
-import android.content.Context
-import android.content.Intent
-import android.os.SystemClock
-import androidx.work.*
-import com.google.common.util.concurrent.ListenableFuture
-import dagger.android.DaggerBroadcastReceiver
-import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.BuildConfig
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.events.EventProfileSwitchChanged
-import info.nightscout.androidaps.extensions.buildDeviceStatus
-import info.nightscout.androidaps.interfaces.*
-import info.nightscout.shared.logging.AAPSLogger
-import info.nightscout.shared.logging.LTag
-import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration
-import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
-import info.nightscout.androidaps.queue.commands.Command
-import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.utils.LocalAlertUtils
-import info.nightscout.androidaps.utils.T
-import info.nightscout.androidaps.utils.resources.ResourceHelper
-import javax.inject.Inject
-import kotlin.math.abs
-
-class KeepAliveReceiver : DaggerBroadcastReceiver() {
-
- @Inject lateinit var aapsLogger: AAPSLogger
-
- companion object {
-
- private val KEEP_ALIVE_MILLISECONDS = T.mins(5).msecs()
- }
-
- override fun onReceive(context: Context, intent: Intent) {
- super.onReceive(context, intent)
- aapsLogger.debug(LTag.CORE, "KeepAlive received")
-
- WorkManager.getInstance(context)
- .enqueue(OneTimeWorkRequest.Builder(KeepAliveWorker::class.java).build())
- }
-
- class KeepAliveWorker(
- private val context: Context,
- params: WorkerParameters
- ) : Worker(context, params) {
-
- @Inject lateinit var aapsLogger: AAPSLogger
- @Inject lateinit var localAlertUtils: LocalAlertUtils
- @Inject lateinit var repository: AppRepository
- @Inject lateinit var config: Config
- @Inject lateinit var iobCobCalculator: IobCobCalculator
- @Inject lateinit var loop: Loop
- @Inject lateinit var dateUtil: DateUtil
- @Inject lateinit var activePlugin: ActivePlugin
- @Inject lateinit var profileFunction: ProfileFunction
- @Inject lateinit var runningConfiguration: RunningConfiguration
- @Inject lateinit var receiverStatusStore: ReceiverStatusStore
- @Inject lateinit var rxBus: RxBus
- @Inject lateinit var commandQueue: CommandQueue
- @Inject lateinit var fabricPrivacy: FabricPrivacy
- @Inject lateinit var maintenancePlugin: MaintenancePlugin
- @Inject lateinit var rh: ResourceHelper
-
- init {
- (context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
- }
-
- companion object {
-
- private val STATUS_UPDATE_FREQUENCY = T.mins(15).msecs()
- private const val IOB_UPDATE_FREQUENCY_IN_MINUTES = 5L
-
- private var lastReadStatus: Long = 0
- private var lastRun: Long = 0
- private var lastIobUpload: Long = 0
-
- }
-
- override fun doWork(): Result {
- localAlertUtils.shortenSnoozeInterval()
- localAlertUtils.checkStaleBGAlert()
- checkPump()
- checkAPS()
- maintenancePlugin.deleteLogs(30)
- workerDbStatus()
-
- return Result.success()
- }
-
- // When Worker DB grows too much, work operations become slow
- // Library is cleaning DB every 7 days which may not be sufficient for NSClient full sync
- private fun workerDbStatus() {
- val workQuery = WorkQuery.Builder
- .fromStates(listOf(WorkInfo.State.FAILED, WorkInfo.State.SUCCEEDED))
- .build()
-
- val workInfo: ListenableFuture> = WorkManager.getInstance(context).getWorkInfos(workQuery)
- aapsLogger.debug(LTag.CORE, "WorkManager size is ${workInfo.get().size}")
- if (workInfo.get().size > 1000) {
- WorkManager.getInstance(context).pruneWork()
- aapsLogger.debug(LTag.CORE, "WorkManager pruning ....")
- }
- }
-
- // Usually deviceStatus is uploaded through LoopPlugin after every loop cycle.
- // if there is no BG available, we have to upload anyway to have correct
- // IOB displayed in NS
- private fun checkAPS() {
- var shouldUploadStatus = false
- if (config.NSCLIENT) return
- if (config.PUMPCONTROL) shouldUploadStatus = true
- else if (!(loop as PluginBase).isEnabled() || iobCobCalculator.ads.actualBg() == null)
- shouldUploadStatus = true
- else if (dateUtil.isOlderThan(activePlugin.activeAPS.lastAPSRun, 5)) shouldUploadStatus = true
- if (dateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY_IN_MINUTES) && shouldUploadStatus) {
- lastIobUpload = dateUtil.now()
- buildDeviceStatus(dateUtil, loop, iobCobCalculator, profileFunction,
- activePlugin.activePump, receiverStatusStore, runningConfiguration,
- BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION)?.also {
- repository.insert(it)
- }
- }
- }
-
- private fun checkPump() {
- val pump = activePlugin.activePump
- val ps = profileFunction.getRequestedProfile() ?: return
- val requestedProfile = ProfileSealed.PS(ps)
- val runningProfile = profileFunction.getProfile()
- val lastConnection = pump.lastDataTime()
- val isStatusOutdated = lastConnection + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis()
- val isBasalOutdated = abs(requestedProfile.getBasal() - pump.baseBasalRate) > pump.pumpDescription.basalStep
- aapsLogger.debug(LTag.CORE, "Last connection: " + dateUtil.dateAndTimeString(lastConnection))
- // sometimes keep alive broadcast stops
- // as as workaround test if readStatus was requested before an alarm is generated
- if (lastReadStatus != 0L && lastReadStatus > System.currentTimeMillis() - T.mins(5).msecs()) {
- localAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated, loop.isDisconnected)
- }
- if (loop.isDisconnected) {
- // do nothing if pump is disconnected
- } else if (runningProfile == null || ((!pump.isThisProfileSet(requestedProfile) || !requestedProfile.isEqual(runningProfile)) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE))) {
- rxBus.send(EventProfileSwitchChanged())
- } else if (isStatusOutdated && !pump.isBusy()) {
- lastReadStatus = System.currentTimeMillis()
- commandQueue.readStatus(rh.gs(R.string.keepalive_status_outdated), null)
- } else if (isBasalOutdated && !pump.isBusy()) {
- lastReadStatus = System.currentTimeMillis()
- commandQueue.readStatus(rh.gs(R.string.keepalive_basal_outdated), null)
- }
- if (lastRun != 0L && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
- aapsLogger.error(LTag.CORE, "KeepAlive fail")
- fabricPrivacy.logCustom("KeepAliveFail")
- }
- lastRun = System.currentTimeMillis()
- }
- }
-
- class KeepAliveManager @Inject constructor(
- private val aapsLogger: AAPSLogger,
- private val localAlertUtils: LocalAlertUtils
- ) {
-
- //called by MainApp at first app start
- fun setAlarm(context: Context) {
- aapsLogger.debug(LTag.CORE, "KeepAlive scheduled")
- SystemClock.sleep(5000) // wait for app initialization
- localAlertUtils.shortenSnoozeInterval()
- localAlertUtils.preSnoozeAlarms()
- val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
- val i = Intent(context, KeepAliveReceiver::class.java)
- val pi = PendingIntent.getBroadcast(context, 0, i, FLAG_IMMUTABLE)
- try {
- pi.send()
- } catch (e: CanceledException) {
- }
- am.cancel(pi)
- am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), KEEP_ALIVE_MILLISECONDS, pi)
- }
-
- fun cancelAlarm(context: Context) {
- aapsLogger.debug(LTag.CORE, "KeepAlive canceled")
- val intent = Intent(context, KeepAliveReceiver::class.java)
- val sender = PendingIntent.getBroadcast(context, 0, intent, FLAG_IMMUTABLE)
- val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
- alarmManager.cancel(sender)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt
new file mode 100644
index 0000000000..dc705c4a84
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt
@@ -0,0 +1,167 @@
+package info.nightscout.androidaps.receivers
+
+import android.content.Context
+import androidx.work.*
+import com.google.common.util.concurrent.ListenableFuture
+import dagger.android.HasAndroidInjector
+import info.nightscout.androidaps.BuildConfig
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.data.ProfileSealed
+import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.androidaps.events.EventProfileSwitchChanged
+import info.nightscout.androidaps.extensions.buildDeviceStatus
+import info.nightscout.androidaps.interfaces.*
+import info.nightscout.androidaps.plugins.bus.RxBus
+import info.nightscout.androidaps.plugins.configBuilder.RunningConfiguration
+import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
+import info.nightscout.androidaps.queue.commands.Command
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.LocalAlertUtils
+import info.nightscout.androidaps.utils.T
+import info.nightscout.androidaps.utils.resources.ResourceHelper
+import info.nightscout.shared.logging.AAPSLogger
+import info.nightscout.shared.logging.LTag
+import java.util.concurrent.TimeUnit
+import javax.inject.Inject
+import kotlin.math.abs
+
+class KeepAliveWorker(
+ private val context: Context,
+ params: WorkerParameters
+) : Worker(context, params) {
+
+ @Inject lateinit var aapsLogger: AAPSLogger
+ @Inject lateinit var localAlertUtils: LocalAlertUtils
+ @Inject lateinit var repository: AppRepository
+ @Inject lateinit var config: Config
+ @Inject lateinit var iobCobCalculator: IobCobCalculator
+ @Inject lateinit var loop: Loop
+ @Inject lateinit var dateUtil: DateUtil
+ @Inject lateinit var activePlugin: ActivePlugin
+ @Inject lateinit var profileFunction: ProfileFunction
+ @Inject lateinit var runningConfiguration: RunningConfiguration
+ @Inject lateinit var receiverStatusStore: ReceiverStatusStore
+ @Inject lateinit var rxBus: RxBus
+ @Inject lateinit var commandQueue: CommandQueue
+ @Inject lateinit var fabricPrivacy: FabricPrivacy
+ @Inject lateinit var maintenancePlugin: MaintenancePlugin
+ @Inject lateinit var rh: ResourceHelper
+
+ init {
+ (context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
+ }
+
+ companion object {
+
+ private val STATUS_UPDATE_FREQUENCY = T.mins(15).msecs()
+ private const val IOB_UPDATE_FREQUENCY_IN_MINUTES = 5L
+
+ private var lastReadStatus: Long = 0
+ private var lastRun: Long = 0
+ private var lastIobUpload: Long = 0
+
+ }
+
+ override fun doWork(): Result {
+ aapsLogger.debug(LTag.CORE, "KeepAlive received from: " + inputData.getString("schedule"))
+
+ // 15 min interval is WorkManager minimum so schedule another instances to have 5 min interval
+ if (inputData.getString("schedule") == "KeepAlive") {
+ WorkManager.getInstance(context).enqueueUniqueWork(
+ "KeepAlive_5",
+ ExistingWorkPolicy.REPLACE,
+ OneTimeWorkRequest.Builder(KeepAliveWorker::class.java)
+ .setInputData(Data.Builder().putString("schedule", "KeepAlive_5").build())
+ .setInitialDelay(5, TimeUnit.MINUTES)
+ .build()
+ )
+ WorkManager.getInstance(context).enqueueUniqueWork(
+ "KeepAlive_10",
+ ExistingWorkPolicy.REPLACE,
+ OneTimeWorkRequest.Builder(KeepAliveWorker::class.java)
+ .setInputData(Data.Builder().putString("schedule", "KeepAlive_10").build())
+ .setInitialDelay(10, TimeUnit.MINUTES)
+ .build()
+ )
+ }
+
+ localAlertUtils.shortenSnoozeInterval()
+ localAlertUtils.checkStaleBGAlert()
+ checkPump()
+ checkAPS()
+ maintenancePlugin.deleteLogs(30)
+ workerDbStatus()
+
+ return Result.success()
+ }
+
+ // When Worker DB grows too much, work operations become slow
+ // Library is cleaning DB every 7 days which may not be sufficient for NSClient full sync
+ private fun workerDbStatus() {
+ val workQuery = WorkQuery.Builder
+ .fromStates(listOf(WorkInfo.State.FAILED, WorkInfo.State.SUCCEEDED))
+ .build()
+
+ val workInfo: ListenableFuture> = WorkManager.getInstance(context).getWorkInfos(workQuery)
+ aapsLogger.debug(LTag.CORE, "WorkManager size is ${workInfo.get().size}")
+ if (workInfo.get().size > 1000) {
+ WorkManager.getInstance(context).pruneWork()
+ aapsLogger.debug(LTag.CORE, "WorkManager pruning ....")
+ }
+ }
+
+ // Usually deviceStatus is uploaded through LoopPlugin after every loop cycle.
+ // if there is no BG available, we have to upload anyway to have correct
+ // IOB displayed in NS
+ private fun checkAPS() {
+ var shouldUploadStatus = false
+ if (config.NSCLIENT) return
+ if (config.PUMPCONTROL) shouldUploadStatus = true
+ else if (!(loop as PluginBase).isEnabled() || iobCobCalculator.ads.actualBg() == null)
+ shouldUploadStatus = true
+ else if (dateUtil.isOlderThan(activePlugin.activeAPS.lastAPSRun, 5)) shouldUploadStatus = true
+ if (dateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY_IN_MINUTES) && shouldUploadStatus) {
+ lastIobUpload = dateUtil.now()
+ buildDeviceStatus(
+ dateUtil, loop, iobCobCalculator, profileFunction,
+ activePlugin.activePump, receiverStatusStore, runningConfiguration,
+ BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION
+ )?.also {
+ repository.insert(it)
+ }
+ }
+ }
+
+ private fun checkPump() {
+ val pump = activePlugin.activePump
+ val ps = profileFunction.getRequestedProfile() ?: return
+ val requestedProfile = ProfileSealed.PS(ps)
+ val runningProfile = profileFunction.getProfile()
+ val lastConnection = pump.lastDataTime()
+ val isStatusOutdated = lastConnection + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis()
+ val isBasalOutdated = abs(requestedProfile.getBasal() - pump.baseBasalRate) > pump.pumpDescription.basalStep
+ aapsLogger.debug(LTag.CORE, "Last connection: " + dateUtil.dateAndTimeString(lastConnection))
+ // sometimes keep alive broadcast stops
+ // as as workaround test if readStatus was requested before an alarm is generated
+ if (lastReadStatus != 0L && lastReadStatus > System.currentTimeMillis() - T.mins(5).msecs()) {
+ localAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated, loop.isDisconnected)
+ }
+ if (loop.isDisconnected) {
+ // do nothing if pump is disconnected
+ } else if (runningProfile == null || ((!pump.isThisProfileSet(requestedProfile) || !requestedProfile.isEqual(runningProfile)) && !commandQueue.isRunning(Command.CommandType.BASAL_PROFILE))) {
+ rxBus.send(EventProfileSwitchChanged())
+ } else if (isStatusOutdated && !pump.isBusy()) {
+ lastReadStatus = System.currentTimeMillis()
+ commandQueue.readStatus(rh.gs(R.string.keepalive_status_outdated), null)
+ } else if (isBasalOutdated && !pump.isBusy()) {
+ lastReadStatus = System.currentTimeMillis()
+ commandQueue.readStatus(rh.gs(R.string.keepalive_basal_outdated), null)
+ }
+ if (lastRun != 0L && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
+ aapsLogger.error(LTag.CORE, "KeepAlive fail")
+ fabricPrivacy.logCustom("KeepAliveFail")
+ }
+ lastRun = System.currentTimeMillis()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt
index 090b9ae07d..a5d157707f 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt
@@ -34,7 +34,6 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
@Inject lateinit var swDefinition: SWDefinition
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var aapsSchedulers: AapsSchedulers
diff --git a/app/src/main/res/drawable/ic_actions_cancelextbolus.xml b/app/src/main/res/drawable/ic_actions_cancelextbolus.xml
index 913b1b9aeb..92998ff78e 100644
--- a/app/src/main/res/drawable/ic_actions_cancelextbolus.xml
+++ b/app/src/main/res/drawable/ic_actions_cancelextbolus.xml
@@ -5,14 +5,14 @@
android:viewportHeight="24">
+ android:fillColor="?attr/extBolusStopColor"/>
+ android:fillColor="?attr/extBolusStopColor"/>
+ android:fillColor="?attr/extBolusStopColor"/>
+ android:fillColor="?attr/extBolusStopColor"/>
diff --git a/app/src/main/res/drawable/ic_byoda.xml b/app/src/main/res/drawable/ic_byoda.xml
index 1bf06ca7d8..da63bef0df 100644
--- a/app/src/main/res/drawable/ic_byoda.xml
+++ b/app/src/main/res/drawable/ic_byoda.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24">
+ android:fillColor="@color/byodagray"/>
diff --git a/app/src/main/res/drawable/ic_cancelbasal.xml b/app/src/main/res/drawable/ic_cancelbasal.xml
index 76640a4534..dcc01452e3 100644
--- a/app/src/main/res/drawable/ic_cancelbasal.xml
+++ b/app/src/main/res/drawable/ic_cancelbasal.xml
@@ -4,7 +4,8 @@
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
-
-
-
+
+
+
diff --git a/app/src/main/res/drawable/ic_cp_age_battery.xml b/app/src/main/res/drawable/ic_cp_age_battery.xml
index cc36e585a0..2316d660aa 100644
--- a/app/src/main/res/drawable/ic_cp_age_battery.xml
+++ b/app/src/main/res/drawable/ic_cp_age_battery.xml
@@ -6,11 +6,11 @@
diff --git a/app/src/main/res/drawable/ic_cp_age_cannula.xml b/app/src/main/res/drawable/ic_cp_age_cannula.xml
index f2578fa72b..58b450d81f 100644
--- a/app/src/main/res/drawable/ic_cp_age_cannula.xml
+++ b/app/src/main/res/drawable/ic_cp_age_cannula.xml
@@ -6,6 +6,6 @@
diff --git a/app/src/main/res/drawable/ic_cp_age_insulin.xml b/app/src/main/res/drawable/ic_cp_age_insulin.xml
index 701e31cee3..7e96c91e7a 100644
--- a/app/src/main/res/drawable/ic_cp_age_insulin.xml
+++ b/app/src/main/res/drawable/ic_cp_age_insulin.xml
@@ -6,6 +6,6 @@
diff --git a/app/src/main/res/drawable/ic_cp_age_sensor.xml b/app/src/main/res/drawable/ic_cp_age_sensor.xml
index 08134cc20b..64c684320c 100644
--- a/app/src/main/res/drawable/ic_cp_age_sensor.xml
+++ b/app/src/main/res/drawable/ic_cp_age_sensor.xml
@@ -6,16 +6,16 @@
diff --git a/app/src/main/res/drawable/ic_loop_disabled.xml b/app/src/main/res/drawable/ic_loop_disabled.xml
index 685118b92d..e8004f78fe 100644
--- a/app/src/main/res/drawable/ic_loop_disabled.xml
+++ b/app/src/main/res/drawable/ic_loop_disabled.xml
@@ -5,11 +5,11 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopDisabled"/>
+ android:fillColor="?attr/loopDisabled"/>
+ android:fillColor="?attr/loopDisabled"/>
diff --git a/app/src/main/res/drawable/ic_loop_disconnected.xml b/app/src/main/res/drawable/ic_loop_disconnected.xml
index ea2cd137f4..3753c6a451 100644
--- a/app/src/main/res/drawable/ic_loop_disconnected.xml
+++ b/app/src/main/res/drawable/ic_loop_disconnected.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopDisconnected"/>
+ android:fillColor="?attr/loopDisconnected"/>
diff --git a/app/src/main/res/drawable/ic_loop_lgs.xml b/app/src/main/res/drawable/ic_loop_lgs.xml
index c570403dbf..23a4ddf300 100644
--- a/app/src/main/res/drawable/ic_loop_lgs.xml
+++ b/app/src/main/res/drawable/ic_loop_lgs.xml
@@ -5,20 +5,20 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
diff --git a/app/src/main/res/drawable/ic_loop_open.xml b/app/src/main/res/drawable/ic_loop_open.xml
index 6f97953808..c7b4f00e3b 100644
--- a/app/src/main/res/drawable/ic_loop_open.xml
+++ b/app/src/main/res/drawable/ic_loop_open.xml
@@ -5,23 +5,23 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopOpened"/>
+ android:fillColor="?attr/loopOpened"/>
+ android:fillColor="?attr/loopOpened"/>
+ android:fillColor="?attr/loopOpened"/>
+ android:fillColor="?attr/loopOpened"/>
+ android:fillColor="?attr/loopOpened"/>
+ android:fillColor="?attr/loopOpened"/>
diff --git a/app/src/main/res/drawable/ic_loop_paused.xml b/app/src/main/res/drawable/ic_loop_paused.xml
index c49d3084c3..372b6a7d61 100644
--- a/app/src/main/res/drawable/ic_loop_paused.xml
+++ b/app/src/main/res/drawable/ic_loop_paused.xml
@@ -5,11 +5,11 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopDisabled"/>
+ android:fillColor="?attr/loopDisabled"/>
+ android:fillColor="?attr/loopDisabled"/>
diff --git a/app/src/main/res/drawable/ic_loop_reconnect.xml b/app/src/main/res/drawable/ic_loop_reconnect.xml
index f61d0f97b1..ca8e54fa6c 100644
--- a/app/src/main/res/drawable/ic_loop_reconnect.xml
+++ b/app/src/main/res/drawable/ic_loop_reconnect.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
diff --git a/app/src/main/res/drawable/ic_loop_resume.xml b/app/src/main/res/drawable/ic_loop_resume.xml
index ade6ba2f8d..cf80f79567 100644
--- a/app/src/main/res/drawable/ic_loop_resume.xml
+++ b/app/src/main/res/drawable/ic_loop_resume.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopClosed"/>
+ android:fillColor="?attr/loopClosed"/>
diff --git a/app/src/main/res/drawable/ic_loop_superbolus.xml b/app/src/main/res/drawable/ic_loop_superbolus.xml
index 2f94edf2c4..fd9223c587 100644
--- a/app/src/main/res/drawable/ic_loop_superbolus.xml
+++ b/app/src/main/res/drawable/ic_loop_superbolus.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopSuperBolus"/>
+ android:fillColor="?attr/loopSuperBolus"/>
diff --git a/app/src/main/res/drawable/ic_patch_pump_outline.xml b/app/src/main/res/drawable/ic_patch_pump_outline.xml
index 6e95a27545..6a86ec1503 100644
--- a/app/src/main/res/drawable/ic_patch_pump_outline.xml
+++ b/app/src/main/res/drawable/ic_patch_pump_outline.xml
@@ -6,7 +6,7 @@
diff --git a/app/src/main/res/drawable/ic_target_activity.xml b/app/src/main/res/drawable/ic_target_activity.xml
index 4439597b75..4873b388cc 100644
--- a/app/src/main/res/drawable/ic_target_activity.xml
+++ b/app/src/main/res/drawable/ic_target_activity.xml
@@ -5,14 +5,14 @@
android:viewportHeight="24">
+ android:fillColor="?attr/exerciseColor"/>
-
-
+ android:fillColor="?attr/exerciseColor"/>
+
+
diff --git a/app/src/main/res/drawable/ic_target_cancel.xml b/app/src/main/res/drawable/ic_target_cancel.xml
index 50d7304662..c00ad238f7 100644
--- a/app/src/main/res/drawable/ic_target_cancel.xml
+++ b/app/src/main/res/drawable/ic_target_cancel.xml
@@ -5,11 +5,11 @@
android:viewportHeight="24">
-
-
+ android:fillColor="?attr/tempTargetConfirmation"/>
+
+
diff --git a/app/src/main/res/drawable/ic_target_eatingsoon.xml b/app/src/main/res/drawable/ic_target_eatingsoon.xml
index 54b6162546..70d0ab72d4 100644
--- a/app/src/main/res/drawable/ic_target_eatingsoon.xml
+++ b/app/src/main/res/drawable/ic_target_eatingsoon.xml
@@ -5,17 +5,17 @@
android:viewportHeight="24">
+ android:fillColor="?attr/carbsColor"/>
+ android:fillColor="?attr/carbsColor"/>
-
-
+ android:fillColor="?attr/carbsColor"/>
+
+
diff --git a/app/src/main/res/drawable/ic_target_hypo.xml b/app/src/main/res/drawable/ic_target_hypo.xml
index 30721cbf14..eab6df8e3f 100644
--- a/app/src/main/res/drawable/ic_target_hypo.xml
+++ b/app/src/main/res/drawable/ic_target_hypo.xml
@@ -5,17 +5,17 @@
android:viewportHeight="24">
+ android:fillColor="?attr/lowColor"/>
+ android:fillColor="?attr/lowColor"/>
+ android:fillColor="?attr/lowColor"/>
+ android:fillColor="?attr/bgInRange"/>
+ android:fillColor="?attr/tempTargetConfirmation"/>
diff --git a/app/src/main/res/drawable/ic_xdrip.xml b/app/src/main/res/drawable/ic_xdrip.xml
index 54f88823ba..bf2ee9b482 100644
--- a/app/src/main/res/drawable/ic_xdrip.xml
+++ b/app/src/main/res/drawable/ic_xdrip.xml
@@ -4,5 +4,6 @@
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
-
+
diff --git a/app/src/main/res/layout/activity_setupwizard.xml b/app/src/main/res/layout/activity_setupwizard.xml
index d70bd1063c..c84e5f652d 100644
--- a/app/src/main/res/layout/activity_setupwizard.xml
+++ b/app/src/main/res/layout/activity_setupwizard.xml
@@ -62,7 +62,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
- android:background="@color/black_overlay"
+ android:background="@color/black_alpha_40"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">
diff --git a/app/src/main/res/layout/careportal_stats_fragment_lowres.xml b/app/src/main/res/layout/careportal_stats_fragment_lowres.xml
deleted file mode 100644
index da803e3354..0000000000
--- a/app/src/main/res/layout/careportal_stats_fragment_lowres.xml
+++ /dev/null
@@ -1,224 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/overview_buttons_layout.xml b/app/src/main/res/layout/overview_buttons_layout.xml
index 872963859e..d4142c46b1 100644
--- a/app/src/main/res/layout/overview_buttons_layout.xml
+++ b/app/src/main/res/layout/overview_buttons_layout.xml
@@ -45,7 +45,7 @@
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_insulin_carbs"
android:text="@string/overview_treatment_label"
- android:textColor="?attr/treatmentButton"
+ android:textColor="?attr/icTreatmentColor"
android:textSize="10sp"
android:visibility="gone"
tools:ignore="SmallSp" />
@@ -59,7 +59,7 @@
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_bolus"
android:text="@string/overview_insulin_label"
- android:textColor="?attr/insulinButtonColor"
+ android:textColor="?attr/icBolusColor"
android:textSize="10sp"
tools:ignore="SmallSp" />
@@ -72,7 +72,7 @@
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_cp_bolus_carbs"
android:text="@string/treatments_wizard_carbs_label"
- android:textColor="?attr/carbsButtonColor"
+ android:textColor="?attr/icBolusCarbsColor"
android:textSize="10sp"
tools:ignore="SmallSp" />
@@ -85,7 +85,7 @@
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_calculator"
android:text="@string/overview_calculator_label"
- android:textColor="?attr/calculatorButtonColor"
+ android:textColor="?attr/icCalculatorColor"
android:textSize="10sp"
tools:ignore="SmallSp" />
@@ -98,7 +98,7 @@
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_calibration"
android:text="@string/overview_calibration"
- android:textColor="?attr/calibrationButtonColor"
+ android:textColor="?attr/icCalibrationColor"
android:textSize="10sp"
android:visibility="gone"
tools:ignore="SmallSp" />
@@ -112,7 +112,7 @@
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_xdrip"
android:text="@string/overview_cgm"
- android:textColor="?attr/calibrationButtonColor"
+ android:textColor="?attr/icCalibrationColor"
android:textSize="10sp"
android:visibility="gone"
tools:ignore="SmallSp" />
@@ -127,7 +127,7 @@
android:drawableTop="@drawable/ic_quick_wizard"
android:text="@string/quickwizard"
android:hint="@string/quickwizard"
- android:textColor="?attr/quickWizardButtonColor"
+ android:textColor="?attr/icQuickWizardColor"
android:textSize="10sp"
tools:ignore="SmallSp" />
diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml
index 7f059cc5ca..29b08629f0 100644
--- a/app/src/main/res/layout/overview_fragment.xml
+++ b/app/src/main/res/layout/overview_fragment.xml
@@ -135,7 +135,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
- android:background="@color/pumpStatusBackground"
+ android:background="?attr/pumpStatusBackground"
android:gravity="center_vertical|center_horizontal"
android:paddingTop="6dp"
android:paddingBottom="6dp"
diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml
index 191ee91193..170b013f80 100644
--- a/app/src/main/res/values-cs-rCZ/strings.xml
+++ b/app/src/main/res/values-cs-rCZ/strings.xml
@@ -985,6 +985,8 @@
Neznámý příkaz k akci:
Procentní podíl
Výchozí nastavení aplikace
+ Zobrazit zneplatněné / odstraněné záznamy
+ Skrýt zneplatněné / odstraněné záznamy
Vyberte profil pro úpravu
Obnovit z Nightscoutu
Odstranit zvolené položky
@@ -1001,4 +1003,6 @@
Pod
V rozsahu
Nad
+ Zobrazit záznamy smyčky
+ Skrýt záznamy smyčky
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index b39d75b6fb..bd6ac852d9 100644
--- a/app/src/main/res/values-es-rES/strings.xml
+++ b/app/src/main/res/values-es-rES/strings.xml
@@ -435,7 +435,7 @@
OpenAPS SMB
ISF Dinámico
Factor de ajuste de ISF Dinámico %
- Porcentaje del factor de ajuste para ISF Dinámico. Establece valores por encima del 100%, para correcciones más agresivas y por debajo para correcciones menos agresivas
+ Porcentaje del factor de ajuste de ISF Dinámico\n Valor predeterminado: 100\nEstablecer valores por encima del 100% para que el algoritmo aplique correcciones más agresivas y valores por debajo del 100% para correcciones menos agresivas.
Activar UAM
Activar SMB
Usar microbolos en lugar de basales temporales, para corregir más rápidamente
@@ -985,6 +985,8 @@
Comando de acción desconocido:
Porcentaje
Aplicación por defecto
+ Mostrar registros eliminados o invalidados
+ Ocultar registros eliminados o invalidados
Seleccione el perfil a editar
Actualizar de Nightscout
Eliminar los elementos seleccionados
@@ -1001,4 +1003,6 @@
Bajo
En rango
Alto
+ Mostrar registros del lazo
+ Ocultar registros del lazo
diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml
index f2d63fcc6c..ad83fa9cbd 100644
--- a/app/src/main/res/values-no-rNO/strings.xml
+++ b/app/src/main/res/values-no-rNO/strings.xml
@@ -985,6 +985,8 @@
Ukjent kommando:
Prosent
Standardverdi
+ Vis ugyldige / slettede registreringer
+ Skjul ugyldige / slettede registreringer
Velg profil du vil redigere
Oppdater fra Nightscout
Fjern valgte elementer
@@ -1001,4 +1003,6 @@
Under
I målområdet
Over
+ Vis loop registreringer
+ Skjul loop registreringer
diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml
index 4e1d0bbecd..3d1f1a1f6c 100644
--- a/app/src/main/res/values-ru-rRU/strings.xml
+++ b/app/src/main/res/values-ru-rRU/strings.xml
@@ -161,6 +161,7 @@
лицензионное соглашение с пользователем
НЕ ДОЛЖНО ИСПОЛЬЗОВАТЬСЯ ДЛЯ ПРИНЯТИЯ МЕДИЦИНСКИХ РЕШЕНИЙ. ПРОГРАММА НЕ ДАЕТ ГАРАНТИЙ В РАМКАХ СУЩЕСТВУЮЩЕГО ЗАКОНОДАТЕЛЬСТВА. ПРЕДОСТАВЛЯЕТСЯ \"КАК ЕСТЬ\" БЕЗ ЯВНЫХ ИЛИ СКРЫТЫХ ГАРАНТИЙ ВКЛЮЧАЯ НО НЕ ОГРАНИЧИВАЯСЬ ВОЗМОЖНОСТЬЮ КОММЕРЧЕСКОГО ИСПОЛЬЗОВАНИ ИЛИ СООТВЕТСТВИЯ КАКИМ-ЛИБО ЦЕЛЯМ. ВСЕ РИСКИ ЛОЖАТСЯ НА ВАС. В СЛУЧАЕ НЕРАБОТОСПОСОБНОСТИ ПРОГРАММЫ ВЫ НЕСЕТЕ ВСЕ РАСХОДЫ СВЯЗАННЫЕ С ОБСЛУЖИВАНИЕМ РЕМОНТОМ ИЛИ КОРРЕКТИРОВКОЙ.
я понимаю и принимаю
+ Сохранить
обновить профиль
SMS коммуникатор
разрешенные телефонные номера
@@ -432,6 +433,8 @@
Активировать локальную передачу
Супер микро болюс OpenAPS
Динамический ISF
+ Коэффициент регулировки динамического диапазона чувствительности ISF %
+ Коэффициент корректировки динамического диапазона чувствительности ISF. Установите более 100% для более агрессивных доз коррекции и менее 100% для менее агрессивной коррекции.
Включить непредвиденный прием пищи UAM
Включить супер микро болюс SMB
Для ускорения действия используйте супер микро болюсы SMB вместо временного базала
@@ -664,6 +667,7 @@
Показать недействительные
Скрыть недействительные
Удалить элементы
+ Сортировать элементы
Найдены сохраненные параметры
Внимание: Если вы активируете подключение к невиртуальной помпе, AndroidAPS скопирует настройки базала в профиль помпы, перезаписывая существующие настройки, хранящиеся в ней. Убедитесь, что настройки базала в AndroidAPS корректны. Если вы не уверены или не хотите перезаписать настройки базала на помпу, нажмите отменить и повторите подключение в другое время.
Данные терапии неполные
@@ -878,6 +882,7 @@
Принимать переключения профиля, введенные через NS или NSClient
Принимать события APS автономно
Принимать события APS введенные через NS или клиент NS автономно
+ Получать временную базальную скорость TBR и пролонгированный болюс EB
Принимать инсулин
Принимать инсулин, введенный через NS или NSClient (не подается, только рассчитывается как активный IOB)
Принимать углеводы
diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml
index e0fe1138c7..15d6716138 100644
--- a/app/src/main/res/values-tr-rTR/strings.xml
+++ b/app/src/main/res/values-tr-rTR/strings.xml
@@ -986,6 +986,8 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Bilinmeyen eylem komutu:
Yüzde
Uygulama varsayılanı
+ Geçersiz kılınan / kaldırılan kayıtları göster
+ Geçersiz kılınan / kaldırılan kayıtları gizle
Düzenlenecek profili seç
Nightscout\'tan Yenile
Seçili nesneleri kaldır
@@ -998,7 +1000,10 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Döngüyü göster
%1$d seçildi
Sırala
+ İletişim kutusu iptal edildi
Altında
Aralık içinde
Üstünde
+ Döngü kayıtlarını göster
+ Döngü kayıtlarını gizle
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 4ec05a9e7a..df0ace5e89 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -997,6 +997,7 @@
显示闭环
已选中 %1$d
排序
+ 对话框已取消
底部
在范围内
上方
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
index 15d72f6682..c27f843e97 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationFragment.kt
@@ -173,10 +173,10 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val automation = automationPlugin.at(position)
holder.binding.rootLayout.setBackgroundColor(
- rh.gc(
- if (automation.userAction) R.color.mdtp_line_dark
- else if (automation.areActionsValid()) R.color.ribbonDefault
- else R.color.errorAlertBackground
+ rh.gac( context,
+ if (automation.userAction) R.attr.userAction
+ else if (automation.areActionsValid()) R.attr.validActions
+ else R.attr.actionsError
)
)
holder.binding.eventTitle.text = automation.title
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt
index 57ef1c09c7..2e31509ff8 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/elements/StaticLabel.kt
@@ -4,6 +4,7 @@ import android.graphics.Typeface
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
+import info.nightscout.androidaps.automation.R
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
import info.nightscout.androidaps.utils.resources.ResourceHelper
@@ -28,7 +29,7 @@ class StaticLabel(private val rh: ResourceHelper) : Element() {
LinearLayout(root.context).apply {
orientation = LinearLayout.HORIZONTAL
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
- setBackgroundColor(rh.gc(android.R.color.black))
+ setBackgroundColor(rh.gac(context, R.attr.automationBackgroundColor))
addView(
TextView(root.context).apply {
text = label
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt
index 31de36e247..65f910a658 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerConnector.kt
@@ -165,7 +165,7 @@ class TriggerConnector(injector: HasAndroidInjector) : Trigger(injector) {
text = rh.gs(connectorType.stringRes)
gravity = gravity or Gravity.CENTER_VERTICAL
setTypeface(typeface, Typeface.BOLD)
- setBackgroundColor(rh.gc(R.color.black_overlay))
+ setBackgroundColor(rh.gac(context, R.attr.automationOverlayColor))
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT).also { ll ->
ll.setMargins(rh.dpToPx(3), rh.dpToPx(3), rh.dpToPx(3), rh.dpToPx(3))
}
diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
index abc3f676f5..b0fc0d809c 100644
--- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
+++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboFragment.java
@@ -134,33 +134,33 @@ public class ComboFragment extends DaggerFragment {
PumpState ps = comboPlugin.getPump().state;
if (ps.insulinState == PumpState.EMPTY || ps.batteryState == PumpState.EMPTY
|| ps.activeAlert != null && ps.activeAlert.errorCode != null) {
- stateView.setTextColor(Color.RED);
+ stateView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
stateView.setTypeface(null, Typeface.BOLD);
} else if (comboPlugin.getPump().state.suspended
|| ps.activeAlert != null && ps.activeAlert.warningCode != null) {
- stateView.setTextColor(Color.YELLOW);
+ stateView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
stateView.setTypeface(null, Typeface.BOLD);
} else {
- stateView.setTextColor(Color.WHITE);
+ stateView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
stateView.setTypeface(null, Typeface.NORMAL);
}
// activity
String activity = comboPlugin.getPump().activity;
if (activity != null) {
- activityView.setTextColor(Color.WHITE);
+ activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
activityView.setTextSize(14);
activityView.setText(activity);
} else if (commandQueue.size() > 0) {
- activityView.setTextColor(Color.WHITE);
+ activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
activityView.setTextSize(14);
activityView.setText("");
} else if (comboPlugin.isInitialized()) {
- activityView.setTextColor(Color.WHITE);
+ activityView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
activityView.setTextSize(20);
activityView.setText("{fa-bed}");
} else {
- activityView.setTextColor(Color.RED);
+ activityView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
activityView.setTextSize(14);
activityView.setText(rh.gs(R.string.pump_unreachable));
}
@@ -170,10 +170,10 @@ public class ComboFragment extends DaggerFragment {
batteryView.setTextSize(20);
if (ps.batteryState == PumpState.EMPTY) {
batteryView.setText("{fa-battery-empty}");
- batteryView.setTextColor(Color.RED);
+ batteryView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
} else if (ps.batteryState == PumpState.LOW) {
batteryView.setText("{fa-battery-quarter}");
- batteryView.setTextColor(Color.YELLOW);
+ batteryView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
} else {
batteryView.setText("{fa-battery-full}");
batteryView.setTextColor(Color.WHITE);
@@ -192,16 +192,16 @@ public class ComboFragment extends DaggerFragment {
}
if (ps.insulinState == PumpState.UNKNOWN) {
- reservoirView.setTextColor(Color.WHITE);
+ reservoirView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
reservoirView.setTypeface(null, Typeface.NORMAL);
} else if (ps.insulinState == PumpState.LOW) {
- reservoirView.setTextColor(Color.YELLOW);
+ reservoirView.setTextColor(rh.gac(getContext(), R.attr.omniYellowColor));
reservoirView.setTypeface(null, Typeface.BOLD);
} else if (ps.insulinState == PumpState.EMPTY) {
- reservoirView.setTextColor(Color.RED);
+ reservoirView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
reservoirView.setTypeface(null, Typeface.BOLD);
} else {
- reservoirView.setTextColor(Color.WHITE);
+ reservoirView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
reservoirView.setTypeface(null, Typeface.NORMAL);
}
@@ -210,13 +210,13 @@ public class ComboFragment extends DaggerFragment {
long min = (System.currentTimeMillis() - comboPlugin.getPump().lastSuccessfulCmdTime) / 1000 / 60;
if (comboPlugin.getPump().lastSuccessfulCmdTime + 60 * 1000 > System.currentTimeMillis()) {
lastConnectionView.setText(R.string.combo_pump_connected_now);
- lastConnectionView.setTextColor(Color.WHITE);
+ lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
} else if (comboPlugin.getPump().lastSuccessfulCmdTime + 30 * 60 * 1000 < System.currentTimeMillis()) {
lastConnectionView.setText(rh.gs(R.string.combo_no_pump_connection, min));
- lastConnectionView.setTextColor(Color.RED);
+ lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.warningColor));
} else {
lastConnectionView.setText(minAgo);
- lastConnectionView.setTextColor(Color.WHITE);
+ lastConnectionView.setTextColor(rh.gac(getContext(), R.attr.defaultTextColor));
}
// last bolus
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/activities/NoSplashAppCompatActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt
index c8f9888ec6..430c562448 100644
--- a/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt
+++ b/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt
@@ -1,15 +1,33 @@
package info.nightscout.androidaps.activities
-
import android.content.Context
import android.os.Bundle
import info.nightscout.androidaps.core.R
+import info.nightscout.androidaps.events.EventThemeSwitch
+import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.locale.LocaleHelper
+import io.reactivex.rxjava3.disposables.CompositeDisposable
+import javax.inject.Inject
+
open class NoSplashAppCompatActivity : DaggerAppCompatActivityWithResult() {
- override fun onCreate(savedInstanceState: Bundle?) {
+ @Inject lateinit var rxBus: RxBus
+
+ private val compositeDisposable = CompositeDisposable()
+
+ public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setTheme(R.style.AppTheme_NoActionBar)
+
+ compositeDisposable.add(rxBus.toObservable(EventThemeSwitch::class.java).subscribe {
+ recreate()
+ })
+
+ }
+
+ override fun onDestroy() {
+ compositeDisposable.clear()
+ super.onDestroy()
}
override fun attachBaseContext(newBase: Context) {
diff --git a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt
index c5bfd4a69b..b07f66f893 100644
--- a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt
+++ b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt
@@ -44,7 +44,6 @@ import kotlin.math.roundToInt
class TDDStatsActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var activePlugin: ActivePlugin
@@ -89,27 +88,27 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// add stats headers to tables
binding.mainTable.addView(
TableRow(this).also { trHead ->
- trHead.setBackgroundColor(Color.DKGRAY)
+ trHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
trHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
trHead.addView(TextView(this).also { labelDate ->
labelDate.text = rh.gs(R.string.date)
- labelDate.setTextColor(Color.WHITE)
+ labelDate.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelBasalRate ->
labelBasalRate.text = rh.gs(R.string.basalrate)
- labelBasalRate.setTextColor(Color.WHITE)
+ labelBasalRate.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelBolus ->
labelBolus.text = rh.gs(R.string.bolus)
- labelBolus.setTextColor(Color.WHITE)
+ labelBolus.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelTdd ->
labelTdd.text = rh.gs(R.string.tdd)
- labelTdd.setTextColor(Color.WHITE)
+ labelTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
trHead.addView(TextView(this).also { labelRatio ->
labelRatio.text = rh.gs(R.string.ratio)
- labelRatio.setTextColor(Color.WHITE)
+ labelRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@@ -117,19 +116,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// cumulative table
binding.cumulativeTable.addView(
TableRow(this).also { ctrHead ->
- ctrHead.setBackgroundColor(Color.DKGRAY)
+ ctrHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
ctrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
ctrHead.addView(TextView(this).also { labelCumAmountDays ->
labelCumAmountDays.text = rh.gs(R.string.amount_days)
- labelCumAmountDays.setTextColor(Color.WHITE)
+ labelCumAmountDays.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctrHead.addView(TextView(this).also { labelCumTdd ->
labelCumTdd.text = rh.gs(R.string.tdd)
- labelCumTdd.setTextColor(Color.WHITE)
+ labelCumTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctrHead.addView(TextView(this).also { labelCumRatio ->
labelCumRatio.text = rh.gs(R.string.ratio)
- labelCumRatio.setTextColor(Color.WHITE)
+ labelCumRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@@ -137,19 +136,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// exponential table
binding.expweightTable.addView(
TableRow(this).also { etrHead ->
- etrHead.setBackgroundColor(Color.DKGRAY)
+ etrHead.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
etrHead.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
etrHead.addView(TextView(this).also { labelExpWeight ->
labelExpWeight.text = rh.gs(R.string.weight)
- labelExpWeight.setTextColor(Color.WHITE)
+ labelExpWeight.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etrHead.addView(TextView(this).also { labelExpTdd ->
labelExpTdd.text = rh.gs(R.string.tdd)
- labelExpTdd.setTextColor(Color.WHITE)
+ labelExpTdd.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etrHead.addView(TextView(this).also { labelExpRatio ->
labelExpRatio.text = rh.gs(R.string.ratio)
- labelExpRatio.setTextColor(Color.WHITE)
+ labelExpRatio.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@@ -285,9 +284,9 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// Create the table row
binding.mainTable.addView(
TableRow(this@TDDStatsActivity).also { tr ->
- if (i % 2 != 0) tr.setBackgroundColor(Color.DKGRAY)
+ if (i % 2 != 0) tr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
if (dummies.contains(record))
- tr.setBackgroundColor(Color.argb(125, 255, 0, 0))
+ tr.setBackgroundColor(rh.gac(this, R.attr.dummyBackground))
tr.id = 100 + i
tr.layoutParams = TableLayout.LayoutParams(
@@ -299,27 +298,27 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
tr.addView(TextView(this@TDDStatsActivity).also { labelDATE ->
labelDATE.id = 200 + i
labelDATE.text = df1.format(Date(record.timestamp))
- labelDATE.setTextColor(Color.WHITE)
+ labelDATE.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL ->
labelBASAL.id = 300 + i
labelBASAL.text = rh.gs(R.string.formatinsulinunits, record.basalAmount)
- labelBASAL.setTextColor(Color.WHITE)
+ labelBASAL.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS ->
labelBOLUS.id = 400 + i
labelBOLUS.text = rh.gs(R.string.formatinsulinunits, record.bolusAmount)
- labelBOLUS.setTextColor(Color.WHITE)
+ labelBOLUS.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelTDD ->
labelTDD.id = 500 + i
labelTDD.text = rh.gs(R.string.formatinsulinunits, tdd)
- labelTDD.setTextColor(Color.WHITE)
+ labelTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO ->
labelRATIO.id = 600 + i
labelRATIO.text = (100 * tdd / magicNumber).roundToInt().toString() + "%"
- labelRATIO.setTextColor(Color.WHITE)
+ labelRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@@ -338,7 +337,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// Create the cumulative table row
binding.cumulativeTable.addView(
TableRow(this@TDDStatsActivity).also { ctr ->
- if (i % 2 == 0) ctr.setBackgroundColor(Color.DKGRAY)
+ if (i % 2 == 0) ctr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
ctr.id = 700 + i
ctr.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@@ -346,19 +345,19 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
ctr.addView(TextView(this@TDDStatsActivity).also { labelDAYS ->
labelDAYS.id = 800 + i
labelDAYS.text = i.toString()
- labelDAYS.setTextColor(Color.WHITE)
+ labelDAYS.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD ->
labelCUMTDD.id = 900 + i
labelCUMTDD.text = rh.gs(R.string.formatinsulinunits, sum / i)
- labelCUMTDD.setTextColor(Color.WHITE)
+ labelCUMTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMRATIO ->
labelCUMRATIO.id = 1000 + i
labelCUMRATIO.text = (100 * sum / i / magicNumber).roundToInt().toString() + "%"
- labelCUMRATIO.setTextColor(Color.WHITE)
+ labelCUMRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
@@ -366,7 +365,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
if (isOldData(historyList) && activePlugin.activePump.pumpDescription.needsManualTDDLoad) {
binding.message.visibility = View.VISIBLE
binding.message.text = rh.gs(R.string.olddata_Message)
- } else binding.mainTable.setBackgroundColor(Color.TRANSPARENT)
+ } else binding.mainTable.setBackgroundColor(rh.gac(this, R.attr.mainTableBackground))
if (historyList.isNotEmpty() && df1.format(Date(historyList[0].timestamp)) == df1.format(Date())) {
//Today should not be included
historyList.removeAt(0)
@@ -390,7 +389,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
// Create the exponential table row
binding.expweightTable.addView(
TableRow(this@TDDStatsActivity).also { etr ->
- if (i % 2 != 0) etr.setBackgroundColor(Color.DKGRAY)
+ if (i % 2 != 0) etr.setBackgroundColor(rh.gac(this, R.attr.tddHeaderBackground))
etr.id = 1100 + i
etr.layoutParams = TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
@@ -398,7 +397,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
etr.addView(TextView(this@TDDStatsActivity).also { labelWEIGHT ->
labelWEIGHT.id = 1200 + i
labelWEIGHT.text = "0.3\n0.5\n0.7"
- labelWEIGHT.setTextColor(Color.WHITE)
+ labelWEIGHT.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD ->
labelEXPTDD.id = 1300 + i
@@ -407,7 +406,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
${rh.gs(R.string.formatinsulinunits, weighted05)}
${rh.gs(R.string.formatinsulinunits, weighted07)}
""".trimIndent()
- labelEXPTDD.setTextColor(Color.WHITE)
+ labelEXPTDD.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
etr.addView(TextView(this@TDDStatsActivity).also { labelEXPRATIO ->
labelEXPRATIO.id = 1400 + i
@@ -416,7 +415,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
${(100 * weighted05 / magicNumber).roundToInt()}%
${(100 * weighted07 / magicNumber).roundToInt()}%
""".trimIndent()
- labelEXPRATIO.setTextColor(Color.WHITE)
+ labelEXPRATIO.setTextColor(rh.gac(this, R.attr.defaultTextColor))
})
}, TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)
)
diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt b/core/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt
similarity index 96%
rename from app/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt
rename to core/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt
index 37cbef5ae3..8876540f00 100644
--- a/app/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt
+++ b/core/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt
@@ -1,3 +1,3 @@
-package info.nightscout.androidaps.events
-
-class EventThemeSwitch : Event()
+package info.nightscout.androidaps.events
+
+class EventThemeSwitch : Event()
diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt
index 74be8377e4..040a3d65cd 100644
--- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt
+++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt
@@ -87,8 +87,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
prefFile.metadata[PrefsMetadataKey.AAPS_FLAVOUR]?.let {
metaVariantFormat.text = it.value
- val color = if (it.status == PrefsStatus.OK) R.color.metadataOk else R.color.metadataTextWarning
- metaVariantFormat.setTextColor(rh.gc(color))
+ val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor
+ metaVariantFormat.setTextColor(rh.gac( metaVariantFormat.context, colorattr))
}
prefFile.metadata[PrefsMetadataKey.CREATED_AT]?.let {
@@ -97,8 +97,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
prefFile.metadata[PrefsMetadataKey.AAPS_VERSION]?.let {
metaAppVersion.text = it.value
- val color = if (it.status == PrefsStatus.OK) R.color.metadataOk else R.color.metadataTextWarning
- metaAppVersion.setTextColor(rh.gc(color))
+ val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor
+ metaAppVersion.setTextColor(rh.gac( metaVariantFormat.context, colorattr))
}
prefFile.metadata[PrefsMetadataKey.DEVICE_NAME]?.let {
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/core/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt b/core/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt
index 0114d51601..477b092343 100644
--- a/core/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt
+++ b/core/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt
@@ -1,6 +1,5 @@
package info.nightscout.androidaps.utils
-import android.graphics.Color
import android.widget.TextView
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.database.entities.TherapyEvent
@@ -12,28 +11,25 @@ import javax.inject.Singleton
@Singleton
class WarnColors @Inject constructor(val rh: ResourceHelper) {
- private val normalColor = Color.WHITE
- private val warnColor = Color.YELLOW
- private val urgentColor = Color.RED
fun setColor(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
- view?.setTextColor(when {
- value >= urgentLevel -> urgentColor
- value >= warnLevel -> warnColor
- else -> normalColor
- })
+ view?.setTextColor( rh.gac( view.context ,when {
+ value >= urgentLevel -> R.attr.urgentColor
+ value >= warnLevel -> R.attr.warnColor
+ else -> R.attr.defaultTextColor
+ }))
fun setColorInverse(view: TextView?, value: Double, warnLevel: Double, urgentLevel: Double) =
- view?.setTextColor(when {
- value <= urgentLevel -> urgentColor
- value <= warnLevel -> warnColor
- else -> normalColor
- })
+ view?.setTextColor( rh.gac( view.context , when {
+ value <= urgentLevel -> R.attr.urgentColor
+ value <= warnLevel -> R.attr.warnColor
+ else -> R.attr.defaultTextColor
+ }))
fun setColorByAge(view: TextView?, therapyEvent: TherapyEvent, warnThreshold: Double, urgentThreshold: Double) =
- view?.setTextColor(when {
- therapyEvent.isOlderThan(urgentThreshold) -> rh.gc(R.color.low)
- therapyEvent.isOlderThan(warnThreshold) -> rh.gc(R.color.high)
- else -> Color.WHITE
- })
+ view?.setTextColor( rh.gac( view.context , when {
+ therapyEvent.isOlderThan(urgentThreshold) -> R.attr.lowColor
+ therapyEvent.isOlderThan(warnThreshold) -> R.attr.highColor
+ else -> R.attr.defaultTextColor
+ }))
}
\ No newline at end of file
diff --git a/core/src/main/res/drawable-hdpi/background_total.xml b/core/src/main/res/drawable-hdpi/background_total.xml
index 0a84006dee..e37fbd2035 100644
--- a/core/src/main/res/drawable-hdpi/background_total.xml
+++ b/core/src/main/res/drawable-hdpi/background_total.xml
@@ -3,6 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
-
+
\ No newline at end of file
diff --git a/core/src/main/res/drawable-hdpi/border_gray.xml b/core/src/main/res/drawable-hdpi/border_gray.xml
index 7635f80234..a67f54bf90 100644
--- a/core/src/main/res/drawable-hdpi/border_gray.xml
+++ b/core/src/main/res/drawable-hdpi/border_gray.xml
@@ -3,7 +3,7 @@
-
-
+
diff --git a/core/src/main/res/drawable/ic_actions_startextbolus.xml b/core/src/main/res/drawable/ic_actions_startextbolus.xml
index 35aa4cfb27..8d7f5bc3db 100644
--- a/core/src/main/res/drawable/ic_actions_startextbolus.xml
+++ b/core/src/main/res/drawable/ic_actions_startextbolus.xml
@@ -4,6 +4,7 @@
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
-
-
+
+
diff --git a/core/src/main/res/drawable/ic_bolus.xml b/core/src/main/res/drawable/ic_bolus.xml
index 6bbe19f3fc..83b67c9989 100644
--- a/core/src/main/res/drawable/ic_bolus.xml
+++ b/core/src/main/res/drawable/ic_bolus.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
diff --git a/core/src/main/res/drawable/ic_calculator.xml b/core/src/main/res/drawable/ic_calculator.xml
index 300e971bf4..3bd3d2e78d 100644
--- a/core/src/main/res/drawable/ic_calculator.xml
+++ b/core/src/main/res/drawable/ic_calculator.xml
@@ -4,11 +4,12 @@
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_calibration.xml b/core/src/main/res/drawable/ic_calibration.xml
index cf3f592a41..3a1b98bcd4 100644
--- a/core/src/main/res/drawable/ic_calibration.xml
+++ b/core/src/main/res/drawable/ic_calibration.xml
@@ -5,11 +5,11 @@
android:viewportHeight="24">
+ android:fillColor="?attr/icCalibrationColor"/>
+ android:fillColor="?attr/icCalibrationColor"/>
+ android:fillColor="?attr/icCalibrationColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_announcement.xml b/core/src/main/res/drawable/ic_cp_announcement.xml
index 3799ad551c..1488a6e33a 100644
--- a/core/src/main/res/drawable/ic_cp_announcement.xml
+++ b/core/src/main/res/drawable/ic_cp_announcement.xml
@@ -5,17 +5,17 @@
android:viewportHeight="24">
+ android:fillColor="?attr/announcementColor"/>
+ android:fillColor="?attr/announcementColor"/>
+ android:fillColor="?attr/announcementColor"/>
+ android:fillColor="?attr/announcementColor"/>
+ android:fillColor="?attr/announcementColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_bgcheck.xml b/core/src/main/res/drawable/ic_cp_bgcheck.xml
index 76a9bbe22f..9448450909 100644
--- a/core/src/main/res/drawable/ic_cp_bgcheck.xml
+++ b/core/src/main/res/drawable/ic_cp_bgcheck.xml
@@ -5,11 +5,11 @@
android:viewportHeight="24">
+ android:fillColor="?attr/calibrationButtonColor"/>
+ android:fillColor="?attr/calibrationButtonColor"/>
+ android:fillColor="?attr/calibrationButtonColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_bolus_carbs.xml b/core/src/main/res/drawable/ic_cp_bolus_carbs.xml
index e21b236b4e..dc22cbd2b5 100644
--- a/core/src/main/res/drawable/ic_cp_bolus_carbs.xml
+++ b/core/src/main/res/drawable/ic_cp_bolus_carbs.xml
@@ -4,5 +4,6 @@
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
-
+
diff --git a/core/src/main/res/drawable/ic_cp_cgm_insert.xml b/core/src/main/res/drawable/ic_cp_cgm_insert.xml
index 30107ac8fe..20e16e9b7d 100644
--- a/core/src/main/res/drawable/ic_cp_cgm_insert.xml
+++ b/core/src/main/res/drawable/ic_cp_cgm_insert.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/cgmInsertColor"/>
+ android:fillColor="?attr/cgmInsertColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_exercise.xml b/core/src/main/res/drawable/ic_cp_exercise.xml
index de04c4ecce..60b246221d 100644
--- a/core/src/main/res/drawable/ic_cp_exercise.xml
+++ b/core/src/main/res/drawable/ic_cp_exercise.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/exerciseColor"/>
+ android:fillColor="?attr/exerciseColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_note.xml b/core/src/main/res/drawable/ic_cp_note.xml
index 8308aabedf..9b0459d1bb 100644
--- a/core/src/main/res/drawable/ic_cp_note.xml
+++ b/core/src/main/res/drawable/ic_cp_note.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24">
+ android:fillColor="?attr/noteColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_pump_battery.xml b/core/src/main/res/drawable/ic_cp_pump_battery.xml
index e83067fded..f83d3289c1 100644
--- a/core/src/main/res/drawable/ic_cp_pump_battery.xml
+++ b/core/src/main/res/drawable/ic_cp_pump_battery.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/pumpBatteryColor"/>
+ android:fillColor="?attr/pumpBatteryColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_pump_canula.xml b/core/src/main/res/drawable/ic_cp_pump_canula.xml
index b43de7ceaa..7e8bce4d17 100644
--- a/core/src/main/res/drawable/ic_cp_pump_canula.xml
+++ b/core/src/main/res/drawable/ic_cp_pump_canula.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24">
+ android:fillColor="?attr/pumpCanulaColor"/>
diff --git a/core/src/main/res/drawable/ic_cp_question.xml b/core/src/main/res/drawable/ic_cp_question.xml
index fc6d14c656..11e4f2cff6 100644
--- a/core/src/main/res/drawable/ic_cp_question.xml
+++ b/core/src/main/res/drawable/ic_cp_question.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/questionColor"/>
+ android:fillColor="?attr/questionColor"/>
diff --git a/core/src/main/res/drawable/ic_fortyfiveup.xml b/core/src/main/res/drawable/ic_fortyfiveup.xml
index 930857ec66..cb3fa33a08 100644
--- a/core/src/main/res/drawable/ic_fortyfiveup.xml
+++ b/core/src/main/res/drawable/ic_fortyfiveup.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24">
+ android:fillColor="?attr/icCheckboxTrendColor"/>
diff --git a/core/src/main/res/drawable/ic_loop_closed.xml b/core/src/main/res/drawable/ic_loop_closed.xml
index 9bddec63b6..110a3537ee 100644
--- a/core/src/main/res/drawable/ic_loop_closed.xml
+++ b/core/src/main/res/drawable/ic_loop_closed.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24">
+ android:fillColor="?attr/loopClosed"/>
diff --git a/core/src/main/res/drawable/ic_pump_history.xml b/core/src/main/res/drawable/ic_pump_history.xml
index d4ef6ac5f0..fbd047a23a 100644
--- a/core/src/main/res/drawable/ic_pump_history.xml
+++ b/core/src/main/res/drawable/ic_pump_history.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/pumpHistoryColor"/>
+ android:fillColor="?attr/pumpHistoryColor"/>
diff --git a/core/src/main/res/drawable/ic_quick_wizard.xml b/core/src/main/res/drawable/ic_quick_wizard.xml
index b2d1f2569b..8e5d42cd3e 100644
--- a/core/src/main/res/drawable/ic_quick_wizard.xml
+++ b/core/src/main/res/drawable/ic_quick_wizard.xml
@@ -4,9 +4,10 @@
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
-
-
-
-
-
+
+
+
+
+
diff --git a/core/src/main/res/drawable/ic_temptarget_high.xml b/core/src/main/res/drawable/ic_temptarget_high.xml
index 9fbfe2eb08..ae0e9799ca 100644
--- a/core/src/main/res/drawable/ic_temptarget_high.xml
+++ b/core/src/main/res/drawable/ic_temptarget_high.xml
@@ -5,8 +5,8 @@
android:viewportHeight="24">
+ android:fillColor="?attr/bgInRange"/>
+ android:fillColor="?attr/tempTargetConfirmation"/>
diff --git a/core/src/main/res/layout/activity_tdd_stats.xml b/core/src/main/res/layout/activity_tdd_stats.xml
index 5f1d7dad33..850d7e0e3a 100644
--- a/core/src/main/res/layout/activity_tdd_stats.xml
+++ b/core/src/main/res/layout/activity_tdd_stats.xml
@@ -179,7 +179,7 @@
%1$.0f%%
Bazál
Bazál %
+ Vybráno: %1$d
+ Seřadit
+ Odebrat položky
+ Seřadit položky
+ Odebrat vybrané položky
- %1$d den
- %1$d dnů
diff --git a/core/src/main/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml
index 484f00440b..bee8dee661 100644
--- a/core/src/main/res/values-es-rES/strings.xml
+++ b/core/src/main/res/values-es-rES/strings.xml
@@ -460,6 +460,11 @@
%1$.0f%%
Basal
Basal %
+ %1$d seleccionados
+ Ordenar
+ Eliminar elementos
+ Ordenar elementos
+ Eliminar los elementos seleccionados
- %1$d día
- %1$d días
diff --git a/core/src/main/res/values-night/colors.xml b/core/src/main/res/values-night/colors.xml
index f667f08368..ba771afa38 100644
--- a/core/src/main/res/values-night/colors.xml
+++ b/core/src/main/res/values-night/colors.xml
@@ -9,7 +9,6 @@
#808080
#d8d8d8
#212121
- #66000000
#BBBBBB
#FF000000
#FFFFFFFF
@@ -172,6 +171,7 @@
#77dd77
#66FC0000
@color/colorPrimaryDark
+ #7DFF0000
#77dd77
#67DFE8
@@ -204,17 +204,83 @@
#000000
+ #FEAF05
+ #CF8BFE
+ #67dfe8
+ #67dfe8
+ #36FF00
+ #FEAF05
+ #CF8BFE
+ #FEAF05
+ #67DFE8
+
#323232
#424242
#3C3C3C
#666666
+ #999999
#8c8c8c
#72000000
#c8666666
- #B2B2B2
+ #B2B2B2
#4dB1B1B1
#33969696
#EBEBEA
+
+ #FFFF00
+ #00FFFF
+ #00FF00
+
+
+ #9E9E9E
+
+
+ #0099CC
+ #ff669900
+ #77DD77
+
+
+ #FF4444
+ @color/pod_icon_outline
+ #4CAF50
+ @color/pod_icon_outline
+ @color/pod_icon_outline
+ #42A5F5
+ @color/pod_icon_outline
+ #67E86A
+ @color/pod_icon_outline
+ #B39DDB
+ @color/pod_icon_outline
+ #ffbf00
+ @color/pod_icon_outline
+
+
+ #67E86A
+ @color/pod_icon_outline
+ #FF4444
+ @color/pod_icon_outline
+ #85F803
+ @color/pod_icon_outline
+ #ffbf00
+ @color/pod_icon_outline
+ #4DD0E1
+ @color/pod_icon_outline
+ #FB8C00
+ @color/pod_icon_outline
+
+
+ #b9d2d2
+ #66BB6A
+ #FF7043
+
+
+ @color/rl_board_shape
+ @color/rl_icon_outline
+
+
+ @color/rl_board_shape
+ @color/rl_icon_outline
+
diff --git a/core/src/main/res/values-night/styles.xml b/core/src/main/res/values-night/styles.xml
index 65d6daa4fc..b55dc56cb4 100644
--- a/core/src/main/res/values-night/styles.xml
+++ b/core/src/main/res/values-night/styles.xml
@@ -29,7 +29,6 @@
- @color/notificationLow
- @color/notificationInfo
- @color/notificationAnnouncement
-
- @drawable/ic_close
- @color/bolus
@@ -47,14 +46,10 @@
- @color/colorSetTempButton
- @color/cardColorBackground
-
- - @color/carbs
- @color/exercise
- @color/low
-
- - @color/tempTargetConfirmation
- @color/colorSetExtendedButton
- @color/colorActive
@@ -121,11 +116,11 @@
- @color/white_alpha_20
- @color/tempTargetBackground
- - @color/colorLightGray
+ - @color/byodagray
- @color/colorCalibrationButton
- @color/low
- - @color/high
+ - @color/high
- @color/inrange
- @color/helperProfile
@@ -142,6 +137,72 @@
- @color/info
- @color/cobAlert
+
+ - @color/actionsConfirm
+
+ - @color/prediction
+ - @color/omni_yellow
+ - @color/omni_cyan
+ - @color/omni_green
+ - @color/midgray
+ - @color/omnipod_wizard_finish_button
+
+ - @color/omni_yellow
+ - @color/alarm
+
+ - @color/mdtp_line_dark
+ - @color/ribbonDefault
+ - @color/errorAlertBackground
+ - @color/black
+ - @color/black_alpha_40
+
+ - @color/errorAlertBackground
+
+ - @android:color/darker_gray
+ - @android:color/transparent
+ - @color/dummy_background
+
+ - @color/white
+
+ - @color/colorInsulinButton
+ - @color/colorCarbsButton
+ - @color/colorCalculatorButton
+ - @color/colorQuickWizardButton
+ - @color/colorCalibrationButton
+ - @color/colorTreatmentButton
+
+ - @color/iob
+
+ - @color/basal
+
+ - @color/carbs
+
+ - @color/tempTargetConfirmation
+
+
+ - @color/loopSuspended
+
+ - @color/loopClosed
+
+ - @color/loopDisabled
+
+ - @color/loopDisconnected
+
+ - @color/loopOpened
+
+ - @color/carbs
+
+ - @color/extendedBolus
+ - @color/extBolusStop
+ - @color/actionBasal
+ - @color/actionBasal
+ - @color/pumpCanula
+ - @color/cgmInsert
+ - @color/pumpBattery
+ - @color/note
+ - @color/announcement
+ - @color/question
+ - @color/pumpHistory
diff --git a/core/src/main/res/values-no-rNO/strings.xml b/core/src/main/res/values-no-rNO/strings.xml
index 94b2b01837..37828eed67 100644
--- a/core/src/main/res/values-no-rNO/strings.xml
+++ b/core/src/main/res/values-no-rNO/strings.xml
@@ -460,6 +460,11 @@
%1$.0f%%
Basal
Basal %
+ %1$d valgt
+ Sorter
+ Slett elementer
+ Sorter elementer
+ Slett valgte elementer
- %1$d dag
- %1$d dager
diff --git a/core/src/main/res/values-tr-rTR/strings.xml b/core/src/main/res/values-tr-rTR/strings.xml
index e722f9e70b..1f2d882edc 100644
--- a/core/src/main/res/values-tr-rTR/strings.xml
+++ b/core/src/main/res/values-tr-rTR/strings.xml
@@ -460,6 +460,11 @@
%1$.0f%%
Bazal
Bazal %
+ %1$d seçildi
+ Sırala
+ Öğeleri kaldır
+ Öğeleri Sırala
+ Seçilen öğeleri kaldır
- %1$d gün
- %1$d gün
diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml
index f222082e76..c7c2ca658d 100644
--- a/core/src/main/res/values/attrs.xml
+++ b/core/src/main/res/values/attrs.xml
@@ -99,7 +99,7 @@
-
+
@@ -109,6 +109,10 @@
+
+
+
+
@@ -116,4 +120,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml
index 99fd9e47a4..ca608ef91c 100644
--- a/core/src/main/res/values/colors.xml
+++ b/core/src/main/res/values/colors.xml
@@ -9,7 +9,6 @@
#808080
#d8d8d8
@color/lightgray
- #66000000
#BBBBBB
#FF000000
#FFFFFFFF
@@ -33,11 +32,11 @@
#FFFFFF
- #d0d0d0
- @color/white
+ @color/black_alpha_90
+ @color/black_alpha_90
- #555555
+ #888888
#ffffff
@color/colorAccent
#33969696
@@ -49,7 +48,7 @@
- #505050
+ #CCCCCC
#CCCCCC
@@ -81,9 +80,9 @@
#00FF00
#FF0000
- #FFFF00
+ #FFFB8C00
#1e88e5
- #67DFE8
+ #1e88e5
#1ea3e5
#FFFB8C00
#FFFB8C00
@@ -150,9 +149,9 @@
#f4d700
#ff0400
- #000000
+ #FFFFFF
#303030
- #77dd77
+ #6BD16B
#ff00ff
#00d2d2
@@ -173,22 +172,23 @@
#77dd77
#66FC0000
@color/white
+ #7DFF0000
#77dd77
- #67DFE8
+ #42A5F5
#ffffbb33
#ffff4444
#779ECB
- #f4d700
+ #ffffbb33
#67dfe8
#67dfe8
- #ffae01
+ #E19701
#e93057
- #67e86a
- #ffae01
+ #66BB6A
+ #E19701
#FF478EFF
#FFDD7792
#ca77dd
@@ -205,17 +205,96 @@
#FFFFFF
+ #FEAF05
+ #CF8BFE
+ #42A5F5
+ #42A5F5
+ #66BB6A
+ #FEAF05
+ #CF8BFE
+ #FEAF05
+ #42A5F5
+
#323232
#424242
#3C3C3C
#666666
+ #777777
#8c8c8c
#72000000
#c8666666
- #B2B2B2
+ #B2B2B2
#4dB1B1B1
#33969696
#EBEBEA
+
+ #FFFF00
+ #00FFFF
+ #00FF00
+
+
+ #9E9E9E
+
+
+ #0099CC
+ #ff669900
+ #77DD77
+
+
+ #FF4444
+ @color/pod_icon_outline
+ #4CAF50
+ @color/pod_icon_outline
+ @color/pod_icon_outline
+ #42A5F5
+ @color/pod_icon_outline
+ #67E86A
+ @color/pod_icon_outline
+ #B39DDB
+ @color/pod_icon_outline
+ #ffbf00
+ @color/pod_icon_outline
+
+
+ #67E86A
+ @color/pod_icon_outline
+ #FF4444
+ @color/pod_icon_outline
+ #85F803
+ @color/pod_icon_outline
+ #ffbf00
+ @color/pod_icon_outline
+ #4DD0E1
+ @color/pod_icon_outline
+ #FB8C00
+ @color/pod_icon_outline
+
+
+ #b9d2d2
+ #66BB6A
+ #FF7043
+
+
+ @color/rl_board_shape
+ @color/rl_icon_outline
+
+
+ @color/rl_board_shape
+ @color/rl_icon_outline
+
+
+ #1D5FA5
+ #FFFFFF
+ #5954A8
+ #FFFFFF
+ #B3261E
+ #FFFFFF
+ #FFFBFE
+ #1C1B1F
+ #FFFBFE
+ #1C1B1F
+ #E7E0EC
+
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
index 92ac2d0bd0..d1f9e81951 100644
--- a/core/src/main/res/values/styles.xml
+++ b/core/src/main/res/values/styles.xml
@@ -2,25 +2,31 @@
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt
index b7055732c0..d978b295cf 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt
@@ -38,7 +38,6 @@ import javax.inject.Inject
class DanaHistoryActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var activePlugin: ActivePlugin
diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt
index 7c97bdf480..fed75385ff 100644
--- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt
+++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt
@@ -26,7 +26,6 @@ import kotlin.math.min
class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var context: Context
@Inject lateinit var danaPump: DanaPump
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt
index 5b4bc6c046..10b44fc242 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgCheckValue_k.kt
@@ -10,7 +10,7 @@ class MsgCheckValue_k(
) : MessageBase(injector) {
init {
- SetCommand(0xF0F1)
+ setCommand(0xF0F1)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt
index 11e62c7a8a..8097707145 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBasic_k.kt
@@ -13,7 +13,7 @@ class MsgInitConnStatusBasic_k(
) : MessageBase(injector) {
init {
- SetCommand(0x0303)
+ setCommand(0x0303)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt
index 4d683a9bc0..015c7fb7f3 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusBolus_k.kt
@@ -13,7 +13,7 @@ class MsgInitConnStatusBolus_k(
) : MessageBase(injector) {
init {
- SetCommand(0x0302)
+ setCommand(0x0302)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt
index eb512bd866..67b6f7a78d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgInitConnStatusTime_k.kt
@@ -14,7 +14,7 @@ class MsgInitConnStatusTime_k(
) : MessageBase(injector) {
init {
- SetCommand(0x0301)
+ setCommand(0x0301)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt
index 5ff2f8f56a..40376ff409 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasalProfileAll_k.kt
@@ -18,7 +18,7 @@ class MsgSettingBasalProfileAll_k(
) : MessageBase(injector) {
init {
- SetCommand(0x3206)
+ setCommand(0x3206)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt
index 878cf51dc1..d82af226a8 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgSettingBasal_k.kt
@@ -10,7 +10,7 @@ class MsgSettingBasal_k(
) : MessageBase(injector) {
init {
- SetCommand(0x3202)
+ setCommand(0x3202)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt
index f8a207d34d..65f29325a5 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatusBasic_k.kt
@@ -9,7 +9,7 @@ class MsgStatusBasic_k(
) : MessageBase(injector) {
init {
- SetCommand(0x020A)
+ setCommand(0x020A)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt
index 974c4cfccd..5e180cfdcc 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/comm/MsgStatus_k.kt
@@ -9,7 +9,7 @@ class MsgStatus_k(
) : MessageBase(injector) {
init {
- SetCommand(0x020B)
+ setCommand(0x020B)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
index a2b10c1f88..cb5992d77e 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.danaRKorean.services;
+import android.annotation.SuppressLint;
import android.os.Binder;
import android.os.SystemClock;
@@ -89,7 +90,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
}
}
- public void connect() {
+ @SuppressLint("MissingPermission") public void connect() {
if (mConnectionInProgress)
return;
@@ -135,7 +136,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
if (danaPump.isNewPump()) {
mSerialIOThread.sendMessage(checkValue);
- if (!checkValue.received) {
+ if (!checkValue.isReceived()) {
return;
}
}
@@ -280,7 +281,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
t.insulin = 0d;
return false;
}
- while (!danaPump.getBolusStopped() && !start.failed) {
+ while (!danaPump.getBolusStopped() && !start.getFailed()) {
SystemClock.sleep(100);
if ((System.currentTimeMillis() - danaPump.getBolusProgressLastTimeStamp()) > 15 * 1000L) { // if i didn't receive status for more than 15 sec expecting broken comm
danaPump.setBolusStopped(true);
@@ -294,7 +295,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
commandQueue.readStatus(rh.gs(R.string.bolus_ok), null);
}
- return !start.failed;
+ return !start.getFailed();
}
public boolean carbsEntry(int amount) {
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt
index 826726e8e3..2fc6a4dcfc 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgCheckValue_v2.kt
@@ -16,7 +16,7 @@ class MsgCheckValue_v2(
init {
- SetCommand(0xF0F1)
+ setCommand(0xF0F1)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEventsV2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEventsV2.kt
index 1812c4ad65..8373698a93 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEventsV2.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgHistoryEventsV2.kt
@@ -21,21 +21,21 @@ class MsgHistoryEventsV2 constructor(
}
init {
- SetCommand(0xE003)
+ setCommand(0xE003)
if (from > dateUtil.now()) {
aapsLogger.error("Asked to load from the future")
from = 0
}
if (from == 0L) {
- AddParamByte(0.toByte())
- AddParamByte(1.toByte())
- AddParamByte(1.toByte())
- AddParamByte(0.toByte())
- AddParamByte(0.toByte())
+ addParamByte(0.toByte())
+ addParamByte(1.toByte())
+ addParamByte(1.toByte())
+ addParamByte(0.toByte())
+ addParamByte(0.toByte())
} else {
val gFrom = GregorianCalendar()
gFrom.timeInMillis = from
- AddParamDate(gFrom)
+ addParamDate(gFrom)
}
aapsLogger.debug(LTag.PUMPCOMM, "Loading event history from: " + dateUtil.dateAndTimeString(from))
danaPump.historyDoneReceived = false
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt
index 4e5ebae459..b89791cc54 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetAPSTempBasalStart_v2.kt
@@ -16,16 +16,16 @@ class MsgSetAPSTempBasalStart_v2(
val PARAM15MIN = 150
init {
- SetCommand(0xE002)
+ setCommand(0xE002)
//HARDCODED LIMITS
if (percent < 0) percent = 0
if (percent > 500) percent = 500
- AddParamInt(percent)
+ addParamInt(percent)
if (thirtyMinutes && percent <= 200) { // 30 min is allowed up to 200%
- AddParamByte(PARAM30MIN.toByte())
+ addParamByte(PARAM30MIN.toByte())
aapsLogger.debug(LTag.PUMPCOMM, "APS Temp basal start percent: $percent duration 30 min")
} else {
- AddParamByte(PARAM15MIN.toByte())
+ addParamByte(PARAM15MIN.toByte())
aapsLogger.debug(LTag.PUMPCOMM, "APS Temp basal start percent: $percent duration 15 min")
}
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt
index e38b708888..4520925e82 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgSetHistoryEntry_v2.kt
@@ -11,13 +11,13 @@ class MsgSetHistoryEntry_v2(
) : MessageBase(injector) {
init {
- SetCommand(0xE004)
- AddParamByte(type.toByte())
+ setCommand(0xE004)
+ addParamByte(type.toByte())
val gtime = GregorianCalendar()
gtime.timeInMillis = time
- AddParamDateTime(gtime)
- AddParamInt(param1)
- AddParamInt(param2)
+ addParamDateTime(gtime)
+ addParamInt(param1)
+ addParamInt(param2)
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: type: " + type + " date: " + Date(time).toString() + " param1: " + param1 + " param2: " + param2)
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt
index 2ca7e9aae7..a8f6d4ce7d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/comm/MsgStatusAPS_v2.kt
@@ -9,7 +9,7 @@ class MsgStatusAPS_v2(
) : MessageBase(injector) {
init {
- SetCommand(0xE001)
+ setCommand(0xE001)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
index dd854d6cb3..8000770e7a 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.danaRv2.services;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Binder;
import android.os.SystemClock;
@@ -106,7 +107,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
mBinder = new LocalBinder();
}
- public void connect() {
+ @SuppressLint("MissingPermission") public void connect() {
if (mConnectionInProgress)
return;
@@ -152,7 +153,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
if (danaPump.isNewPump()) {
mSerialIOThread.sendMessage(checkValue);
- if (!checkValue.received) {
+ if (!checkValue.isReceived()) {
return;
}
}
@@ -348,7 +349,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
DanaPump.HistoryEntry.CARBS.getValue(), carbtime, carbs, 0);
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
- if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.failed)
+ if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.getFailed())
ErrorHelperActivity.Companion.runAlarm(context, rh.gs(R.string.carbs_store_error)
, rh.gs(R.string.error), R.raw.boluserror);
}
@@ -364,7 +365,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
t.insulin = 0d;
return false;
}
- while (!danaPump.getBolusStopped() && !start.failed) {
+ while (!danaPump.getBolusStopped() && !start.getFailed()) {
SystemClock.sleep(100);
if ((System.currentTimeMillis() - danaPump.getBolusProgressLastTimeStamp()) > 15 * 1000L) { // if i didn't receive status for more than 15 sec expecting broken comm
danaPump.setBolusStopped(true);
@@ -410,7 +411,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
rxBus.send(new EventPumpStatusChanged(rh.gs(R.string.disconnecting)));
}
});
- return !start.failed;
+ return !start.getFailed();
}
public boolean carbsEntry(int amount, long time) {
@@ -472,7 +473,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
MsgSetUserOptions msg = new MsgSetUserOptions(injector);
mSerialIOThread.sendMessage(msg);
SystemClock.sleep(200);
- return new PumpEnactResult(injector).success(!msg.failed);
+ return new PumpEnactResult(injector).success(!msg.getFailed());
}
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java b/danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java
index 7358a51ab8..41da73946c 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/SerialIOThread.java
@@ -74,10 +74,11 @@ public class SerialIOThread extends Thread {
message = hashTable.findMessage(command);
}
- aapsLogger.debug(LTag.PUMPBTCOMM, "<<<<< " + message.getMessageName() + " " + MessageBase.toHexString(extractedBuff));
+ aapsLogger.debug(LTag.PUMPBTCOMM,
+ "<<<<< " + message.getMessageName() + " " + MessageBase.Companion.toHexString(extractedBuff));
// process the message content
- message.received = true;
+ message.setReceived(true);
message.handleMessage(extractedBuff);
synchronized (message) {
message.notify();
@@ -108,7 +109,7 @@ public class SerialIOThread extends Thread {
return null;
}
if (mReadBuff[length - 2] != (byte) 0x2E || mReadBuff[length - 1] != (byte) 0x2E) {
- aapsLogger.error("wrong packet lenght=" + length + " data " + MessageBase.toHexString(mReadBuff));
+ aapsLogger.error("wrong packet lenght=" + length + " data " + MessageBase.Companion.toHexString(mReadBuff));
disconnect("wrong packet");
return null;
}
@@ -134,7 +135,7 @@ public class SerialIOThread extends Thread {
mReadBuff = unprocessedData;
return extractedBuff;
} else {
- aapsLogger.error("Wrong beginning of packet len=" + mReadBuff.length + " " + MessageBase.toHexString(mReadBuff));
+ aapsLogger.error("Wrong beginning of packet len=" + mReadBuff.length + " " + MessageBase.Companion.toHexString(mReadBuff));
disconnect("Wrong beginning of packet");
return null;
}
@@ -148,7 +149,7 @@ public class SerialIOThread extends Thread {
processedMessage = message;
byte[] messageBytes = message.getRawMessageBytes();
- aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + message.getMessageName() + " " + MessageBase.toHexString(messageBytes));
+ aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> " + message.getMessageName() + " " + MessageBase.Companion.toHexString(messageBytes));
try {
mOutputStream.write(messageBytes);
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java
deleted file mode 100644
index 54da53475c..0000000000
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.java
+++ /dev/null
@@ -1,250 +0,0 @@
-package info.nightscout.androidaps.danar.comm;
-
-import android.annotation.TargetApi;
-import android.os.Build;
-
-import org.joda.time.DateTime;
-import org.joda.time.IllegalInstantException;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import javax.inject.Inject;
-
-import dagger.android.HasAndroidInjector;
-import info.nightscout.androidaps.dana.DanaPump;
-import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao;
-import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin;
-import info.nightscout.androidaps.danaRv2.DanaRv2Plugin;
-import info.nightscout.androidaps.danar.DanaRPlugin;
-import info.nightscout.androidaps.interfaces.ActivePlugin;
-import info.nightscout.androidaps.interfaces.CommandQueue;
-import info.nightscout.androidaps.interfaces.ConfigBuilder;
-import info.nightscout.androidaps.interfaces.PumpSync;
-import info.nightscout.shared.logging.AAPSLogger;
-import info.nightscout.shared.logging.LTag;
-import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage;
-import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage;
-import info.nightscout.androidaps.utils.CRC;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.resources.ResourceHelper;
-
-/*
- * 00 01 02 03 04 05 06
- *
- * 7E 7E len F1 CMD SUB data CRC CRC 2E 2E
- */
-
-public class MessageBase {
- @Inject public AAPSLogger aapsLogger;
- @Inject public DateUtil dateUtil;
- @Inject public DanaPump danaPump;
- @Inject public DanaRPlugin danaRPlugin;
- @Inject public DanaRKoreanPlugin danaRKoreanPlugin;
- @Inject public DanaRv2Plugin danaRv2Plugin;
- @Inject public RxBus rxBus;
- @Inject public ResourceHelper rh;
- @Inject public ActivePlugin activePlugin;
- @Inject public ConfigBuilder configBuilder;
- @Inject public CommandQueue commandQueue;
- @Inject public DetailedBolusInfoStorage detailedBolusInfoStorage;
- @Inject public TemporaryBasalStorage temporaryBasalStorage;
- @Inject public ConstraintChecker constraintChecker;
- @Inject public PumpSync pumpSync;
- @Inject public DanaHistoryRecordDao danaHistoryRecordDao;
- HasAndroidInjector injector;
-
- public byte[] buffer = new byte[512];
- private int position = 6;
-
- public boolean received = false;
- public boolean failed = false;
-
- public MessageBase(HasAndroidInjector injector) {
- injector.androidInjector().inject(this);
- this.injector = injector;
- }
-
- public void SetCommand(int cmd) {
- this.buffer[4] = (byte) (cmd >> 8 & 0xFF);
- this.buffer[5] = (byte) (cmd & 0xFF);
- }
-
- public void AddParamByte(byte data) {
- this.buffer[this.position++] = data;
- }
-
- public void AddParamInt(int data) {
- this.buffer[this.position++] = (byte) (data >> 8 & 0xFF);
- this.buffer[this.position++] = (byte) (data & 0xFF);
- }
-
- public void AddParamDate(GregorianCalendar date) {
- AddParamByte((byte) (date.get(Calendar.YEAR) - 1900 - 100));
- AddParamByte((byte) (date.get(Calendar.MONTH) + 1));
- AddParamByte((byte) (date.get(Calendar.DAY_OF_MONTH)));
- AddParamByte((byte) (date.get(Calendar.HOUR_OF_DAY)));
- AddParamByte((byte) (date.get(Calendar.MINUTE)));
- }
-
- public void AddParamDateTime(GregorianCalendar date) {
- AddParamByte((byte) (date.get(Calendar.YEAR) - 1900 - 100));
- AddParamByte((byte) (date.get(Calendar.MONTH) + 1));
- AddParamByte((byte) (date.get(Calendar.DAY_OF_MONTH)));
- AddParamByte((byte) (date.get(Calendar.HOUR_OF_DAY)));
- AddParamByte((byte) (date.get(Calendar.MINUTE)));
- AddParamByte((byte) (date.get(Calendar.SECOND)));
- }
-
- public void AddParamDateTimeReversed(long timestamp) {
- GregorianCalendar date = new GregorianCalendar();
- date.setTimeInMillis(timestamp);
- AddParamByte((byte) (date.get(Calendar.SECOND)));
- AddParamByte((byte) (date.get(Calendar.MINUTE)));
- AddParamByte((byte) (date.get(Calendar.HOUR_OF_DAY)));
- AddParamByte((byte) (date.get(Calendar.DAY_OF_MONTH)));
- AddParamByte((byte) (date.get(Calendar.MONTH) + 1));
- AddParamByte((byte) (date.get(Calendar.YEAR) - 1900 - 100));
- }
-
- public byte[] getRawMessageBytes() {
- this.buffer[0] = (byte) 0x7E;
- this.buffer[1] = (byte) 0x7E;
-
- int length = this.position - 3;
-
- this.buffer[2] = (byte) length;
- this.buffer[3] = (byte) 0xF1;
-
- this.AddParamInt(CRC.INSTANCE.getCrc16(this.buffer, 3, length));
-
- this.buffer[length + 5] = (byte) 0x2E;
- this.buffer[length + 6] = (byte) 0x2E;
-
- return Arrays.copyOf(buffer, length + 7);
- }
-
- public String getMessageName() {
- return MessageOriginalNames.INSTANCE.getName(getCommand());
- }
-
- public void handleMessage(byte[] bytes) {
- if (bytes.length > 6) {
- int command = (bytes[5] & 0xFF) | ((bytes[4] << 8) & 0xFF00);
- aapsLogger.debug(LTag.PUMPCOMM, "UNPROCESSED MSG: " + getMessageName() + " Command: " + String.format("%04X", command) + " Data: " + toHexString(bytes));
- } else {
- aapsLogger.debug(LTag.PUMPCOMM, "MISFORMATTED MSG: " + toHexString(bytes));
- }
- }
-
- public void handleMessageNotReceived() {
- }
-
- public int getCommand() {
- return byteFromRawBuff(buffer, 5) | (byteFromRawBuff(buffer, 4) << 8);
- }
-
- public int byteFromRawBuff(byte[] buff, int offset) {
- return buff[offset] & 0xFF;
- }
-
- public int intFromBuff(byte[] buff, int offset, int length) {
- offset += 6;
- switch (length) {
- case 1:
- return byteFromRawBuff(buff, offset);
- case 2:
- return (byteFromRawBuff(buff, offset) << 8) + byteFromRawBuff(buff, offset + 1);
- case 3:
- return (byteFromRawBuff(buff, offset + 2) << 16) + (byteFromRawBuff(buff, offset + 1) << 8) + byteFromRawBuff(buff, offset);
- case 4:
- return (byteFromRawBuff(buff, offset + 3) << 24) + (byteFromRawBuff(buff, offset + 2) << 16) + (byteFromRawBuff(buff, offset + 1) << 8) + byteFromRawBuff(buff, offset);
- }
- return 0;
- }
-
- public long dateTimeFromBuff(byte[] buff, int offset) {
- return
- new DateTime(
- 2000 + intFromBuff(buff, offset, 1),
- intFromBuff(buff, offset + 1, 1),
- intFromBuff(buff, offset + 2, 1),
- intFromBuff(buff, offset + 3, 1),
- intFromBuff(buff, offset + 4, 1),
- 0
- ).getMillis();
- }
-
- public synchronized long dateTimeSecFromBuff(byte[] buff, int offset) {
-
- try {
- return new DateTime(
- 2000 + intFromBuff(buff, offset, 1),
- intFromBuff(buff, offset + 1, 1),
- intFromBuff(buff, offset + 2, 1),
- intFromBuff(buff, offset + 3, 1),
- intFromBuff(buff, offset + 4, 1),
- intFromBuff(buff, offset + 5, 1)
- ).getMillis();
- } catch (IllegalInstantException e) {
- // expect
- // org.joda.time.IllegalInstantException: Illegal instant due to time zone offset transition (daylight savings time 'gap')
- // add 1 hour
- return new DateTime(
- 2000 + intFromBuff(buff, offset, 1),
- intFromBuff(buff, offset + 1, 1),
- intFromBuff(buff, offset + 2, 1),
- intFromBuff(buff, offset + 3, 1) + 1,
- intFromBuff(buff, offset + 4, 1),
- intFromBuff(buff, offset + 5, 1)
- ).getMillis();
- }
- }
-
- public long dateFromBuff(byte[] buff, int offset) {
- return
- new DateTime(
- 2000 + intFromBuff(buff, offset, 1),
- intFromBuff(buff, offset + 1, 1),
- intFromBuff(buff, offset + 2, 1),
- 0,
- 0
- ).getMillis();
- }
-
- @TargetApi(Build.VERSION_CODES.KITKAT)
- public static String stringFromBuff(byte[] buff, int offset, int length) {
- byte[] strBuff = new byte[length];
- System.arraycopy(buff, offset + 6, strBuff, 0, length);
- return new String(strBuff, StandardCharsets.UTF_8);
- }
-
- @TargetApi(Build.VERSION_CODES.KITKAT)
- public static String asciiStringFromBuff(byte[] buff, int offset, int length) {
- byte[] strBuff = new byte[length];
- System.arraycopy(buff, offset + 6, strBuff, 0, length);
- for (int pos = 0; pos < length; pos++)
- strBuff[pos] += 65; // "A"
- return new String(strBuff, StandardCharsets.UTF_8);
- }
-
- public static String toHexString(byte[] buff) {
- StringBuilder sb = new StringBuilder();
-
- int count = 0;
- for (byte element : buff) {
- sb.append(String.format("%02x ", element));
- if (++count % 4 == 0) sb.append(" ");
- }
-
- return sb.toString();
- }
-
- public boolean isReceived() {
- return received;
- }
-}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt
new file mode 100644
index 0000000000..33007e943f
--- /dev/null
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MessageBase.kt
@@ -0,0 +1,220 @@
+package info.nightscout.androidaps.danar.comm
+
+import dagger.android.HasAndroidInjector
+import info.nightscout.androidaps.dana.DanaPump
+import info.nightscout.androidaps.dana.database.DanaHistoryRecordDao
+import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
+import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
+import info.nightscout.androidaps.danar.DanaRPlugin
+import info.nightscout.androidaps.danar.comm.MessageOriginalNames.getName
+import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.CommandQueue
+import info.nightscout.androidaps.interfaces.ConfigBuilder
+import info.nightscout.androidaps.interfaces.PumpSync
+import info.nightscout.androidaps.plugins.bus.RxBus
+import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
+import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
+import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
+import info.nightscout.androidaps.utils.CRC.getCrc16
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.resources.ResourceHelper
+import info.nightscout.shared.logging.AAPSLogger
+import info.nightscout.shared.logging.LTag
+import org.joda.time.DateTime
+import org.joda.time.IllegalInstantException
+import java.nio.charset.StandardCharsets
+import java.util.*
+import javax.inject.Inject
+
+/*
+ * 00 01 02 03 04 05 06
+ *
+ * 7E 7E len F1 CMD SUB data CRC CRC 2E 2E
+ */
+open class MessageBase(injector: HasAndroidInjector) {
+
+ @Inject lateinit var aapsLogger: AAPSLogger
+ @Inject lateinit var dateUtil: DateUtil
+ @Inject lateinit var danaPump: DanaPump
+ @Inject lateinit var danaRPlugin: DanaRPlugin
+ @Inject lateinit var danaRKoreanPlugin: DanaRKoreanPlugin
+ @Inject lateinit var danaRv2Plugin: DanaRv2Plugin
+ @Inject lateinit var rxBus: RxBus
+ @Inject lateinit var rh: ResourceHelper
+ @Inject lateinit var activePlugin: ActivePlugin
+ @Inject lateinit var configBuilder: ConfigBuilder
+ @Inject lateinit var commandQueue: CommandQueue
+ @Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
+ @Inject lateinit var temporaryBasalStorage: TemporaryBasalStorage
+ @Inject lateinit var constraintChecker: ConstraintChecker
+ @Inject lateinit var pumpSync: PumpSync
+ @Inject lateinit var danaHistoryRecordDao: DanaHistoryRecordDao
+
+ var injector: HasAndroidInjector
+ var buffer = ByteArray(512)
+ private var position = 6
+ var isReceived = false
+ var failed = false
+
+ fun setCommand(cmd: Int) {
+ buffer[4] = (cmd shr 8 and 0xFF).toByte()
+ buffer[5] = (cmd and 0xFF).toByte()
+ }
+
+ fun addParamByte(data: Byte) {
+ buffer[position++] = data
+ }
+
+ fun addParamInt(data: Int) {
+ buffer[position++] = (data shr 8 and 0xFF).toByte()
+ buffer[position++] = (data and 0xFF).toByte()
+ }
+
+ fun addParamDate(date: GregorianCalendar) {
+ addParamByte((date[Calendar.YEAR] - 1900 - 100).toByte())
+ addParamByte((date[Calendar.MONTH] + 1).toByte())
+ addParamByte(date[Calendar.DAY_OF_MONTH].toByte())
+ addParamByte(date[Calendar.HOUR_OF_DAY].toByte())
+ addParamByte(date[Calendar.MINUTE].toByte())
+ }
+
+ fun addParamDateTime(date: GregorianCalendar) {
+ addParamByte((date[Calendar.YEAR] - 1900 - 100).toByte())
+ addParamByte((date[Calendar.MONTH] + 1).toByte())
+ addParamByte(date[Calendar.DAY_OF_MONTH].toByte())
+ addParamByte(date[Calendar.HOUR_OF_DAY].toByte())
+ addParamByte(date[Calendar.MINUTE].toByte())
+ addParamByte(date[Calendar.SECOND].toByte())
+ }
+
+ fun addParamDateTimeReversed(timestamp: Long) {
+ val date = GregorianCalendar()
+ date.timeInMillis = timestamp
+ addParamByte(date[Calendar.SECOND].toByte())
+ addParamByte(date[Calendar.MINUTE].toByte())
+ addParamByte(date[Calendar.HOUR_OF_DAY].toByte())
+ addParamByte(date[Calendar.DAY_OF_MONTH].toByte())
+ addParamByte((date[Calendar.MONTH] + 1).toByte())
+ addParamByte((date[Calendar.YEAR] - 1900 - 100).toByte())
+ }
+
+ val rawMessageBytes: ByteArray
+ get() {
+ buffer[0] = 0x7E.toByte()
+ buffer[1] = 0x7E.toByte()
+ val length = position - 3
+ buffer[2] = length.toByte()
+ buffer[3] = 0xF1.toByte()
+ addParamInt(getCrc16(buffer, 3, length).toInt())
+ buffer[length + 5] = 0x2E.toByte()
+ buffer[length + 6] = 0x2E.toByte()
+ return buffer.copyOf(length + 7)
+ }
+ val messageName: String?
+ get() = getName(command)
+
+ open fun handleMessage(bytes: ByteArray) {
+ if (bytes.size > 6) {
+ val command: Int = bytes[5].toInt() and 0xFF or (bytes[4].toInt() shl 8 and 0xFF00)
+ aapsLogger.debug(LTag.PUMPCOMM, "UNPROCESSED MSG: $messageName Command: ${String.format("%04X", command)} Data: ${toHexString(bytes)}")
+ } else {
+ aapsLogger.debug(LTag.PUMPCOMM, "MISFORMATTED MSG: ${toHexString(bytes)}")
+ }
+ }
+
+ open fun handleMessageNotReceived() {}
+ val command: Int
+ get() = byteFromRawBuff(buffer, 5) or (byteFromRawBuff(buffer, 4) shl 8)
+
+ private fun byteFromRawBuff(buff: ByteArray, offset: Int): Int {
+ return buff[offset].toInt() and 0xFF
+ }
+
+ fun intFromBuff(buff: ByteArray, buffOffset: Int, length: Int): Int {
+ val offset = buffOffset + 6
+ when (length) {
+ 1 -> return byteFromRawBuff(buff, offset)
+ 2 -> return (byteFromRawBuff(buff, offset) shl 8) + byteFromRawBuff(buff, offset + 1)
+ 3 -> return (byteFromRawBuff(buff, offset + 2) shl 16) + (byteFromRawBuff(buff, offset + 1) shl 8) + byteFromRawBuff(buff, offset)
+ 4 -> return (byteFromRawBuff(buff, offset + 3) shl 24) + (byteFromRawBuff(buff, offset + 2) shl 16) + (byteFromRawBuff(buff, offset + 1) shl 8) + byteFromRawBuff(buff, offset)
+ }
+ return 0
+ }
+
+ fun dateTimeFromBuff(buff: ByteArray, offset: Int): Long {
+ return DateTime(
+ 2000 + intFromBuff(buff, offset, 1),
+ intFromBuff(buff, offset + 1, 1),
+ intFromBuff(buff, offset + 2, 1),
+ intFromBuff(buff, offset + 3, 1),
+ intFromBuff(buff, offset + 4, 1),
+ 0
+ ).millis
+ }
+
+ @Synchronized fun dateTimeSecFromBuff(buff: ByteArray, offset: Int): Long {
+ return try {
+ DateTime(
+ 2000 + intFromBuff(buff, offset, 1),
+ intFromBuff(buff, offset + 1, 1),
+ intFromBuff(buff, offset + 2, 1),
+ intFromBuff(buff, offset + 3, 1),
+ intFromBuff(buff, offset + 4, 1),
+ intFromBuff(buff, offset + 5, 1)
+ ).millis
+ } catch (e: IllegalInstantException) {
+ // expect
+ // org.joda.time.IllegalInstantException: Illegal instant due to time zone offset transition (daylight savings time 'gap')
+ // add 1 hour
+ DateTime(
+ 2000 + intFromBuff(buff, offset, 1),
+ intFromBuff(buff, offset + 1, 1),
+ intFromBuff(buff, offset + 2, 1),
+ intFromBuff(buff, offset + 3, 1) + 1,
+ intFromBuff(buff, offset + 4, 1),
+ intFromBuff(buff, offset + 5, 1)
+ ).millis
+ }
+ }
+
+ fun dateFromBuff(buff: ByteArray, offset: Int): Long {
+ return DateTime(
+ 2000 + intFromBuff(buff, offset, 1),
+ intFromBuff(buff, offset + 1, 1),
+ intFromBuff(buff, offset + 2, 1),
+ 0,
+ 0
+ ).millis
+ }
+
+ companion object {
+
+ fun stringFromBuff(buff: ByteArray, offset: Int, length: Int): String {
+ val strBuff = ByteArray(length)
+ System.arraycopy(buff, offset + 6, strBuff, 0, length)
+ return String(strBuff, StandardCharsets.UTF_8)
+ }
+
+ fun asciiStringFromBuff(buff: ByteArray, offset: Int, length: Int): String {
+ val strBuff = ByteArray(length)
+ System.arraycopy(buff, offset + 6, strBuff, 0, length)
+ for (pos in 0 until length) strBuff[pos] = (strBuff[pos] + 65).toByte() // "A"
+ return String(strBuff, StandardCharsets.UTF_8)
+ }
+
+ fun toHexString(buff: ByteArray): String {
+ val sb = StringBuilder()
+ for ((count, element) in buff.withIndex()) {
+ sb.append(String.format("%02x ", element))
+ if ((count + 1) % 4 == 0) sb.append(" ")
+ }
+ return sb.toString()
+ }
+ }
+
+ init {
+ @Suppress("LeakingThis")
+ injector.androidInjector().inject(this)
+ this.injector = injector
+ }
+}
\ No newline at end of file
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt
index bd3e4d7215..a169b5a0fe 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusProgress.kt
@@ -11,7 +11,7 @@ class MsgBolusProgress(
) : MessageBase(injector) {
init {
- SetCommand(0x0202)
+ setCommand(0x0202)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt
index eb31892303..3be1ee030c 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStart.kt
@@ -10,10 +10,10 @@ class MsgBolusStart(
) : MessageBase(injector) {
init {
- SetCommand(0x0102)
+ setCommand(0x0102)
// HARDCODED LIMIT
amount = constraintChecker.applyBolusConstraints(Constraint(amount)).value()
- AddParamInt((amount * 100).toInt())
+ addParamInt((amount * 100).toInt())
aapsLogger.debug(LTag.PUMPBTCOMM, "Bolus start : $amount")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt
index f9dcfc7d55..184ac266ae 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStartWithSpeed.kt
@@ -11,11 +11,11 @@ class MsgBolusStartWithSpeed(
) : MessageBase(injector) {
init {
- SetCommand(0x0104)
+ setCommand(0x0104)
// HARDCODED LIMIT
amount = constraintChecker.applyBolusConstraints(Constraint(amount)).value()
- AddParamInt((amount * 100).toInt())
- AddParamByte(speed.toByte())
+ addParamInt((amount * 100).toInt())
+ addParamByte(speed.toByte())
aapsLogger.debug(LTag.PUMPBTCOMM, "Bolus start : $amount speed: $speed")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt
index 16e40b180b..1393a6319e 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgBolusStop.kt
@@ -10,7 +10,7 @@ class MsgBolusStop(
) : MessageBase(injector) {
init {
- SetCommand(0x0101)
+ setCommand(0x0101)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt
index 977aabe483..613549ebbf 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgCheckValue.kt
@@ -9,7 +9,7 @@ class MsgCheckValue(
) : MessageBase(injector) {
init {
- SetCommand(0xF0F1)
+ setCommand(0xF0F1)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt
index daa9f34aac..b2c5c0924b 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt
@@ -10,7 +10,7 @@ class MsgError(
) : MessageBase(injector) {
init {
- SetCommand(0x0601)
+ setCommand(0x0601)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt
index 9209356c84..726a2705f5 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAlarm.kt
@@ -8,7 +8,7 @@ class MsgHistoryAlarm(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3105)
+ setCommand(0x3105)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt
index f34772b430..8946d93d7d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAll.kt
@@ -12,7 +12,7 @@ open class MsgHistoryAll(
) : MessageBase(injector) {
init {
- SetCommand(0x41F2)
+ setCommand(0x41F2)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt
index 1677e46280..41fc852480 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryAllDone.kt
@@ -8,7 +8,7 @@ class MsgHistoryAllDone(
) : MessageBase(injector) {
init {
- SetCommand(0x41F1)
+ setCommand(0x41F1)
danaPump.historyDoneReceived = false
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt
index 75c6ade3da..9167377efb 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBasalHour.kt
@@ -8,7 +8,7 @@ class MsgHistoryBasalHour(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x310A)
+ setCommand(0x310A)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt
index 14274ce2eb..1d67099a84 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryBolus.kt
@@ -8,7 +8,7 @@ class MsgHistoryBolus(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3101)
+ setCommand(0x3101)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt
index 1915080ea6..cdaa47e279 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryCarbo.kt
@@ -8,7 +8,7 @@ class MsgHistoryCarbo(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3107)
+ setCommand(0x3107)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt
index 725b7a999a..9788da4e77 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDailyInsulin.kt
@@ -8,7 +8,7 @@ class MsgHistoryDailyInsulin(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3102)
+ setCommand(0x3102)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt
index 520590f25e..d9e705650d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryDone.kt
@@ -8,7 +8,7 @@ class MsgHistoryDone(
) : MessageBase(injector) {
init {
- SetCommand(0x31F1)
+ setCommand(0x31F1)
danaPump.historyDoneReceived = false
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt
index 2d4308bd7b..ba4aba7520 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryError.kt
@@ -8,7 +8,7 @@ class MsgHistoryError(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3106)
+ setCommand(0x3106)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt
index 75939b8e07..8ae08e757a 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryGlucose.kt
@@ -8,7 +8,7 @@ class MsgHistoryGlucose(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3104)
+ setCommand(0x3104)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt
index 9bf8f4d34a..2bca4a994d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNew.kt
@@ -8,7 +8,7 @@ class MsgHistoryNew(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x42F2)
+ setCommand(0x42F2)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt
index 8b44ee4b11..3897cb090d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryNewDone.kt
@@ -8,7 +8,7 @@ class MsgHistoryNewDone(
) : MessageBase(injector) {
init {
- SetCommand(0x42F1)
+ setCommand(0x42F1)
danaPump.historyDoneReceived = false
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt
index 8a1bf30aa8..dc87964c01 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistoryRefill.kt
@@ -8,7 +8,7 @@ class MsgHistoryRefill(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3108)
+ setCommand(0x3108)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt
index 68d333baa7..a739778eda 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgHistorySuspend.kt
@@ -8,7 +8,7 @@ class MsgHistorySuspend(
) : MsgHistoryAll(injector) {
init {
- SetCommand(0x3109)
+ setCommand(0x3109)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
// Handle message taken from MsgHistoryAll
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt
index 13f24c6b20..53d45b38f1 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBasic.kt
@@ -8,7 +8,7 @@ class MsgInitConnStatusBasic(
) : MessageBase(injector) {
init {
- SetCommand(0x0303)
+ setCommand(0x0303)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt
index ccaabf7798..ae2e2a0f14 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusBolus.kt
@@ -12,7 +12,7 @@ class MsgInitConnStatusBolus(
) : MessageBase(injector) {
init {
- SetCommand(0x0302)
+ setCommand(0x0302)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt
index d649d15380..40bbdbb4c3 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusOption.kt
@@ -12,7 +12,7 @@ class MsgInitConnStatusOption(
) : MessageBase(injector) {
init {
- SetCommand(0x0304)
+ setCommand(0x0304)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt
index ac731c8629..4da82df223 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgInitConnStatusTime.kt
@@ -13,7 +13,7 @@ class MsgInitConnStatusTime(
) : MessageBase(injector) {
init {
- SetCommand(0x0301)
+ setCommand(0x0301)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt
index 2544397b9e..4e5c7881f0 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStart.kt
@@ -8,7 +8,7 @@ class MsgPCCommStart constructor(
) : MessageBase(injector) {
init {
- SetCommand(0x3001)
+ setCommand(0x3001)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt
index c80b4a9faf..35eca2ee56 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgPCCommStop.kt
@@ -8,7 +8,7 @@ class MsgPCCommStop(
) : MessageBase(injector) {
init {
- SetCommand(0x3002)
+ setCommand(0x3002)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt
index 0de762ded1..d86d212f7d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetActivateBasalProfile.kt
@@ -10,8 +10,8 @@ class MsgSetActivateBasalProfile(
// index 0-3
init {
- SetCommand(0x330C)
- AddParamByte(index)
+ setCommand(0x330C)
+ addParamByte(index)
aapsLogger.debug(LTag.PUMPCOMM, "Activate basal profile: $index")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt
index 3b574cdafd..40bf1582b2 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetBasalProfile.kt
@@ -14,10 +14,10 @@ class MsgSetBasalProfile(
// index 0-3
init {
- SetCommand(0x3306)
- AddParamByte(index)
+ setCommand(0x3306)
+ addParamByte(index)
for (i in 0..23) {
- AddParamInt((values[i] * 100).toInt())
+ addParamInt((values[i] * 100).toInt())
}
aapsLogger.debug(LTag.PUMPCOMM, "Set basal profile: $index")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt
index c294b54fc7..1c94f1fd03 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetCarbsEntry.kt
@@ -11,19 +11,19 @@ class MsgSetCarbsEntry(
) : MessageBase(injector) {
init {
- SetCommand(0x0402)
+ setCommand(0x0402)
aapsLogger.debug(LTag.PUMPBTCOMM, "New message")
val calendar = Calendar.getInstance()
calendar.timeInMillis = time
- AddParamByte(info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_CARBO)
- AddParamByte((calendar[Calendar.YEAR] % 100).toByte())
- AddParamByte((calendar[Calendar.MONTH] + 1).toByte())
- AddParamByte(calendar[Calendar.DAY_OF_MONTH].toByte())
- AddParamByte(calendar[Calendar.HOUR_OF_DAY].toByte())
- AddParamByte(calendar[Calendar.MINUTE].toByte())
- AddParamByte(calendar[Calendar.SECOND].toByte())
- AddParamByte(0x43.toByte()) //??
- AddParamInt(amount)
+ addParamByte(info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_CARBO)
+ addParamByte((calendar[Calendar.YEAR] % 100).toByte())
+ addParamByte((calendar[Calendar.MONTH] + 1).toByte())
+ addParamByte(calendar[Calendar.DAY_OF_MONTH].toByte())
+ addParamByte(calendar[Calendar.HOUR_OF_DAY].toByte())
+ addParamByte(calendar[Calendar.MINUTE].toByte())
+ addParamByte(calendar[Calendar.SECOND].toByte())
+ addParamByte(0x43.toByte()) //??
+ addParamInt(amount)
aapsLogger.debug(LTag.PUMPBTCOMM, "Set carb entry: " + amount + " date " + calendar.time.toString())
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt
index bd45b14c5c..16faf09825 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStart.kt
@@ -12,14 +12,14 @@ class MsgSetExtendedBolusStart(
) : MessageBase(injector) {
init {
- SetCommand(0x0407)
+ setCommand(0x0407)
aapsLogger.debug(LTag.PUMPBTCOMM, "New message")
// HARDCODED LIMITS
if (halfhours < 1) halfhours = 1
if (halfhours > 16) halfhours = 16
amount = constraintChecker.applyBolusConstraints(Constraint(amount)).value()
- AddParamInt((amount * 100).toInt())
- AddParamByte(halfhours)
+ addParamInt((amount * 100).toInt())
+ addParamByte(halfhours)
aapsLogger.debug(LTag.PUMPBTCOMM, "Set extended bolus start: " + (amount * 100).toInt() / 100.0 + "U halfhours: " + halfhours.toInt())
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt
index 1816d46464..1cdf88cc59 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetExtendedBolusStop.kt
@@ -8,7 +8,7 @@ class MsgSetExtendedBolusStop(
) : MessageBase(injector) {
init {
- SetCommand(0x0406)
+ setCommand(0x0406)
aapsLogger.debug(LTag.PUMPBTCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt
index c38d6d454d..d0c4a2477e 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetSingleBasalProfile.kt
@@ -13,9 +13,9 @@ class MsgSetSingleBasalProfile(
// index 0-3
init {
- SetCommand(0x3302)
+ setCommand(0x3302)
for (i in 0..23) {
- AddParamInt((values[i] * 100).toInt())
+ addParamInt((values[i] * 100).toInt())
}
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt
index 5d06c3ec81..e7c4324a47 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStart.kt
@@ -10,15 +10,15 @@ class MsgSetTempBasalStart(
) : MessageBase(injector) {
init {
- SetCommand(0x0401)
+ setCommand(0x0401)
//HARDCODED LIMITS
if (percent < 0) percent = 0
if (percent > 200) percent = 200
if (durationInHours < 1) durationInHours = 1
if (durationInHours > 24) durationInHours = 24
- AddParamByte((percent and 255).toByte())
- AddParamByte((durationInHours and 255).toByte())
+ addParamByte((percent and 255).toByte())
+ addParamByte((durationInHours and 255).toByte())
aapsLogger.debug(LTag.PUMPCOMM, "Temp basal start percent: $percent duration hours: $durationInHours")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt
index 19b1d53c78..42d40cbc82 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTempBasalStop.kt
@@ -8,7 +8,7 @@ class MsgSetTempBasalStop(
) : MessageBase(injector) {
init {
- SetCommand(0x0403)
+ setCommand(0x0403)
aapsLogger.debug(LTag.PUMPBTCOMM, "Temp basal stop")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt
index eeb137b1f0..aa938a46f5 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetTime.kt
@@ -9,8 +9,8 @@ class MsgSetTime(
) : MessageBase(injector) {
init {
- SetCommand(0x330a)
- AddParamDateTimeReversed(time)
+ setCommand(0x330a)
+ addParamDateTimeReversed(time)
aapsLogger.debug(LTag.PUMPCOMM, "New message: time:" + dateUtil.dateAndTimeString(time))
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt
index f4a7820cc7..dad025aac3 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSetUserOptions.kt
@@ -8,7 +8,7 @@ class MsgSetUserOptions(
) : MessageBase(injector) {
init {
- SetCommand(0x330B)
+ setCommand(0x330B)
if (danaPump.userOptionsFromPump == null) {
// No options set -> Exiting
aapsLogger.debug(LTag.PUMPCOMM, "NO USER OPTIONS LOADED EXITING!")
@@ -23,7 +23,7 @@ class MsgSetUserOptions(
danaPump.userOptionsFromPump!![9] = danaPump.shutdownHour.toByte()
danaPump.userOptionsFromPump!![27] = danaPump.lowReservoirRate.toByte()
for (element in danaPump.userOptionsFromPump!!) {
- AddParamByte(element)
+ addParamByte(element)
}
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt
index 44429c0432..e0a8847906 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingActiveProfile.kt
@@ -8,7 +8,7 @@ class MsgSettingActiveProfile(
) : MessageBase(injector) {
init {
- SetCommand(0x320C)
+ setCommand(0x320C)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt
index e8bf65dc5c..ce9ceb7c0f 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasal.kt
@@ -9,7 +9,7 @@ class MsgSettingBasal(
) : MessageBase(injector) {
init {
- SetCommand(0x3202)
+ setCommand(0x3202)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt
index 6a0a43e64b..68fc2d854a 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingBasalProfileAll.kt
@@ -57,7 +57,7 @@ class MsgSettingBasalProfileAll(
}
init {
- SetCommand(0x3206)
+ setCommand(0x3206)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
}
\ No newline at end of file
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt
index 9ea3fbf189..48d81317c7 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingGlucose.kt
@@ -12,7 +12,7 @@ class MsgSettingGlucose(
) : MessageBase(injector) {
init {
- SetCommand(0x3209)
+ setCommand(0x3209)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt
index 67fac7ee59..09bf49c133 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMaxValues.kt
@@ -8,7 +8,7 @@ class MsgSettingMaxValues(
) : MessageBase(injector) {
init {
- SetCommand(0x3205)
+ setCommand(0x3205)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt
index 7e3875595b..a4961ca12d 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingMeal.kt
@@ -12,7 +12,7 @@ class MsgSettingMeal(
) : MessageBase(injector) {
init {
- SetCommand(0x3203)
+ setCommand(0x3203)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt
index 38c3754106..2448b3fdd3 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatios.kt
@@ -9,7 +9,7 @@ class MsgSettingProfileRatios(
) : MessageBase(injector) {
init {
- SetCommand(0x3204)
+ setCommand(0x3204)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt
index daedb412b3..2b921da8ae 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingProfileRatiosAll.kt
@@ -9,7 +9,7 @@ class MsgSettingProfileRatiosAll(
) : MessageBase(injector) {
init {
- SetCommand(0x320D)
+ setCommand(0x320D)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt
index 7ec8351ed6..31c3b121fa 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingPumpTime.kt
@@ -10,7 +10,7 @@ class MsgSettingPumpTime(
) : MessageBase(injector) {
init {
- SetCommand(0x320A)
+ setCommand(0x320A)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt
index dfcb396bfb..38ff9b2fe4 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingShippingInfo.kt
@@ -8,7 +8,7 @@ class MsgSettingShippingInfo(
) : MessageBase(injector) {
init {
- SetCommand(0x3207)
+ setCommand(0x3207)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt
index 85e25faade..35ae795431 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgSettingUserOptions.kt
@@ -9,7 +9,7 @@ class MsgSettingUserOptions(
init {
- SetCommand(0x320B)
+ setCommand(0x320B)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt
index 06636a9676..dc96ebda6c 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatus.kt
@@ -8,7 +8,7 @@ class MsgStatus(
) : MessageBase(injector) {
init {
- SetCommand(0x020B)
+ setCommand(0x020B)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt
index b63f834d4b..ccc3f2f0c9 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBasic.kt
@@ -8,7 +8,7 @@ class MsgStatusBasic(
) : MessageBase(injector) {
init {
- SetCommand(0x020A)
+ setCommand(0x020A)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt
index 77dfb989bc..e086368a0f 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusBolusExtended.kt
@@ -11,7 +11,7 @@ class MsgStatusBolusExtended(
) : MessageBase(injector) {
init {
- SetCommand(0x0207)
+ setCommand(0x0207)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt
index 4a0160ecf8..b6344791bf 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusProfile.kt
@@ -9,7 +9,7 @@ class MsgStatusProfile(
) : MessageBase(injector) {
init {
- SetCommand(0x0204)
+ setCommand(0x0204)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt
index 42c5ef31da..5314201e81 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgStatusTempBasal.kt
@@ -11,7 +11,7 @@ class MsgStatusTempBasal(
) : MessageBase(injector) {
init {
- SetCommand(0x0205)
+ setCommand(0x0205)
aapsLogger.debug(LTag.PUMPCOMM, "New message")
}
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
index 03db77233f..f0a45f95f6 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/AbstractDanaRExecutionService.java
@@ -191,22 +191,23 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
protected void getBTSocketForSelectedPump() {
mDevName = sp.getString(R.string.key_danar_bt_name, "");
- BluetoothAdapter bluetoothAdapter = ((BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
+ BluetoothAdapter bluetoothAdapter = ((BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
if (bluetoothAdapter != null) {
Set bondedDevices = bluetoothAdapter.getBondedDevices();
- for (BluetoothDevice device : bondedDevices) {
- if (mDevName.equals(device.getName())) {
- mBTDevice = device;
- try {
- mRfcommSocket = mBTDevice.createRfcommSocketToServiceRecord(SPP_UUID);
- } catch (IOException e) {
- aapsLogger.error("Error creating socket: ", e);
+ if (bondedDevices != null)
+ for (BluetoothDevice device : bondedDevices) {
+ if (mDevName.equals(device.getName())) {
+ mBTDevice = device;
+ try {
+ mRfcommSocket = mBTDevice.createRfcommSocketToServiceRecord(SPP_UUID);
+ } catch (IOException e) {
+ aapsLogger.error("Error creating socket: ", e);
+ }
+ break;
}
- break;
}
- }
} else {
ToastUtils.INSTANCE.showToastInUiThread(context.getApplicationContext(),
rh.gs(R.string.nobtadapter));
diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
index dd26fb017e..76682b9690 100644
--- a/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
+++ b/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.danar.services;
+import android.annotation.SuppressLint;
import android.os.Binder;
import android.os.SystemClock;
@@ -93,7 +94,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
}
}
- public void connect() {
+ @SuppressLint("MissingPermission") public void connect() {
if (mConnectionInProgress)
return;
@@ -139,7 +140,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
if (danaPump.isNewPump()) {
mSerialIOThread.sendMessage(checkValue);
- if (!checkValue.received) {
+ if (!checkValue.isReceived()) {
return;
}
}
@@ -292,7 +293,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
t.insulin = 0d;
return false;
}
- while (!danaPump.getBolusStopped() && !start.failed) {
+ while (!danaPump.getBolusStopped() && !start.getFailed()) {
SystemClock.sleep(100);
if ((System.currentTimeMillis() - danaPump.getBolusProgressLastTimeStamp()) > 15 * 1000L) { // if i didn't receive status for more than 15 sec expecting broken comm
danaPump.setBolusStopped(true);
@@ -359,7 +360,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
commandQueue.readStatus(rh.gs(R.string.bolus_ok), null);
}
}
- return !start.failed;
+ return !start.getFailed();
}
public boolean carbsEntry(int amount) {
@@ -400,6 +401,6 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
MsgSetUserOptions msg = new MsgSetUserOptions(injector);
mSerialIOThread.sendMessage(msg);
SystemClock.sleep(200);
- return new PumpEnactResult(injector).success(!msg.failed);
+ return new PumpEnactResult(injector).success(!msg.getFailed());
}
}
diff --git a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt
index 8fc5853a0c..2b5fa5d957 100644
--- a/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt
+++ b/danar/src/test/java/info/nightscout/androidaps/plugins/pump/danaRv2/comm/MessageHashTableRv2Test.kt
@@ -20,7 +20,7 @@ class MessageHashTableRv2Test : DanaRTestBase() {
Assert.assertEquals(0xE001, testPacket.command.toLong())
// try putting another command
val testMessage = MessageBase(injector)
- testMessage.SetCommand(0xE005)
+ testMessage.setCommand(0xE005)
messageHashTableRv2.put(testMessage)
Assert.assertEquals(0xE005, messageHashTableRv2.findMessage(0xE005).command.toLong())
}
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt b/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
index 4352630f7f..da57033b39 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt
@@ -30,7 +30,6 @@ import javax.inject.Inject
class BLEScanActivity : NoSplashAppCompatActivity() {
@Inject lateinit var sp: SP
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var blePreCheck: BlePreCheck
@Inject lateinit var context: Context
diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt b/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt
index 8aff58f856..eca503acf5 100644
--- a/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt
+++ b/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt
@@ -22,7 +22,6 @@ import kotlin.experimental.xor
class EnterPinActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var danaRSPlugin: DanaRSPlugin
@Inject lateinit var sp: SP
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
index 25dda64b2a..52165d828d 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt
@@ -32,7 +32,6 @@ import javax.inject.Inject
class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() {
@Inject lateinit var sp: SP
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var blePreCheck: BlePreCheck
@Inject lateinit var context: Context
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt
index 2c9c5e23f6..0ee0bc8e54 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt
@@ -33,7 +33,6 @@ import javax.inject.Inject
class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var activePlugin: ActivePlugin
diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt
index 0f30c7e151..49d315f341 100644
--- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt
+++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt
@@ -25,7 +25,6 @@ import javax.inject.Inject
class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var context: Context
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
index 4db2e5fd59..24d6904f2f 100644
--- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
+++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt
@@ -92,7 +92,7 @@ class MedtronicFragment : DaggerFragment() {
binding.rlStatus.text = rh.gs(RileyLinkServiceState.NotStarted.resourceId)
- binding.pumpStatusIcon.setTextColor(Color.WHITE)
+ binding.pumpStatusIcon.setTextColor(rh.gac(context,R.attr.defaultTextColor))
@SuppressLint("SetTextI18n")
binding.pumpStatusIcon.text = "{fa-bed}"
@@ -200,7 +200,7 @@ class MedtronicFragment : DaggerFragment() {
rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.MedtronicPump))
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
}
- binding.rlStatus.setTextColor(if (rileyLinkError != null) Color.RED else Color.WHITE)
+ binding.rlStatus.setTextColor(rh.gac( context, if (rileyLinkError != null) R.attr.warningColor else R.attr.defaultTextColor))
binding.errors.text =
rileyLinkServiceData.rileyLinkError?.let {
@@ -272,7 +272,7 @@ class MedtronicFragment : DaggerFragment() {
val min = (System.currentTimeMillis() - medtronicPumpStatus.lastConnection) / 1000 / 60
if (medtronicPumpStatus.lastConnection + 60 * 1000 > System.currentTimeMillis()) {
binding.lastConnection.setText(R.string.medtronic_pump_connected_now)
- binding.lastConnection.setTextColor(Color.WHITE)
+ binding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor))
} else if (medtronicPumpStatus.lastConnection + 30 * 60 * 1000 < System.currentTimeMillis()) {
if (min < 60) {
@@ -288,10 +288,10 @@ class MedtronicFragment : DaggerFragment() {
binding.lastConnection.text = (rh.gq(R.plurals.duration_days, d, d) + " "
+ rh.gs(R.string.ago))
}
- binding.lastConnection.setTextColor(Color.RED)
+ binding.lastConnection.setTextColor(rh.gac(context,R.attr.warningColor))
} else {
binding.lastConnection.text = minAgo
- binding.lastConnection.setTextColor(Color.WHITE)
+ binding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor))
}
}
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-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/common/fragment/WizardFragmentBase.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/common/fragment/WizardFragmentBase.kt
index 4d477881a7..cff60a0a1d 100644
--- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/common/fragment/WizardFragmentBase.kt
+++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/common/fragment/WizardFragmentBase.kt
@@ -15,11 +15,14 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.Omnipo
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonWizardProgressIndicationBinding
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
+import info.nightscout.androidaps.utils.resources.ResourceHelper
+import javax.inject.Inject
import kotlin.math.roundToInt
abstract class WizardFragmentBase : DaggerFragment() {
protected lateinit var viewModel: ViewModelBase
+ @Inject lateinit var rh: ResourceHelper
var _binding: OmnipodCommonWizardBaseFragmentBinding? = null
var _progressIndicationBinding: OmnipodCommonWizardProgressIndicationBinding? = null
@@ -48,7 +51,7 @@ abstract class WizardFragmentBase : DaggerFragment() {
if (nextPage == null) {
binding.navButtonsLayout.buttonNext.text = getString(R.string.omnipod_common_wizard_button_finish)
binding.navButtonsLayout.buttonNext.backgroundTintList =
- ColorStateList.valueOf(resources.getColor(R.color.omnipod_wizard_finish_button, context?.theme))
+ ColorStateList.valueOf(rh.gac(context, R.attr.omniWizardFinishButtonColor))
}
updateProgressIndication()
diff --git a/omnipod-common/src/main/res/values/colors.xml b/omnipod-common/src/main/res/values/colors.xml
deleted file mode 100644
index 906786a2c3..0000000000
--- a/omnipod-common/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
- #9E9E9E
-
-
- #0099CC
- #ff669900
- #77DD77
-
-
- #FF4444
- @color/pod_icon_outline
- #4CAF50
- @color/pod_icon_outline
- @color/pod_icon_outline
- #42A5F5
- @color/pod_icon_outline
- #67E86A
- @color/pod_icon_outline
- #B39DDB
- @color/pod_icon_outline
- #ffbf00
- @color/pod_icon_outline
-
-
- #67E86A
- @color/pod_icon_outline
- #FF4444
- @color/pod_icon_outline
- #85F803
- @color/pod_icon_outline
- #ffbf00
- @color/pod_icon_outline
- #4DD0E1
- @color/pod_icon_outline
- #FB8C00
- @color/pod_icon_outline
-
\ No newline at end of file
diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt
index 29224a3f78..a5e64791f5 100644
--- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt
+++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt
@@ -209,11 +209,11 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
private fun setTextViewColor(check_result: Boolean, textview: TextView, record: HistoryRecord) {
if (check_result && !record.isSuccess()) {
// Record says not success
- textview.setTextColor(android.graphics.Color.YELLOW)
+ textview.setTextColor(rh.gac( textview.context, R.attr.omniYellowColor))
return
}
// On success set color
- val textColor = when (record.commandType) {
+ val textColorAttr = when (record.commandType) {
// Operational
OmnipodCommandType.INITIALIZE_POD,
OmnipodCommandType.CONFIGURE_ALERTS,
@@ -223,25 +223,25 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
OmnipodCommandType.SUSPEND_DELIVERY,
OmnipodCommandType.RESUME_DELIVERY,
OmnipodCommandType.SET_BASAL_PROFILE -> {
- android.graphics.Color.CYAN
+ R.attr.omniCyanColor
}
// User action
OmnipodCommandType.PLAY_TEST_BEEP,
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
OmnipodCommandType.CANCEL_BOLUS -> {
- android.graphics.Color.GREEN
+ R.attr.omniCyanColor
}
// Insulin treatment
OmnipodCommandType.SET_BOLUS,
OmnipodCommandType.SET_TEMPORARY_BASAL -> {
- android.graphics.Color.WHITE
+ R.attr.defaultTextColor
}
else ->
// Other
- android.graphics.Color.LTGRAY
+ R.attr.omniGrayColor
}
- textview.setTextColor(textColor)
+ textview.setTextColor(rh.gac( textview.context, textColorAttr))
}
private fun setType(record: HistoryRecord, typeView: TextView) {
diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt
index bdf09c0a36..791f655273 100644
--- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt
+++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt
@@ -28,7 +28,6 @@ import javax.inject.Inject
class DashPodManagementActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var injector: HasAndroidInjector
diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt
index 4cec6298f6..f8d0588455 100644
--- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt
+++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt
@@ -267,14 +267,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
val quality =
"${podStateManager.successfulConnectionAttemptsAfterRetries}/$connectionAttempts :: $successPercentageString"
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
- val connectionStatsColor = when {
+ val connectionStatsColor = rh.gac( context, when {
connectionSuccessPercentage < 70 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
- Color.RED
+ R.attr.warningColor
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
- Color.YELLOW
+ R.attr.omniYellowColor
else ->
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor)
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
podStateManager.deliveryStatus.toString()
@@ -296,11 +296,11 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
podInfoBinding.firmwareVersion.text = PLACEHOLDER
podInfoBinding.timeOnPod.text = PLACEHOLDER
podInfoBinding.podExpiryDate.text = PLACEHOLDER
- podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
+ podInfoBinding.podExpiryDate.setTextColor(rh.gac(context,R.attr.defaultTextColor))
podInfoBinding.baseBasalRate.text = PLACEHOLDER
podInfoBinding.totalDelivered.text = PLACEHOLDER
podInfoBinding.reservoir.text = PLACEHOLDER
- podInfoBinding.reservoir.setTextColor(Color.WHITE)
+ podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
} else {
podInfoBinding.uniqueId.text = podStateManager.uniqueId.toString()
@@ -335,14 +335,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
).isNegative
} ?: false
podInfoBinding.timeOnPod.setTextColor(
+ rh.gac( context,
when {
!podStateManager.sameTimeZone ->
- Color.MAGENTA
+ R.attr.omniMagentaColor
timeDeviationTooBig ->
- Color.YELLOW
+ R.attr.omniYellowColor
else ->
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
)
// Update Pod expiry time
@@ -352,14 +353,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
?: PLACEHOLDER
podInfoBinding.podExpiryDate.setTextColor(
- when {
+ rh.gac( context,
+ when {
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
- Color.RED
+ R.attr.warningColor
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
- Color.YELLOW
+ R.attr.omniYellowColor
else ->
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
)
podStateManager.alarmType?.let {
@@ -399,7 +401,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
if (podStateManager.pulsesRemaining == null) {
podInfoBinding.reservoir.text =
rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
- podInfoBinding.reservoir.setTextColor(Color.WHITE)
+ podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
} else {
// TODO
// val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
@@ -411,11 +413,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
(podStateManager.pulsesRemaining!! * PodConstants.POD_PULSE_BOLUS_UNITS)
)
podInfoBinding.reservoir.setTextColor(
+ rh.gac(context,
if (podStateManager.pulsesRemaining!! < lowReservoirThreshold) {
- Color.RED
+ R.attr.warningColor
} else {
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
)
}
@@ -426,10 +429,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
if (errors.size == 0) {
podInfoBinding.errors.text = PLACEHOLDER
- podInfoBinding.errors.setTextColor(Color.WHITE)
+ podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.defaultTextColor))
} else {
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
- podInfoBinding.errors.setTextColor(Color.RED)
+ podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.warningColor))
}
}
@@ -465,14 +468,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
)
)
val lastConnectionColor =
+ rh.gac(context,
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
- Color.RED
+ R.attr.warningColor
} else {
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
} else {
- podInfoBinding.lastConnection.setTextColor(Color.WHITE)
+ podInfoBinding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor ))
podInfoBinding.lastConnection.text = PLACEHOLDER
}
}
@@ -508,20 +512,20 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
}
- val podStatusColor = when {
+ val podStatusColor = rh.gac( context, when {
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
- Color.RED
+ R.attr.warningColor
podStateManager.activeCommand != null ->
- Color.YELLOW
+ R.attr.omniYellowColor
else ->
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
podInfoBinding.podStatus.setTextColor(podStatusColor)
}
private fun updateLastBolus() {
- var textColor = Color.WHITE
+ var textColorAttr = R.attr.defaultTextColor
podStateManager.activeCommand?.let {
val requestedBolus = it.requestedBolus
if (requestedBolus != null) {
@@ -532,14 +536,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
readableDuration(Duration.ofMillis(SystemClock.elapsedRealtime() - it.createdRealtime))
)
text += " (uncertain) "
- textColor = Color.RED
+ textColorAttr = R.attr.warningColor
podInfoBinding.lastBolus.text = text
- podInfoBinding.lastBolus.setTextColor(textColor)
+ podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
return
}
}
- podInfoBinding.lastBolus.setTextColor(textColor)
+ podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
podStateManager.lastBolus?.let {
// display requested units if delivery is in progress
val bolusSize = it.deliveredUnits()
@@ -552,10 +556,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
readableDuration(Duration.ofMillis(System.currentTimeMillis() - it.startTime))
)
if (!it.deliveryComplete) {
- textColor = Color.YELLOW
+ textColorAttr = R.attr.omniYellowColor
}
podInfoBinding.lastBolus.text = text
- podInfoBinding.lastBolus.setTextColor(textColor)
+ podInfoBinding.lastBolus.setTextColor(rh.gac(context, textColorAttr))
return
}
podInfoBinding.lastBolus.text = PLACEHOLDER
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/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt
index 2ec76043d5..0aa199eabc 100644
--- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt
+++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt
@@ -43,7 +43,6 @@ import javax.inject.Inject
*/
class ErosPodManagementActivity : NoSplashAppCompatActivity() {
- @Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var podStateManager: ErosPodStateManager
diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt
index f7ab77aeb2..cccb5a0d33 100644
--- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt
+++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/OmnipodErosOverviewFragment.kt
@@ -245,7 +245,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
}
- rileyLinkStatusBinding.rileyLinkStatus.setTextColor(if (rileyLinkServiceState.isError || rileyLinkError != null) Color.RED else Color.WHITE)
+ rileyLinkStatusBinding.rileyLinkStatus.setTextColor( rh.gac(context, if (rileyLinkServiceState.isError || rileyLinkError != null) R.attr.warningColor else R.attr.defaultTextColor))
}
private fun updateOmnipodStatus() {
@@ -273,11 +273,11 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
podInfoBinding.firmwareVersion.text = PLACEHOLDER
podInfoBinding.timeOnPod.text = PLACEHOLDER
podInfoBinding.podExpiryDate.text = PLACEHOLDER
- podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
+ podInfoBinding.podExpiryDate.setTextColor(rh.gac(context, R.attr.defaultTextColor))
podInfoBinding.baseBasalRate.text = PLACEHOLDER
podInfoBinding.totalDelivered.text = PLACEHOLDER
podInfoBinding.reservoir.text = PLACEHOLDER
- podInfoBinding.reservoir.setTextColor(Color.WHITE)
+ podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
} else {
podInfoBinding.uniqueId.text = podStateManager.address.toString()
@@ -287,25 +287,27 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
podInfoBinding.timeOnPod.setTextColor(
+ rh.gac(context,
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
- Color.RED
+ R.attr.defaultTextColor
} else {
- Color.WHITE
- }
+ R.attr.warningColor
+ })
)
val expiresAt = podStateManager.expiresAt
if (expiresAt == null) {
podInfoBinding.podExpiryDate.text = PLACEHOLDER
- podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
+ podInfoBinding.podExpiryDate.setTextColor(rh.gac(context, R.attr.defaultTextColor))
} else {
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
podInfoBinding.podExpiryDate.setTextColor(
+ rh.gac(context,
if (DateTime.now().isAfter(expiresAt)) {
- Color.RED
+ R.attr.warningColor
} else {
- Color.WHITE
+ R.attr.defaultTextColor
}
- )
+ ))
}
if (podStateManager.isPodFaulted) {
@@ -331,18 +333,19 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
// reservoir
if (podStateManager.reservoirLevel == null) {
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
- podInfoBinding.reservoir.setTextColor(Color.WHITE)
+ podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
} else {
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
podInfoBinding.reservoir.setTextColor(
+ rh.gac(context,
if (podStateManager.reservoirLevel < lowReservoirThreshold) {
- Color.RED
+ R.attr.warningColor
} else {
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
)
}
@@ -355,10 +358,10 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
if (errors.size == 0) {
podInfoBinding.errors.text = PLACEHOLDER
- podInfoBinding.errors.setTextColor(Color.WHITE)
+ podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.defaultTextColor))
} else {
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
- podInfoBinding.errors.setTextColor(Color.RED)
+ podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.warningColor))
}
}
@@ -366,14 +369,15 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
val lastConnectionColor =
+ rh.gac(context,
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
- Color.RED
+ R.attr.warningColor
} else {
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
} else {
- podInfoBinding.lastConnection.setTextColor(Color.WHITE)
+ podInfoBinding.lastConnection.setTextColor(rh.gac(context, R.attr.defaultTextColor))
podInfoBinding.lastConnection.text = if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
readableDuration(podStateManager.lastSuccessfulCommunication)
} else {
@@ -418,11 +422,12 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
}
val podStatusColor =
+ rh.gac( context,
if (!podStateManager.isPodActivationCompleted || podStateManager.isPodDead || podStateManager.isSuspended || (podStateManager.isPodRunning && !podStateManager.isBasalCertain)) {
- Color.RED
+ R.attr.warningColor
} else {
- Color.WHITE
- }
+ R.attr.defaultTextColor
+ })
podInfoBinding.podStatus.setTextColor(podStatusColor)
}
@@ -436,11 +441,10 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
readableDuration(podStateManager.lastBolusStartTime)
)
val textColor: Int
-
if (podStateManager.isLastBolusCertain) {
- textColor = Color.WHITE
+ textColor = rh.gac(context, R.attr.defaultTextColor)
} else {
- textColor = Color.RED
+ textColor = rh.gac(context, R.attr.warningColor)
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
}
@@ -449,7 +453,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
} else {
podInfoBinding.lastBolus.text = PLACEHOLDER
- podInfoBinding.lastBolus.setTextColor(Color.WHITE)
+ podInfoBinding.lastBolus.setTextColor(rh.gac(context, R.attr.defaultTextColor))
}
}
@@ -457,7 +461,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
if (podStateManager.isPodActivationCompleted && podStateManager.isTempBasalRunning) {
if (!podStateManager.hasTempBasal()) {
podInfoBinding.tempBasal.text = "???"
- podInfoBinding.tempBasal.setTextColor(Color.RED)
+ podInfoBinding.tempBasal.setTextColor(rh.gac(context, R.attr.warningColor))
} else {
val now = DateTime.now()
@@ -471,9 +475,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
val textColor: Int
text = rh.gs(R.string.omnipod_common_overview_temp_basal_value, amount, dateUtil.timeString(startTime.millis), minutesRunning, duration.standardMinutes)
if (podStateManager.isTempBasalCertain) {
- textColor = Color.WHITE
+ textColor = rh.gac(context, R.attr.defaultTextColor)
} else {
- textColor = Color.RED
+ textColor = rh.gac(context, R.attr.warningColor)
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
}
@@ -485,9 +489,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
val textColor: Int
if (!podStateManager.isPodActivationCompleted || podStateManager.isTempBasalCertain) {
- textColor = Color.WHITE
+ textColor = rh.gac(context, R.attr.defaultTextColor)
} else {
- textColor = Color.RED
+ textColor = rh.gac(context, R.attr.warningColor)
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
}
diff --git a/omnipod-eros/src/main/res/values/colors.xml b/omnipod-eros/src/main/res/values/colors.xml
deleted file mode 100644
index 62d3e623c9..0000000000
--- a/omnipod-eros/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- #b9d2d2
- #66BB6A
- #FF7043
-
-
- @color/rl_board_shape
- @color/rl_icon_outline
-
-
- @color/rl_board_shape
- @color/rl_icon_outline
-
\ No newline at end of file
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);