This commit is contained in:
Milos Kozak 2022-03-13 11:10:27 +01:00
commit 6919565c3c
66 changed files with 818 additions and 622 deletions

View file

@ -6,6 +6,7 @@ import android.content.IntentFilter
import android.net.ConnectivityManager
import android.net.wifi.WifiManager
import android.os.Build
import androidx.lifecycle.ProcessLifecycleOwner
import com.uber.rxdogtag.RxDogTag
import dagger.android.AndroidInjector
import dagger.android.DaggerApplication
@ -35,6 +36,7 @@ import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.ProcessLifecycleListener
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.locale.LocaleHelper
import info.nightscout.androidaps.utils.protection.PasswordCheck
@ -70,6 +72,7 @@ class MainApp : DaggerApplication() {
@Inject lateinit var passwordCheck: PasswordCheck
@Inject lateinit var alarmSoundServiceHelper: AlarmSoundServiceHelper
@Inject lateinit var notificationStore: NotificationStore
@Inject lateinit var processLifecycleListener: ProcessLifecycleListener
override fun onCreate() {
super.onCreate()
@ -77,6 +80,7 @@ class MainApp : DaggerApplication() {
RxDogTag.install()
setRxErrorHandler()
LocaleHelper.update(this)
ProcessLifecycleOwner.get().lifecycle.addObserver(processLifecycleListener)
var gitRemote: String? = BuildConfig.REMOTE
var commitHash: String? = BuildConfig.HEAD

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProv
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@ -50,6 +51,7 @@ class CarbsDialog : DialogFragmentWithDate() {
@Inject lateinit var bolusTimer: BolusTimer
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var repository: AppRepository
@Inject lateinit var protectionCheck: ProtectionCheck
companion object {
@ -377,4 +379,17 @@ class CarbsDialog : DialogFragmentWithDate() {
}
return true
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -22,7 +22,10 @@ import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.shared.SafeParse
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.shared.logging.LTag
import java.text.DecimalFormat
import java.util.*
import javax.inject.Inject
@ -36,6 +39,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var protectionCheck: ProtectionCheck
private var _binding: DialogExtendedbolusBinding? = null
@ -106,4 +110,17 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
}
return true
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -28,6 +28,8 @@ import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.shared.SafeParse
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@ -44,6 +46,7 @@ class FillDialog : DialogFragmentWithDate() {
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var repository: AppRepository
@Inject lateinit var protectionCheck: ProtectionCheck
private val disposable = CompositeDisposable()
@ -196,4 +199,17 @@ class FillDialog : DialogFragmentWithDate() {
}
})
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -28,6 +28,7 @@ import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.extensions.toSignedString
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.shared.SafeParse
import io.reactivex.rxjava3.disposables.CompositeDisposable
@ -52,6 +53,7 @@ class InsulinDialog : DialogFragmentWithDate() {
@Inject lateinit var config: Config
@Inject lateinit var bolusTimer: BolusTimer
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var protectionCheck: ProtectionCheck
companion object {
@ -255,4 +257,17 @@ class InsulinDialog : DialogFragmentWithDate() {
}
return true
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -38,6 +38,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.disposables.CompositeDisposable
@ -62,6 +63,7 @@ class LoopDialog : DaggerDialogFragment() {
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var repository: AppRepository
@Inject lateinit var objectivePlugin: ObjectivesPlugin
@Inject lateinit var protectionCheck: ProtectionCheck
private var showOkCancel: Boolean = true
private var _binding: DialogLoopBinding? = null
@ -437,4 +439,17 @@ class LoopDialog : DaggerDialogFragment() {
aapsLogger.debug(e.localizedMessage ?: e.toString())
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.dialogs
import android.content.Context
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
@ -30,7 +31,9 @@ import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@ -51,6 +54,8 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
@Inject lateinit var hardLimits: HardLimits
@Inject lateinit var rxBus: RxBus
@Inject lateinit var defaultValueHelper: DefaultValueHelper
@Inject lateinit var ctx: Context
@Inject lateinit var protectionCheck: ProtectionCheck
private var profileIndex: Int? = null
@ -245,4 +250,17 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
}
return true
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -20,7 +20,10 @@ import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.shared.SafeParse
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.shared.logging.LTag
import java.text.DecimalFormat
import java.util.*
import javax.inject.Inject
@ -35,6 +38,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
@Inject lateinit var commandQueue: CommandQueue
@Inject lateinit var ctx: Context
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var protectionCheck: ProtectionCheck
private var isPercentPump = true
@ -141,4 +145,17 @@ class TempBasalDialog : DialogFragmentWithDate() {
}
return true
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.dialogs
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -26,7 +27,9 @@ import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@ -43,6 +46,8 @@ class TempTargetDialog : DialogFragmentWithDate() {
@Inject lateinit var defaultValueHelper: DefaultValueHelper
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var repository: AppRepository
@Inject lateinit var ctx: Context
@Inject lateinit var protectionCheck: ProtectionCheck
private lateinit var reasonList: List<String>
@ -218,4 +223,17 @@ class TempTargetDialog : DialogFragmentWithDate() {
}
return true
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -30,6 +30,7 @@ import info.nightscout.shared.SafeParse
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@ -48,6 +49,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
@Inject lateinit var config: Config
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var repository: AppRepository
@Inject lateinit var protectionCheck: ProtectionCheck
private val disposable = CompositeDisposable()
@ -201,4 +203,17 @@ class TreatmentDialog : DialogFragmentWithDate() {
}
return true
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -29,6 +29,7 @@ import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.extensions.valueToUnits
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.sharedPreferences.SP
@ -55,6 +56,7 @@ class WizardDialog : DaggerDialogFragment() {
@Inject lateinit var iobCobCalculator: IobCobCalculator
@Inject lateinit var repository: AppRepository
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var protectionCheck: ProtectionCheck
private var wizard: BolusWizard? = null
private var calculatedPercentage = 100.0
@ -497,4 +499,17 @@ class WizardDialog : DaggerDialogFragment() {
aapsLogger.debug(e.localizedMessage ?: "")
}
}
override fun onResume() {
super.onResume()
activity?.let { activity ->
val cancelFail = {
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
ToastUtils.showToastInUiThread(ctx, R.string.dialog_cancled)
dismiss()
}
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, {}, cancelFail, fail = cancelFail)
}
}
}

View file

@ -8,6 +8,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TableRow
import android.widget.TextView
import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment
@ -108,6 +109,7 @@ class ActionsFragment : DaggerFragment() {
private var insulinLevelLabel: TextView? = null
private var pbLevelLabel: TextView? = null
private var cannulaOrPatch: TextView? = null
private var batteryLayout: TableRow? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
@ -143,7 +145,6 @@ class ActionsFragment : DaggerFragment() {
historyBrowser = view.findViewById(R.id.actions_historybrowser)
tddStats = view.findViewById(R.id.actions_tddstats)
pumpBatteryChange = view.findViewById(R.id.actions_pumpbatterychange)
cannulaAge = view.findViewById(R.id.cannula_age)
insulinAge = view.findViewById(R.id.insulin_age)
reservoirLevel = view.findViewById(R.id.reservoir_level)
@ -155,6 +156,7 @@ class ActionsFragment : DaggerFragment() {
insulinLevelLabel = view.findViewById(R.id.insulin_level_label)
pbLevelLabel = view.findViewById(R.id.pb_level_label)
cannulaOrPatch = view.findViewById(R.id.cannula_or_patch)
batteryLayout = view.findViewById(R.id.battery_layout)
profileSwitch?.setOnClickListener {
activity?.let { activity ->
@ -327,18 +329,14 @@ class ActionsFragment : DaggerFragment() {
val activeBgSource = activePlugin.activeBgSource
historyBrowser?.visibility = (profile != null).toVisibility()
fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized() && !pump.isSuspended()).toVisibility()
if (pump is DiaconnG8Plugin) {
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable && !pump.isBatteryChangeLoggingEnabled()).toVisibility()
} else {
pumpBatteryChange?.visibility =
(pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).toVisibility()
}
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()).toVisibility()
tempTarget?.visibility = (profile != null && !loop.isDisconnected).toVisibility()
tddStats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
cannulaOrPatch?.text = if (pump.pumpDescription.isPatchPump) rh.gs(R.string.patch_pump) else rh.gs(R.string.cannula)
val imageResource = if (pump.pumpDescription.isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula
val isPatchPump = pump.pumpDescription.isPatchPump
cannulaOrPatch?.text = if (isPatchPump) rh.gs(R.string.patch_pump) else rh.gs(R.string.cannula)
val imageResource = if (isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula
cannulaOrPatch?.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0)
batteryLayout?.visibility = (!isPatchPump || pump.pumpDescription.useHardwareLink).toVisibility()
if (!config.NSCLIENT) {
statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel)
@ -391,4 +389,4 @@ class ActionsFragment : DaggerFragment() {
for (customButton in pumpCustomButtons) buttonsLayout?.removeView(customButton)
pumpCustomButtons.clear()
}
}
}

View file

@ -34,6 +34,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.dialogs.*
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange
import info.nightscout.androidaps.events.EventInitializationChanged
@ -61,6 +62,7 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
import info.nightscout.androidaps.plugins.general.wear.events.EventWearInitiateAction
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.source.DexcomPlugin
import info.nightscout.androidaps.plugins.source.XdripPlugin
import info.nightscout.androidaps.skins.SkinProvider
@ -866,13 +868,19 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
fun updateTime(from: String) {
binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now())
// Status lights
val isPatchPump = activePlugin.activePump.pumpDescription.isPatchPump
val pump = activePlugin.activePump
val isPatchPump = pump.pumpDescription.isPatchPump
binding.statusLightsLayout.apply {
cannulaOrPatch.setImageResource(if (isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula)
cannulaOrPatch.contentDescription = rh.gs(if (isPatchPump) R.string.statuslights_patch_pump_age else R.string.statuslights_cannula_age)
cannulaOrPatch.scaleX = if (isPatchPump) 1.4f else 2f
cannulaOrPatch.scaleY = cannulaOrPatch.scaleX
insulinAge.visibility = isPatchPump.not().toVisibility()
batteryLayout.visibility = (!isPatchPump || pump.pumpDescription.useHardwareLink).toVisibility()
pbAge.visibility = (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()).toVisibility()
val useBatteryLevel = (pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin)
|| (pump.model() != PumpType.ACCU_CHEK_COMBO && pump.model() != PumpType.OMNIPOD_DASH)
batteryLevel.visibility = useBatteryLevel.toVisibility()
statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility()
}
statusLightHandler.updateStatusLights(

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.general.overview
import android.graphics.Color
import android.view.View
import android.widget.TextView
import androidx.annotation.StringRes
import info.nightscout.androidaps.R
@ -42,7 +41,7 @@ class StatusLightHandler @Inject constructor(
handleAge(careportal_cannula_age, TherapyEvent.Type.CANNULA_CHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0)
handleAge(careportal_insulin_age, TherapyEvent.Type.INSULIN_CHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0)
handleAge(careportal_sensor_age, TherapyEvent.Type.SENSOR_CHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0)
if (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)) {
if (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()) {
handleAge(careportal_pb_age, TherapyEvent.Type.PUMP_BATTERY_CHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
}
if (!config.NSCLIENT) {
@ -58,16 +57,16 @@ class StatusLightHandler @Inject constructor(
}
if (!config.NSCLIENT) {
if (pump.model() == PumpType.OMNIPOD_DASH) {
// Omnipod Dash does not report its battery level
// The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do.
// Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a"
// Pump instance check is needed because at startup, the pump can still be VirtualPumpPlugin and that will cause a crash
val erosBatteryLinkAvailable = pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel
if (pump.model().supportBatteryLevel || erosBatteryLinkAvailable) {
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)
} else if (pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin) { // instance of check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below
// The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do.
// Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a"
handleOmnipodErosBatteryLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%", pump.isUseRileyLinkBatteryLevel)
} else if (pump.model() != PumpType.ACCU_CHEK_COMBO) {
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
}
}
}
@ -104,13 +103,4 @@ class StatusLightHandler @Inject constructor(
}
}
@Suppress("SameParameterValue")
private fun handleOmnipodErosBatteryLevel(view: TextView?, criticalSetting: Int, criticalDefaultValue: Double, warnSetting: Int, warnDefaultValue: Double, level: Double, units: String, useRileyLinkBatteryLevel: Boolean) {
if (useRileyLinkBatteryLevel) {
handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units)
} else {
view?.text = rh.gs(R.string.notavailable)
view?.setTextColor(Color.WHITE)
}
}
}
}

View file

@ -2,15 +2,9 @@ package info.nightscout.androidaps.plugins.general.overview.activities
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG
@ -23,11 +17,14 @@ import androidx.recyclerview.widget.RecyclerView
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.DaggerAppCompatActivityWithResult
import info.nightscout.androidaps.databinding.OverviewQuickwizardlistActivityBinding
import info.nightscout.androidaps.databinding.OverviewQuickwizardlistItemBinding
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.wizard.QuickWizard
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
@ -46,17 +43,16 @@ class QuickWizardListActivity : DaggerAppCompatActivityWithResult() {
@Inject lateinit var sp: SP
private var disposable: CompositeDisposable = CompositeDisposable()
private var selectedItems: SparseArray<QuickWizardEntry> = SparseArray()
private var removeActionMode: ActionMode? = null
private var sortActionMode: ActionMode? = null
private lateinit var binding: OverviewQuickwizardlistActivityBinding
private val itemTouchHelper by lazy {
val simpleItemTouchCallback = object : ItemTouchHelper.SimpleCallback(UP or DOWN or START or END, 0) {
override fun onMove(
recyclerView: RecyclerView,
viewHolder: RecyclerView.ViewHolder,
target: RecyclerView.ViewHolder
): Boolean {
override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
val adapter = recyclerView.adapter as RecyclerViewAdapter
val from = viewHolder.layoutPosition
val to = target.layoutPosition
@ -66,12 +62,10 @@ class QuickWizardListActivity : DaggerAppCompatActivityWithResult() {
return true
}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}
override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
super.onSelectedChanged(viewHolder, actionState)
if (actionState == ACTION_STATE_DRAG) {
viewHolder?.itemView?.alpha = 0.5f
}
@ -79,11 +73,8 @@ class QuickWizardListActivity : DaggerAppCompatActivityWithResult() {
override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) {
super.clearView(recyclerView, viewHolder)
viewHolder.itemView.alpha = 1.0f
val adapter = recyclerView.adapter as RecyclerViewAdapter
adapter.onDrop()
(recyclerView.adapter as RecyclerViewAdapter).onDrop()
}
}
@ -96,82 +87,84 @@ class QuickWizardListActivity : DaggerAppCompatActivityWithResult() {
private inner class RecyclerViewAdapter(var fragmentManager: FragmentManager) : RecyclerView.Adapter<RecyclerViewAdapter.QuickWizardEntryViewHolder>() {
@SuppressLint("ClickableViewAccessibility")
private inner class QuickWizardEntryViewHolder(val binding: OverviewQuickwizardlistItemBinding, val fragmentManager: FragmentManager) : RecyclerView.ViewHolder(binding.root)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuickWizardEntryViewHolder {
val itemView = LayoutInflater.from(parent.context).inflate(R.layout.overview_quickwizardlist_item, parent, false)
val viewHolder = QuickWizardEntryViewHolder(itemView, fragmentManager)
viewHolder.handleView.setOnTouchListener { _, event ->
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
startDragging(viewHolder)
}
return@setOnTouchListener true
}
return viewHolder
val binding = OverviewQuickwizardlistItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return QuickWizardEntryViewHolder(binding, fragmentManager)
}
@SuppressLint("ClickableViewAccessibility")
override fun onBindViewHolder(holder: QuickWizardEntryViewHolder, position: Int) {
holder.from.text = dateUtil.timeString(quickWizard[position].validFromDate())
holder.to.text = dateUtil.timeString(quickWizard[position].validToDate())
val wearControl = sp.getBoolean(R.string.key_wear_control, false)
if (wearControl) {
holder.handleView.visibility = View.VISIBLE
val entry = quickWizard[position]
holder.binding.from.text = dateUtil.timeString(entry.validFromDate())
holder.binding.to.text = dateUtil.timeString(entry.validToDate())
holder.binding.buttonText.text = entry.buttonText()
holder.binding.carbs.text = rh.gs(R.string.format_carbs, entry.carbs())
if (entry.device() == QuickWizardEntry.DEVICE_ALL) {
holder.binding.device.visibility = View.GONE
} else {
holder.handleView.visibility = View.GONE
}
if (quickWizard[position].device() == QuickWizardEntry.DEVICE_ALL) {
holder.device.visibility = View.GONE
} else {
holder.device.visibility = View.VISIBLE
holder.device.setImageResource(
holder.binding.device.visibility = View.VISIBLE
holder.binding.device.setImageResource(
when (quickWizard[position].device()) {
QuickWizardEntry.DEVICE_WATCH -> R.drawable.ic_watch
else -> R.drawable.ic_smartphone
}
)
}
holder.buttonText.text = quickWizard[position].buttonText()
holder.carbs.text = rh.gs(R.string.format_carbs, quickWizard[position].carbs())
if (sortActionMode != null && removeActionMode != null) {
holder.binding.cardview.setOnClickListener {
val manager = fragmentManager
val editQuickWizardDialog = EditQuickWizardDialog()
val bundle = Bundle()
bundle.putInt("position", position)
editQuickWizardDialog.arguments = bundle
editQuickWizardDialog.show(manager, "EditQuickWizardDialog")
}
}
fun updateSelection(selected: Boolean) {
if (selected) {
selectedItems.put(position, entry)
} else {
selectedItems.remove(position)
}
removeActionMode?.title = rh.gs(R.string.count_selected, selectedItems.size())
}
holder.binding.cardview.setOnTouchListener { _, event ->
if (event.actionMasked == MotionEvent.ACTION_UP && sortActionMode == null && removeActionMode == null) {
val manager = fragmentManager
val editQuickWizardDialog = EditQuickWizardDialog()
val bundle = Bundle()
bundle.putInt("position", position)
editQuickWizardDialog.arguments = bundle
editQuickWizardDialog.show(manager, "EditQuickWizardDialog")
}
if (event.actionMasked == MotionEvent.ACTION_DOWN && sortActionMode != null) {
startDragging(holder)
}
if (event.actionMasked == MotionEvent.ACTION_UP && removeActionMode != null) {
holder.binding.cbRemove.toggle()
updateSelection(holder.binding.cbRemove.isChecked)
}
return@setOnTouchListener true
}
holder.binding.cbRemove.isChecked = selectedItems.get(position) != null
holder.binding.cbRemove.setOnCheckedChangeListener { _, value -> updateSelection(value) }
holder.binding.handleView.visibility = (sortActionMode != null).toVisibility()
holder.binding.cbRemove.visibility = (removeActionMode != null).toVisibility()
removeActionMode?.title = rh.gs(R.string.count_selected, selectedItems.size())
}
override fun getItemCount(): Int = quickWizard.size()
private inner class QuickWizardEntryViewHolder(itemView: View, var fragmentManager: FragmentManager) : RecyclerView.ViewHolder(itemView) {
val buttonText: TextView = itemView.findViewById(R.id.overview_quickwizard_item_buttonText)
val carbs: TextView = itemView.findViewById(R.id.overview_quickwizard_item_carbs)
val from: TextView = itemView.findViewById(R.id.overview_quickwizard_item_from)
val handleView: ImageView = itemView.findViewById(R.id.handleView)
val device: ImageView = itemView.findViewById(R.id.overview_quickwizard_item_device)
val to: TextView = itemView.findViewById(R.id.overview_quickwizard_item_to)
private val editButton: Button = itemView.findViewById(R.id.overview_quickwizard_item_edit_button)
private val removeButton: Button = itemView.findViewById(R.id.overview_quickwizard_item_remove_button)
init {
editButton.setOnClickListener {
val manager = fragmentManager
val editQuickWizardDialog = EditQuickWizardDialog()
val bundle = Bundle()
bundle.putInt("position", bindingAdapterPosition)
editQuickWizardDialog.arguments = bundle
editQuickWizardDialog.show(manager, "EditQuickWizardDialog")
}
removeButton.setOnClickListener {
quickWizard.remove(bindingAdapterPosition)
rxBus.send(EventQuickWizardChange())
}
}
}
fun moveItem(from: Int, to: Int) {
Log.i("QuickWizard", "moveItem")
quickWizard.move(from, to)
}
fun onDrop() {
Log.i("QuickWizard", "onDrop")
rxBus.send(EventQuickWizardChange())
}
}
@ -213,13 +206,107 @@ class QuickWizardListActivity : DaggerAppCompatActivityWithResult() {
super.onPause()
}
private fun removeSelected() {
if (selectedItems.size() > 0)
OKDialog.showConfirmation(this, rh.gs(R.string.removerecord), getConfirmationText(), Runnable {
selectedItems.forEach { _, item ->
quickWizard.remove(item.position)
rxBus.send(EventQuickWizardChange())
}
removeActionMode?.finish()
})
else
removeActionMode?.finish()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.menu_quickwizard, menu)
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
android.R.id.home -> {
android.R.id.home -> {
finish()
true
}
else -> false
R.id.nav_remove_items -> {
removeActionMode = startActionMode(RemoveActionModeCallback())
true
}
R.id.nav_sort_items -> {
sortActionMode = startActionMode(SortActionModeCallback())
true
}
else -> false
}
inner class RemoveActionModeCallback : ActionMode.Callback {
override fun onCreateActionMode(mode: ActionMode, menu: Menu?): Boolean {
mode.menuInflater.inflate(R.menu.menu_delete_selection, menu)
selectedItems.clear()
mode.title = rh.gs(R.string.count_selected, selectedItems.size())
binding.recyclerview.adapter?.notifyDataSetChanged()
return true
}
override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?) = false
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
return when (item.itemId) {
R.id.remove_selected -> {
removeSelected()
true
}
else -> false
}
}
override fun onDestroyActionMode(mode: ActionMode?) {
removeActionMode = null
binding.recyclerview.adapter?.notifyDataSetChanged()
}
}
inner class SortActionModeCallback : ActionMode.Callback {
override fun onCreateActionMode(mode: ActionMode, menu: Menu?): Boolean {
mode.title = rh.gs(R.string.sort_label)
binding.recyclerview.adapter?.notifyDataSetChanged()
return true
}
override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?) = false
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
return when (item.itemId) {
R.id.remove_selected -> {
removeSelected()
true
}
else -> false
}
}
override fun onDestroyActionMode(mode: ActionMode?) {
sortActionMode = null
binding.recyclerview.adapter?.notifyDataSetChanged()
}
}
private fun getConfirmationText(): String {
if (selectedItems.size() == 1) {
val entry = selectedItems.valueAt(0)
return "${rh.gs(R.string.remove_button)} ${entry.buttonText()} ${rh.gs(R.string.format_carbs, entry.carbs())}\n" +
"${dateUtil.timeString(entry.validFromDate())} - ${dateUtil.timeString(entry.validToDate())}"
}
return rh.gs(R.string.confirm_remove_multiple_items, selectedItems.size())
}
}

View file

@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.source
import android.graphics.Paint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.util.SparseArray
import android.view.*
import androidx.appcompat.widget.Toolbar
import androidx.core.util.forEach
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@ -54,11 +54,12 @@ class BGSourceFragment : DaggerFragment() {
private val disposable = CompositeDisposable()
private val millsToThePast = T.hours(36).msecs()
private var selectedItems: SparseArray<GlucoseValue> = SparseArray()
private var toolbar: Toolbar? = null
private var removeActionMode: ActionMode? = null
private var _binding: BgsourceFragmentBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
// This property is only valid between onCreateView and onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
@ -66,6 +67,8 @@ class BGSourceFragment : DaggerFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
toolbar = activity?.findViewById(R.id.toolbar)
setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
@ -94,17 +97,45 @@ class BGSourceFragment : DaggerFragment() {
@Synchronized
override fun onPause() {
removeActionMode?.finish()
disposable.clear()
super.onPause()
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.menu_bgsource, menu)
}
override fun onPrepareOptionsMenu(menu: Menu) {
// Only show when tab bg source is shown
menu.findItem(R.id.nav_remove_items)?.isVisible = isResumed
super.onPrepareOptionsMenu(menu)
}
@Synchronized
override fun onDestroyView() {
super.onDestroyView()
removeActionMode?.finish()
binding.recyclerview.adapter = null // avoid leaks
_binding = null
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.nav_remove_items -> {
if (toolbar != null) {
removeActionMode = toolbar?.startActionMode(RemoveActionModeCallback()) // in overview
} else {
removeActionMode = activity?.startActionMode(RemoveActionModeCallback()) // in Single FragmentActivity
}
true
}
else -> false
}
}
inner class RecyclerViewAdapter internal constructor(private var glucoseValues: List<GlucoseValue>) : RecyclerView.Adapter<RecyclerViewAdapter.GlucoseValuesViewHolder>() {
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): GlucoseValuesViewHolder {
@ -116,19 +147,43 @@ class BGSourceFragment : DaggerFragment() {
val glucoseValue = glucoseValues[position]
holder.binding.ns.visibility = (glucoseValue.interfaceIDs.nightscoutId != null).toVisibility()
holder.binding.invalid.visibility = (!glucoseValue.isValid).toVisibility()
val sameDayPrevious = position > 0 && dateUtil.isSameDay(glucoseValue.timestamp, glucoseValues[position-1].timestamp)
val sameDayPrevious = position > 0 && dateUtil.isSameDay(glucoseValue.timestamp, glucoseValues[position - 1].timestamp)
holder.binding.date.visibility = sameDayPrevious.not().toVisibility()
holder.binding.date.text = dateUtil.dateString(glucoseValue.timestamp)
holder.binding.time.text = dateUtil.timeString(glucoseValue.timestamp)
holder.binding.value.text = glucoseValue.valueToUnitsString(profileFunction.getUnits())
holder.binding.direction.setImageResource(glucoseValue.trendArrow.directionToIcon())
holder.binding.remove.tag = glucoseValue
if (position > 0) {
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))
}
fun updateSelection(selected: Boolean) {
if (selected) {
selectedItems.put(position, glucoseValue)
} else {
selectedItems.remove(position)
}
removeActionMode?.title = rh.gs(R.string.count_selected, selectedItems.size())
}
holder.binding.root.setOnLongClickListener {
if (removeActionMode == null) {
removeActionMode = toolbar?.startActionMode(RemoveActionModeCallback())
}
holder.binding.cbRemove.toggle()
updateSelection(holder.binding.cbRemove.isChecked)
true
}
holder.binding.root.setOnClickListener {
if (removeActionMode != null) {
holder.binding.cbRemove.toggle()
updateSelection(holder.binding.cbRemove.isChecked)
}
}
holder.binding.cbRemove.setOnCheckedChangeListener { _, value -> updateSelection(value) }
holder.binding.cbRemove.isChecked = selectedItems.get(position) != null
holder.binding.cbRemove.visibility = (removeActionMode != null).toVisibility()
}
override fun getItemCount(): Int = glucoseValues.size
@ -136,38 +191,76 @@ class BGSourceFragment : DaggerFragment() {
inner class GlucoseValuesViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val binding = BgsourceItemBinding.bind(view)
init {
binding.remove.paintFlags = binding.remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG
binding.remove.setOnClickListener { v: View ->
val glucoseValue = v.tag as GlucoseValue
activity?.let { activity ->
val text = dateUtil.dateAndTimeString(glucoseValue.timestamp) + "\n" + glucoseValue.valueToUnitsString(profileFunction.getUnits())
OKDialog.showConfirmation(activity, rh.gs(R.string.removerecord), text, Runnable {
val source = when ((activePlugin.activeBgSource as PluginBase).pluginDescription.pluginName) {
R.string.dexcom_app_patched -> Sources.Dexcom
R.string.eversense -> Sources.Eversense
R.string.Glimp -> Sources.Glimp
R.string.MM640g -> Sources.MM640g
R.string.nsclientbg -> Sources.NSClientSource
R.string.poctech -> Sources.PocTech
R.string.tomato -> Sources.Tomato
R.string.glunovo -> Sources.Glunovo
R.string.xdrip -> Sources.Xdrip
else -> Sources.Unknown
}
uel.log(
Action.BG_REMOVED, source,
ValueWithUnit.Timestamp(glucoseValue.timestamp)
)
repository.runTransactionForResult(InvalidateGlucoseValueTransaction(glucoseValue.id))
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating BG value", it) }
.blockingGet()
.also { result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated bg $it") } }
})
}
}
}
}
}
inner class RemoveActionModeCallback : ActionMode.Callback {
override fun onCreateActionMode(mode: ActionMode, menu: Menu?): Boolean {
mode.menuInflater.inflate(R.menu.menu_delete_selection, menu)
selectedItems.clear()
mode.title = rh.gs(R.string.count_selected, selectedItems.size())
binding.recyclerview.adapter?.notifyDataSetChanged()
return true
}
override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?) = false
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
return when (item.itemId) {
R.id.remove_selected -> {
removeSelected()
true
}
else -> false
}
}
override fun onDestroyActionMode(mode: ActionMode?) {
removeActionMode = null
binding.recyclerview.adapter?.notifyDataSetChanged()
}
}
private fun getConfirmationText(): String {
if (selectedItems.size() == 1) {
val glucoseValue = selectedItems.valueAt(0)
return dateUtil.dateAndTimeString(glucoseValue.timestamp) + "\n" + glucoseValue.valueToUnitsString(profileFunction.getUnits())
}
return rh.gs(R.string.confirm_remove_multiple_items, selectedItems.size())
}
private fun removeSelected() {
if (selectedItems.size() > 0)
activity?.let { activity ->
OKDialog.showConfirmation(activity, rh.gs(R.string.removerecord), getConfirmationText(), Runnable {
selectedItems.forEach { _, glucoseValue ->
val source = when ((activePlugin.activeBgSource as PluginBase).pluginDescription.pluginName) {
R.string.dexcom_app_patched -> Sources.Dexcom
R.string.eversense -> Sources.Eversense
R.string.Glimp -> Sources.Glimp
R.string.MM640g -> Sources.MM640g
R.string.nsclientbg -> Sources.NSClientSource
R.string.poctech -> Sources.PocTech
R.string.tomato -> Sources.Tomato
R.string.glunovo -> Sources.Glunovo
R.string.xdrip -> Sources.Xdrip
else -> Sources.Unknown
}
uel.log(
Action.BG_REMOVED, source,
ValueWithUnit.Timestamp(glucoseValue.timestamp)
)
repository.runTransactionForResult(InvalidateGlucoseValueTransaction(glucoseValue.id))
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating BG value", it) }
.blockingGet()
.also { result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated bg $it") } }
}
removeActionMode?.finish()
})
}
else
removeActionMode?.finish()
}
}

View file

@ -0,0 +1,13 @@
package info.nightscout.androidaps.utils
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import javax.inject.Inject
class ProcessLifecycleListener @Inject constructor(private val protectionCheck: ProtectionCheck) : DefaultLifecycleObserver {
override fun onPause(owner: LifecycleOwner) {
protectionCheck.resetAuthorization()
}
}

View file

@ -17,7 +17,7 @@
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium" />
@ -68,18 +68,19 @@
android:text="@string/invalid"
android:textColor="@android:color/holo_red_light" />
<TextView
android:id="@+id/remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="5dp"
android:text="@string/remove_button"
android:textAlignment="viewEnd"
android:textColor="@android:color/holo_orange_light" />
</LinearLayout>
<CheckBox
android:id="@+id/cb_remove"
android:layout_width="wrap_content"
android:layout_gravity="end"
android:layout_height="19dp"
android:contentDescription="@string/select_for_removal"
android:minWidth="0dp"
android:layout_marginTop="-25dp"
android:visibility="gone"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View file

@ -41,7 +41,6 @@
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/sensor_level_label"
android:layout_width="wrap_content"
@ -77,7 +76,7 @@
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="5"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</TableRow>
@ -96,7 +95,6 @@
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_insulin" />
<TextView
android:id="@+id/insulin_age_label"
android:layout_width="wrap_content"
@ -153,7 +151,7 @@
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="5"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</TableRow>
@ -226,11 +224,12 @@
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="5"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</TableRow>
<TableRow
android:id="@+id/battery_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
@ -246,7 +245,6 @@
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_battery" />
<TextView
android:id="@+id/pb_age_label"
android:layout_width="match_parent"
@ -290,20 +288,4 @@
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="5"
android:background="@color/list_delimiter" />
</TableRow>
</TableLayout>

View file

@ -1,232 +0,0 @@
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,2,4"
tools:context=".plugins.general.actions.ActionsFragment">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/careportal_sensor_label"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_sensor" />
<TextView
android:id="@+id/sensor_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/sensor_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="@color/list_delimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/careportal_insulin_label"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_insulin" />
<TextView
android:id="@+id/insulin_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/reservoir_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="@color/list_delimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:id="@+id/cannula_or_patch"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/cannula"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_cannula" />
<TextView
android:id="@+id/cannula_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:text=""
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="@color/list_delimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:id="@+id/pb_label"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/pump"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_battery" />
<TextView
android:id="@+id/pb_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/battery_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="@color/list_delimiter" />
</TableRow>
</TableLayout>

View file

@ -160,7 +160,7 @@
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
@ -270,7 +270,7 @@
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>
@ -393,7 +393,7 @@
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<com.google.android.material.button.MaterialButton
android:id="@+id/cancel"

View file

@ -340,7 +340,7 @@
android:layout_marginStart="20dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:id="@+id/result"
@ -441,7 +441,7 @@
android:layout_marginStart="20dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<TableRow
android:layout_width="match_parent"

View file

@ -133,7 +133,7 @@
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -61,7 +61,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -108,7 +108,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -154,7 +154,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -200,7 +200,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -246,7 +246,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -292,7 +292,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -338,7 +338,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -384,7 +384,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -430,7 +430,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -476,7 +476,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -522,7 +522,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -68,7 +68,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -94,7 +94,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -140,7 +140,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -186,7 +186,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -232,7 +232,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -278,7 +278,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -324,7 +324,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -370,7 +370,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -416,7 +416,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -442,7 +442,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<View
android:layout_width="fill_parent"
@ -451,7 +451,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -497,7 +497,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -543,7 +543,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -589,7 +589,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -1,25 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".plugins.general.overview.activities.QuickWizardListActivity">
<com.google.android.material.button.MaterialButton
android:id="@+id/add_button"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizardlistactivity_add" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="wrap_content" />
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:clickable="true"
android:contentDescription="@string/addnew"
android:focusable="true"
android:src="@drawable/ic_add_black_24dp"
tools:ignore="RelativeOverlap" />
</RelativeLayout>

View file

@ -2,7 +2,7 @@
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/overview_quickwizard_cardview"
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -47,7 +47,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/overview_quickwizard_item_buttonText"
android:id="@+id/buttonText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
@ -58,7 +58,7 @@
tools:ignore="HardcodedText,RtlSymmetry" />
<TextView
android:id="@+id/overview_quickwizard_item_carbs"
android:id="@+id/carbs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
@ -71,12 +71,11 @@
</LinearLayout>
<ImageView
android:id="@+id/overview_quickwizard_item_device"
android:id="@+id/device"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="false"
android:cropToPadding="false"
android:paddingEnd="10dp"
android:scaleType="fitStart"
card_view:srcCompat="@drawable/ic_smartphone"
tools:ignore="RtlSymmetry" />
@ -90,6 +89,13 @@
android:scaleType="fitStart"
card_view:srcCompat="@drawable/ic_reorder_gray_24dp" />
<CheckBox
android:id="@+id/cb_remove"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:contentDescription="@string/select_for_removal"
android:minWidth="0dp"/>
</LinearLayout>
<LinearLayout
@ -107,7 +113,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView
android:id="@+id/overview_quickwizard_item_from"
android:id="@+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
@ -124,7 +130,7 @@
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/overview_quickwizard_item_to"
android:id="@+id/to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
@ -136,33 +142,11 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
style="@style/GrayButton"
android:id="@+id/overview_quickwizard_item_edit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/overview_quickwizard_item_edit_button" />
<com.google.android.material.button.MaterialButton
style="@style/GrayButton"
android:id="@+id/overview_quickwizard_item_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/remove_button" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

View file

@ -94,6 +94,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/battery_layout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"

View file

@ -20,7 +20,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -285,7 +285,7 @@ android:visibility="gone"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -20,7 +20,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -129,7 +129,7 @@
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -20,7 +20,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -176,7 +176,7 @@
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -20,7 +20,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -141,7 +141,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -20,7 +20,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -195,7 +195,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -20,7 +20,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -164,7 +164,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -15,7 +15,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
android:gravity="center"
android:text="1.1.2000"
android:textAppearance="?android:attr/textAppearanceMedium"
@ -93,7 +93,7 @@
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter"
android:background="?android:attr/dividerHorizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/notes" />

View file

@ -65,7 +65,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -110,7 +110,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -155,7 +155,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -201,7 +201,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -247,7 +247,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -293,7 +293,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -339,7 +339,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"

View file

@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/nav_remove_items"
android:orderInCategory="0"
android:title="@string/remove_bg_readings"
app:showAsAction="never" />
</menu>

View file

@ -2,45 +2,57 @@
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<item
android:id="@+id/nav_preferences"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_preferences" />
<item
android:id="@+id/nav_plugin_preferences"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_plugin_preferences" />
<item
android:id="@+id/nav_treatments"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/treatments" />
<item
android:id="@+id/nav_historybrowser"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_historybrowser" />
<item
android:id="@+id/nav_setupwizard"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_setupwizard" />
<item
android:id="@+id/nav_stats"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/statistics" />
<!-- <item
android:id="@+id/nav_survey"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_survey" />
-->
<item
android:id="@+id/nav_defaultprofile"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_profilehelper" />
<item
android:id="@+id/nav_about"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_about" />
<item
android:id="@+id/nav_exit"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/nav_exit" />
</menu>

View file

@ -0,0 +1,14 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/nav_remove_items"
android:title="@string/remove_items"
app:showAsAction="never" />
<item
android:id="@+id/nav_sort_items"
android:title="@string/sort_items"
app:showAsAction="never" />
</menu>

View file

@ -827,6 +827,7 @@
<string name="show_invalidated">Show invalidated</string>
<string name="hide_invalidated">Hide invalidated</string>
<string name="remove_items">Remove items</string>
<string name="sort_items">Sort items</string>
<string name="storedsettingsfound">Stored settings found</string>
<string name="allow_hardware_pump_text">Attention: If you activate and connect to a hardware pump, AndroidAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AndroidAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time.</string>
<string name="error_adding_treatment_title">Treatment data incomplete</string>
@ -1139,6 +1140,7 @@
<string name="errors">Errors</string>
<string name="ns_sync_slow">Slow down uploads</string>
<string name="data_status">BG data status</string>
<string name="remove_bg_readings">Remove BG readings</string>
<string name="statuslights_cannula_age">cannula age</string>
<string name="statuslights_patch_pump_age">patch pump age</string>
<string name="patch_pump">Patch pump</string>
@ -1222,4 +1224,6 @@
<string name="hide_loop">Hide loop</string>
<string name="show_loop">Show loop</string>
<string name="count_selected">%1$d selected</string>
<string name="sort_label">Sort</string>
<string name="dialog_cancled">Dialog canceled</string>
</resources>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:validate="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="@string/key_configbuilder_general_settings"
@ -24,9 +25,8 @@
<EditTextPreference
android:inputType="textPersonName"
android:key="@string/key_patient_name"
android:title="@string/patient_name"
android:summary="@string/patient_name_summary"
/>
android:title="@string/patient_name" />
<PreferenceCategory
android:key="@string/key_protection_settings"
@ -35,8 +35,7 @@
<Preference
android:inputType="textPassword"
android:key="@string/key_master_password"
android:title="@string/master_password"
/>
android:title="@string/master_password" />
<ListPreference
android:defaultValue="0"
@ -83,6 +82,16 @@
android:key="@string/key_bolus_pin"
android:title="@string/bolus_pin" />
<EditTextPreference
android:inputType="number"
android:key="@string/key_protection_timeout"
android:title="@string/protection_timeout_title"
android:summary="@string/protection_timeout_summary"
app:defaultValue="0"
validate:maxNumber="180"
validate:minNumber="0"
validate:testType="numeric" />
</PreferenceCategory>
<info.nightscout.androidaps.skins.SkinListPreference
@ -91,4 +100,4 @@
</PreferenceCategory>
</androidx.preference.PreferenceScreen>
</androidx.preference.PreferenceScreen>

View file

@ -148,7 +148,7 @@
android:layout_height="2dip"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<RelativeLayout
android:layout_width="match_parent"

View file

@ -63,7 +63,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -109,7 +109,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
@ -157,7 +157,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -203,7 +203,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -249,7 +249,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -295,7 +295,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -341,7 +341,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -387,7 +387,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -433,7 +433,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -480,7 +480,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:id="@+id/combo_connection_error_layout"
@ -528,7 +528,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<TextView
android:layout_width="wrap_content"

View file

@ -14,6 +14,7 @@ dependencies {
api "androidx.browser:browser:1.3.0"
api "androidx.activity:activity-ktx:${activity_version}"
api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
api "androidx.lifecycle:lifecycle-process:$lifecycle_version"
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.recyclerview:recyclerview:1.2.1'
api 'androidx.gridlayout:gridlayout:1.0.0'

View file

@ -276,4 +276,9 @@ interface Pump {
* if true APS set 100% basal before full hour to avoid pump beeping
*/
fun setNeutralTempAtFullHour(): Boolean = false
}
/**
* Pumps with a hardware link can set via config "Battery Change Logging"
*/
fun isBatteryChangeLoggingEnabled(): Boolean = false
}

View file

@ -39,6 +39,7 @@ class PumpDescription() {
var needsManualTDDLoad = false
var hasCustomUnreachableAlertCheck = false
var isPatchPump = false
var useHardwareLink = false
fun resetSettings() {
isBolusCapable = true
@ -68,6 +69,7 @@ class PumpDescription() {
supportsTDDs = false
needsManualTDDLoad = true
hasCustomUnreachableAlertCheck = false
useHardwareLink = false
}
fun fillFor(pumpType: PumpType) {
@ -105,6 +107,7 @@ class PumpDescription() {
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min)
hasCustomUnreachableAlertCheck = pumpType.hasCustomUnreachableAlertCheck
isPatchPump = pumpType.isPatchPump
useHardwareLink = pumpType.useHardwareLink
}
companion object {

View file

@ -52,7 +52,8 @@ enum class PumpType {
baseBasalStep = 0.01,
baseBasalSpecialSteps = DoseStepSize.ComboBasal,
pumpCapability = PumpCapability.ComboCapabilities,
source = Sources.Combo),
source = Sources.Combo,
supportBatteryLevel = false),
ACCU_CHEK_SPIRIT(description = "Accu-Chek Spirit",
manufacturer = ManufacturerType.Roche,
model = "Spirit",
@ -185,6 +186,8 @@ enum class PumpType {
pumpCapability = PumpCapability.OmnipodCapabilities,
hasCustomUnreachableAlertCheck = true,
isPatchPump = true,
useHardwareLink = true,
supportBatteryLevel = false,
source = Sources.OmnipodEros),
OMNIPOD_DASH(description = "Omnipod Dash",
manufacturer = ManufacturerType.Insulet,
@ -201,7 +204,8 @@ enum class PumpType {
baseBasalSpecialSteps = null,
isPatchPump = true,
pumpCapability = PumpCapability.OmnipodCapabilities,
hasCustomUnreachableAlertCheck = false),
hasCustomUnreachableAlertCheck = false,
supportBatteryLevel = false),
MEDTRONIC_512_712(description = "Medtronic 512/712",
manufacturer = ManufacturerType.Medtronic,
model = "512/712",
@ -313,7 +317,8 @@ enum class PumpType {
baseBasalStep = 0.01,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.DanaWithHistoryCapabilities,
source = Sources.DiaconnG8);
source = Sources.DiaconnG8,
useHardwareLink = true);
val description: String
var manufacturer: ManufacturerType? = null
@ -356,6 +361,10 @@ enum class PumpType {
private set
var isPatchPump = false
private set
var supportBatteryLevel = true
private set
var useHardwareLink = false
private set
private var parent: PumpType? = null
val source: Sources
@ -424,6 +433,8 @@ enum class PumpType {
pumpCapability: PumpCapability,
hasCustomUnreachableAlertCheck: Boolean = false,
isPatchPump: Boolean = false,
supportBatteryLevel: Boolean = true,
useHardwareLink: Boolean = false,
source: Sources = Sources.VirtualPump) {
this.description = description
this.manufacturer = manufacturer
@ -441,6 +452,8 @@ enum class PumpType {
this.pumpCapability = pumpCapability
this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck
this.isPatchPump = isPatchPump
this.supportBatteryLevel = supportBatteryLevel
this.useHardwareLink = useHardwareLink
this.source = source
}
@ -518,4 +531,4 @@ enum class PumpType {
USER -> InterfaceIDs.PumpType.USER
DIACONN_G8 -> InterfaceIDs.PumpType.DIACONN_G8
}
}
}

View file

@ -2,16 +2,22 @@ package info.nightscout.androidaps.utils.protection
import androidx.fragment.app.FragmentActivity
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.shared.sharedPreferences.SP
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class ProtectionCheck @Inject constructor(
val sp: SP,
val passwordCheck: PasswordCheck
val passwordCheck: PasswordCheck,
val dateUtil: DateUtil
) {
private var lastAuthorization = mutableListOf(0L, 0L, 0L)
private val timeout = TimeUnit.SECONDS.toMillis(sp.getInt(R.string.key_protection_timeout, 0).toLong())
enum class Protection {
PREFERENCES,
APPLICATION,
@ -52,6 +58,9 @@ class ProtectionCheck @Inject constructor(
R.string.bolus_pin)
fun isLocked(protection: Protection): Boolean {
if (activeSession(protection)) {
return false
}
return when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) {
ProtectionType.NONE -> false
ProtectionType.BIOMETRIC -> true
@ -61,19 +70,38 @@ class ProtectionCheck @Inject constructor(
}
}
fun queryProtection(activity: FragmentActivity, protection: Protection,
ok: Runnable?, cancel: Runnable? = null, fail: Runnable? = null) {
fun resetAuthorization() {
lastAuthorization = mutableListOf(0L, 0L, 0L)
}
private fun activeSession(protection: Protection): Boolean {
val last = lastAuthorization[protection.ordinal]
val diff = dateUtil.now() - last
return diff < timeout
}
private fun onOk(protection: Protection) {
lastAuthorization[protection.ordinal] = dateUtil.now()
}
fun queryProtection(activity: FragmentActivity, protection: Protection, ok: Runnable?, cancel: Runnable? = null, fail: Runnable? = null) {
if (activeSession(protection)) {
onOk(protection)
ok?.run()
return
}
when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) {
ProtectionType.NONE ->
ok?.run()
ProtectionType.BIOMETRIC ->
BiometricCheck.biometricPrompt(activity, titlePassResourceIDs[protection.ordinal], ok, cancel, fail, passwordCheck)
BiometricCheck.biometricPrompt(activity, titlePassResourceIDs[protection.ordinal], { onOk(protection); ok?.run() }, cancel, fail, passwordCheck)
ProtectionType.MASTER_PASSWORD ->
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { onOk(protection); ok?.run() }, { cancel?.run() }, { fail?.run() })
ProtectionType.CUSTOM_PASSWORD ->
passwordCheck.queryPassword(activity, titlePassResourceIDs[protection.ordinal], passwordsResourceIDs[protection.ordinal], { ok?.run() }, { cancel?.run() }, { fail?.run() })
passwordCheck.queryPassword(activity, titlePassResourceIDs[protection.ordinal], passwordsResourceIDs[protection.ordinal], { onOk(protection); ok?.run() }, { cancel?.run() }, { fail?.run() })
ProtectionType.CUSTOM_PIN ->
passwordCheck.queryPassword(activity, titlePinResourceIDs[protection.ordinal], pinsResourceIDs[protection.ordinal], { ok?.run() }, { cancel?.run() }, { fail?.run() }, true)
passwordCheck.queryPassword(activity, titlePinResourceIDs[protection.ordinal], pinsResourceIDs[protection.ordinal], { onOk(protection); ok?.run() }, { cancel?.run() }, { fail?.run() }, true)
}
}
}

View file

@ -118,7 +118,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -164,7 +164,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -210,7 +210,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -262,7 +262,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -314,7 +314,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -402,7 +402,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"

View file

@ -163,7 +163,7 @@
android:layout_marginTop="7dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="3dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -12,6 +12,8 @@
<string name="application_pin">Application PIN</string>
<string name="bolus_password">Bolus password</string>
<string name="bolus_pin">Bolus PIN</string>
<string name="protection_timeout_title">Password and PIN retention [s]</string>
<string name="protection_timeout_summary">Time before the password or PIN should be entered</string>
<string name="unlock_settings">Unlock settings</string>
<string name="biometric">Biometric</string>
<string name="custom_password">Custom password</string>
@ -43,4 +45,5 @@
<string name="key_settings_protection" translatable="false">settings_protection</string>
<string name="key_application_protection" translatable="false">application_protection</string>
<string name="key_bolus_protection" translatable="false">bolus_protection</string>
<string name="key_protection_timeout" translatable="false">protection_timeout</string>
</resources>

View file

@ -28,6 +28,8 @@
<item name="notificationLow">@color/notificationLow</item>
<item name="notificationInfo">@color/notificationInfo</item>
<item name="notificationAnnouncement">@color/notificationAnnouncement</item>
<item name="actionModeCloseDrawable">@drawable/ic_close</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.MaterialComponents.NoActionBar">

View file

@ -65,7 +65,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:id="@+id/bt_connection_layout"
@ -117,7 +117,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -167,7 +167,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -216,7 +216,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -265,7 +265,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -314,7 +314,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -363,7 +363,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -412,7 +412,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -461,7 +461,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -510,7 +510,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -559,7 +559,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -608,7 +608,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<ImageView
android:id="@+id/dana_icon"

View file

@ -103,7 +103,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</LinearLayout>

View file

@ -67,7 +67,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<Switch
android:id="@+id/buttonscroll"
@ -86,7 +86,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<Switch
android:id="@+id/beep"
@ -105,7 +105,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -158,7 +158,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -193,7 +193,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -230,7 +230,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<Switch
android:id="@+id/units"
@ -251,7 +251,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -286,7 +286,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"

View file

@ -542,7 +542,7 @@ class DiaconnG8Plugin @Inject constructor(
override fun executeCustomAction(customActionType: CustomActionType) {}
override fun canHandleDST(): Boolean = false
fun isBatteryChangeLoggingEnabled():Boolean {
override fun isBatteryChangeLoggingEnabled():Boolean {
return sp.getBoolean(R.string.key_diaconn_g8_logbatterychange, false)
}

View file

@ -84,7 +84,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -142,7 +142,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -190,7 +190,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -237,7 +237,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -284,7 +284,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -331,7 +331,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -378,7 +378,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -425,7 +425,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -472,7 +472,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -519,7 +519,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -566,7 +566,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -613,7 +613,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -660,7 +660,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<TextView
android:layout_width="150dp"

View file

@ -73,7 +73,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -141,7 +141,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -223,7 +223,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -304,7 +304,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout

View file

@ -4,4 +4,4 @@
android:layout_height="2dip"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />

View file

@ -46,7 +46,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -99,7 +99,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:id="@+id/rl_battery_layout"
@ -154,7 +154,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -213,7 +213,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -263,7 +263,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -312,7 +312,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -362,7 +362,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -411,7 +411,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -460,7 +460,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
@ -511,7 +511,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -560,7 +560,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<TextView
android:layout_width="wrap_content"

View file

@ -304,7 +304,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -353,7 +353,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -402,7 +402,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -451,7 +451,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -500,7 +500,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -549,7 +549,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -598,7 +598,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -647,7 +647,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
android:layout_width="match_parent"
@ -696,7 +696,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<TextView
android:layout_width="wrap_content"

View file

@ -22,7 +22,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<include layout="@layout/omnipod_dash_overview_bluetooth_status" />

View file

@ -167,5 +167,5 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</merge>

View file

@ -1083,7 +1083,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
return aapsOmnipodErosManager.isShowRileyLinkBatteryLevel();
}
public boolean isBatteryChangeLoggingEnabled() {
@Override public boolean isBatteryChangeLoggingEnabled() {
return aapsOmnipodErosManager.isBatteryChangeLoggingEnabled();
}

View file

@ -22,7 +22,7 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
<include layout="@layout/omnipod_eros_overview_riley_link_status" />

View file

@ -50,5 +50,5 @@
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="5dp"
android:background="@color/list_delimiter" />
android:background="?android:attr/dividerHorizontal" />
</merge>