Merge branch 'dev' into bug1087_tbr_hist

This commit is contained in:
Andy Rozman 2022-01-10 22:49:19 +00:00
commit 54785d3041
92 changed files with 632 additions and 415 deletions

View file

@ -109,7 +109,7 @@ android {
defaultConfig {
multiDexEnabled true
versionCode 1500
version "2.8.2.18-dev"
version "2.8.2.19-dev"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'

View file

@ -15,7 +15,7 @@ import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.androidaps.database.transactions.VersionChangeTransaction
import info.nightscout.androidaps.db.CompatDBHelper
import info.nightscout.androidaps.dependencyInjection.DaggerAppComponent
import info.nightscout.androidaps.di.DaggerAppComponent
import info.nightscout.androidaps.di.StaticInjector
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.interfaces.ConfigBuilder

View file

@ -1,14 +1,12 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback
import info.nightscout.androidaps.plugins.aps.loop.APSResult
import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalAdapterAMAJS
import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalResultAMA
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.BindsInstance
import dagger.Component
@ -12,7 +12,6 @@ import info.nightscout.androidaps.dana.di.DanaModule
import info.nightscout.androidaps.danar.di.DanaRModule
import info.nightscout.androidaps.danars.di.DanaRSModule
import info.nightscout.androidaps.database.DatabaseModule
import info.nightscout.androidaps.di.CoreModule
import info.nightscout.androidaps.diaconn.di.DiaconnG8Module
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
import info.nightscout.androidaps.insight.di.InsightModule

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import android.content.Context
import dagger.Binds

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,10 +1,8 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.GlucoseValueDataPoint
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.TherapyEventDataPoint
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
@Module

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Binds
import dagger.Module
@ -52,6 +52,7 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAverage
import info.nightscout.androidaps.plugins.source.*
import javax.inject.Qualifier
@Suppress("unused")
@Module
abstract class PluginsModule {
@ -160,20 +161,20 @@ abstract class PluginsModule {
@Binds
@PumpDriver
@IntoMap
@IntKey(150)
abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
@IntKey(145)
abstract fun bindOmnipodErosPumpPlugin(plugin: OmnipodErosPumpPlugin): PluginBase
@Binds
@PumpDriver
@IntoMap
@IntKey(156)
@IntKey(148)
abstract fun bindOmnipodDashPumpPlugin(plugin: OmnipodDashPumpPlugin): PluginBase
@Binds
@PumpDriver
@IntoMap
@IntKey(135)
abstract fun bindOmnipodErosPumpPlugin(plugin: OmnipodErosPumpPlugin): PluginBase
@IntKey(150)
abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
@Binds
@PumpDriver

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.multibindings.IntKey

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.dependencyInjection
package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -348,7 +348,7 @@ class CarbsDialog : DialogFragmentWithDate() {
})
}
if (useAlarm && carbs > 0 && timeOffset > 0) {
carbTimer.scheduleReminder(T.mins(timeOffset.toLong()).secs())
carbTimer.scheduleReminder(T.mins(timeOffset.toLong()).secs().toInt())
}
}, null)
}

View file

@ -64,6 +64,8 @@ class WizardDialog : DaggerDialogFragment() {
private var calculatedPercentage = 100.0
private var calculatedCorrection = 0.0
private var correctionPercent = false
private var carbsPassedIntoWizard = 0.0
private var notesPassedIntoWizard = ""
//one shot guards
private var okClicked: Boolean = false
@ -110,6 +112,11 @@ class WizardDialog : DaggerDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View {
this.arguments?.let { bundle ->
carbsPassedIntoWizard = bundle.getInt("carbs_input").toDouble()
notesPassedIntoWizard = bundle.getString("notes_input").toString()
}
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
isCancelable = true
@ -177,8 +184,7 @@ class WizardDialog : DaggerDialogFragment() {
binding.bgCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.ttCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.cobCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.basalIobCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.bolusIobCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.iobCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.bgTrendCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
binding.sbCheckbox.setOnCheckedChangeListener(::onCheckedChanged)
@ -191,9 +197,12 @@ class WizardDialog : DaggerDialogFragment() {
sp.putBoolean(rh.gs(R.string.key_wizard_calculation_visible), isChecked)
binding.delimiter.visibility = isChecked.toVisibility()
binding.result.visibility = isChecked.toVisibility()
processEnabledIcons()
}
}
processEnabledIcons()
binding.correctionPercent.setOnCheckedChangeListener {_, isChecked ->
run {
sp.putBoolean(rh.gs(R.string.key_wizard_correction_percent), isChecked)
@ -241,21 +250,30 @@ class WizardDialog : DaggerDialogFragment() {
binding.ttCheckbox.isEnabled = binding.bgCheckbox.isChecked && repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing
if (buttonView.id == binding.cobCheckbox.id)
processCobCheckBox()
processEnabledIcons()
calculateInsulin()
}
private fun processCobCheckBox() {
if (binding.cobCheckbox.isChecked) {
binding.bolusIobCheckbox.isEnabled = false
binding.basalIobCheckbox.isEnabled = false
binding.bolusIobCheckbox.isChecked = true
binding.basalIobCheckbox.isChecked = true
binding.iobCheckbox.isEnabled = false
binding.iobCheckbox.isChecked = true
} else {
binding.bolusIobCheckbox.isEnabled = true
binding.basalIobCheckbox.isEnabled = true
binding.iobCheckbox.isEnabled = true
}
}
private fun processEnabledIcons() {
binding.bgEnabledIcon.alpha = if (binding.bgCheckbox.isChecked) 1.0f else 0.2f
binding.trendEnabledIcon.alpha = if (binding.bgTrendCheckbox.isChecked) 1.0f else 0.2f
binding.iobEnabledIcon.alpha = if (binding.iobCheckbox.isChecked) 1.0f else 0.2f
binding.cobEnabledIcon.alpha = if (binding.cobCheckbox.isChecked) 1.0f else 0.2f
binding.bgEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
binding.trendEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
binding.iobEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
binding.cobEnabledIcon.visibility = binding.calculationCheckbox.isChecked.not().toVisibility()
}
private fun saveCheckedStates() {
sp.putBoolean(R.string.key_wizard_include_cob, binding.cobCheckbox.isChecked)
sp.putBoolean(R.string.key_wizard_include_trend_bg, binding.bgTrendCheckbox.isChecked)
@ -274,6 +292,12 @@ class WizardDialog : DaggerDialogFragment() {
else DecimalFormatter.to1Decimal(value * Constants.MGDL_TO_MMOLL)
private fun initDialog() {
if(carbsPassedIntoWizard != 0.0) {
binding.carbsInput.value = carbsPassedIntoWizard
}
if(notesPassedIntoWizard.isNotBlank()) {
binding.notes.setText(notesPassedIntoWizard)
}
val profile = profileFunction.getProfile()
val profileStore = activePlugin.activeProfileSource.profile
@ -302,8 +326,7 @@ class WizardDialog : DaggerDialogFragment() {
val bolusIob = iobCobCalculator.calculateIobFromBolus().round()
val basalIob = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round()
binding.bolusIobInsulin.text = rh.gs(R.string.formatinsulinunits, -bolusIob.iob)
binding.basalIobInsulin.text = rh.gs(R.string.formatinsulinunits, -basalIob.basaliob)
binding.iobInsulin.text = rh.gs(R.string.formatinsulinunits, -bolusIob.iob - basalIob.basaliob)
calculateInsulin()
@ -365,8 +388,8 @@ class WizardDialog : DaggerDialogFragment() {
wizard = BolusWizard(injector).doCalc(specificProfile, profileName, tempTarget, carbsAfterConstraint, cob, bg, correction, sp.getInt(R.string.key_boluswizard_percentage, 100),
binding.bgCheckbox.isChecked,
binding.cobCheckbox.isChecked,
binding.bolusIobCheckbox.isChecked,
binding.basalIobCheckbox.isChecked,
binding.iobCheckbox.isChecked,
binding.iobCheckbox.isChecked,
binding.sbCheckbox.isChecked,
binding.ttCheckbox.isChecked,
binding.bgTrendCheckbox.isChecked,
@ -384,8 +407,7 @@ class WizardDialog : DaggerDialogFragment() {
binding.carbs.text = String.format(rh.gs(R.string.format_carbs_ic), carbs.toDouble(), wizard.ic)
binding.carbsInsulin.text = rh.gs(R.string.formatinsulinunits, wizard.insulinFromCarbs)
binding.bolusIobInsulin.text = rh.gs(R.string.formatinsulinunits, wizard.insulinFromBolusIOB)
binding.basalIobInsulin.text = rh.gs(R.string.formatinsulinunits, wizard.insulinFromBasalIOB)
binding.iobInsulin.text = rh.gs(R.string.formatinsulinunits, wizard.insulinFromBolusIOB + wizard.insulinFromBasalIOB)
binding.correctionInsulin.text = rh.gs(R.string.formatinsulinunits, wizard.insulinFromCorrection)

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.InvalidateFoodTransaction
import info.nightscout.androidaps.databinding.FoodFragmentBinding
import info.nightscout.androidaps.databinding.FoodItemBinding
import info.nightscout.androidaps.dialogs.WizardDialog
import info.nightscout.androidaps.events.EventFoodDatabaseChanged
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
@ -31,8 +32,10 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.ui.UIRunnable
import io.reactivex.Completable
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.plusAssign
@ -51,6 +54,7 @@ class FoodFragment : DaggerFragment() {
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var repository: AppRepository
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var protectionCheck: ProtectionCheck
private val disposable = CompositeDisposable()
private var unfiltered: List<Food> = arrayListOf()
@ -229,7 +233,6 @@ class FoodFragment : DaggerFragment() {
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: FoodsViewHolder, position: Int) {
val food = foodList[position]
holder.binding.nsSign.visibility = (food.interfaceIDs.nightscoutId != null).toVisibility()
holder.binding.name.text = food.name
holder.binding.portion.text = food.portion.toString() + food.unit
holder.binding.carbs.text = food.carbs.toString() + rh.gs(R.string.shortgramm)
@ -239,7 +242,9 @@ class FoodFragment : DaggerFragment() {
holder.binding.protein.visibility = food.protein.isNotZero().toVisibility()
holder.binding.energy.text = rh.gs(R.string.shortenergy) + ": " + food.energy + rh.gs(R.string.shortkilojoul)
holder.binding.energy.visibility = food.energy.isNotZero().toVisibility()
holder.binding.remove.tag = food
holder.binding.icRemove.tag = food
holder.binding.foodItem.tag = food
holder.binding.icCalculator.tag = food
}
override fun getItemCount(): Int = foodList.size
@ -249,7 +254,7 @@ class FoodFragment : DaggerFragment() {
val binding = FoodItemBinding.bind(itemView)
init {
binding.remove.setOnClickListener { v: View ->
binding.icRemove.setOnClickListener { v: View ->
val food = v.tag as Food
activity?.let { activity ->
OKDialog.showConfirmation(activity, rh.gs(R.string.removerecord) + "\n" + food.name, {
@ -262,7 +267,21 @@ class FoodFragment : DaggerFragment() {
}, null)
}
}
binding.remove.paintFlags = binding.remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG
binding.icCalculator.setOnClickListener { v:View ->
val food = v.tag as Food
activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
if (isAdded) {
val wizardDialog = WizardDialog()
val bundle = Bundle()
bundle.putInt("carbs_input", food.carbs)
bundle.putString("notes_input", " ${food.name} - ${food.carbs}g")
wizardDialog.setArguments(bundle)
wizardDialog.show(childFragmentManager, "Food Item")
}
})
}
}
}
}
}

View file

@ -29,19 +29,19 @@ class DataSyncSelectorImplementation @Inject constructor(
) : DataSyncSelector {
class QueueCounter(
var bolusesRemaining: Long = 0L,
var carbsRemaining: Long = 0L,
var bcrRemaining: Long = 0L,
var ttsRemaining: Long = 0L,
var foodsRemaining: Long = 0L,
var gvsRemaining: Long = 0L,
var tesRemaining: Long = 0L,
var dssRemaining: Long = 0L,
var tbrsRemaining: Long = 0L,
var ebsRemaining: Long = 0L,
var pssRemaining: Long = 0L,
var epssRemaining: Long = 0L,
var oesRemaining: Long = 0L
var bolusesRemaining: Long = -1L,
var carbsRemaining: Long = -1L,
var bcrRemaining: Long = -1L,
var ttsRemaining: Long = -1L,
var foodsRemaining: Long = -1L,
var gvsRemaining: Long = -1L,
var tesRemaining: Long = -1L,
var dssRemaining: Long = -1L,
var tbrsRemaining: Long = -1L,
var ebsRemaining: Long = -1L,
var pssRemaining: Long = -1L,
var epssRemaining: Long = -1L,
var oesRemaining: Long = -1L
) {
fun size(): Long =

View file

@ -59,7 +59,8 @@ class NSClientAddUpdateWorker(
for (i in 0 until treatments.length()) {
var json = treatments.getJSONObject(i)
// new DB model
aapsLogger.debug(LTag.DATABASE, "Received NS treatment: $json")
val insulin = JsonHelper.safeGetDouble(json, "insulin")
val carbs = JsonHelper.safeGetDouble(json, "carbs")
var eventType = JsonHelper.safeGetString(json, "eventType")

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.plusAssign
import javax.inject.Inject
class NSClientFragment : DaggerFragment() {
@ -72,8 +73,8 @@ class NSClientFragment : DaggerFragment() {
context?.let { context ->
OKDialog.showConfirmation(context, rh.gs(R.string.nsclientinternal),
rh.gs(R.string.full_sync_comment), Runnable {
dataSyncSelector.resetToNextFullSync()
})
dataSyncSelector.resetToNextFullSync()
})
}
}
binding.fullSync.paintFlags = binding.fullSync.paintFlags or Paint.UNDERLINE_TEXT_FLAG
@ -81,11 +82,10 @@ class NSClientFragment : DaggerFragment() {
@Synchronized override fun onResume() {
super.onResume()
disposable.add(rxBus
disposable += rxBus
.toObservable(EventNSClientUpdateGUI::class.java)
.observeOn(aapsSchedulers.main)
.subscribe({ updateGui() }, fabricPrivacy::logException)
)
updateGui()
}
@ -102,6 +102,7 @@ class NSClientFragment : DaggerFragment() {
if (nsClientPlugin.autoscroll) binding.logScrollview.fullScroll(ScrollView.FOCUS_DOWN)
binding.url.text = nsClientPlugin.url()
binding.status.text = nsClientPlugin.status
binding.queue.text = dataSyncSelector.queueSize().toString()
val size = dataSyncSelector.queueSize()
binding.queue.text = if (size >= 0) size.toString() else rh.gs(R.string.notavailable)
}
}

View file

@ -416,10 +416,10 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
OKDialog.showConfirmation(activity, rh.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
?: "".toSpanned(), {
uel.log(Action.ACCEPTS_TEMP_BASAL, Sources.Overview)
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Constants.notificationID)
rxBus.send(EventWearInitiateAction("cancelChangeRequest"))
Thread { loop.acceptChangeRequest() }.run()
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
})
})
}

View file

@ -257,7 +257,6 @@ class OverviewPlugin @Inject constructor(
overviewBus.send(EventUpdateOverviewTemporaryBasal(from))
overviewBus.send(EventUpdateOverviewExtendedBolus(from))
overviewBus.send(EventUpdateOverviewTemporaryTarget(from))
overviewBus.send(EventUpdateOverviewSensitivity(from))
loadAsData(from)
overviewData.preparePredictions(from)
overviewData.prepareBasalData(from)

View file

@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.queue.commands.*
import info.nightscout.androidaps.queue.commands.Command.CommandType
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.HtmlHelper
@ -64,7 +65,8 @@ class CommandQueueImplementation @Inject constructor(
private val dateUtil: DateUtil,
private val repository: AppRepository,
private val fabricPrivacy: FabricPrivacy,
private val config: Config
private val config: Config,
private val androidPermission: AndroidPermission
) : CommandQueue {
private val disposable = CompositeDisposable()
@ -177,7 +179,7 @@ class CommandQueueImplementation @Inject constructor(
@Synchronized fun notifyAboutNewCommand() {
waitForFinishedThread()
if (thread == null || thread!!.state == Thread.State.TERMINATED) {
thread = QueueThread(this, context, aapsLogger, rxBus, activePlugin, rh, sp)
thread = QueueThread(this, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission, config)
thread!!.start()
aapsLogger.debug(LTag.PUMPQUEUE, "Starting new thread")
} else {
@ -199,7 +201,7 @@ class CommandQueueImplementation @Inject constructor(
val tempCommandQueue = CommandQueueImplementation(
injector, aapsLogger, rxBus, aapsSchedulers, rh,
constraintChecker, profileFunction, activePlugin, context, sp,
buildHelper, dateUtil, repository, fabricPrivacy, config
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission
)
tempCommandQueue.readStatus(reason, callback)
tempCommandQueue.disposable.clear()
@ -233,6 +235,7 @@ class CommandQueueImplementation @Inject constructor(
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
) {
carbsRunnable = Runnable {
aapsLogger.debug(LTag.PUMPQUEUE, "Going to store carbs")
detailedBolusInfo.carbs = originalCarbs
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
.subscribeBy(

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.queue
import android.bluetooth.BluetoothManager
import android.content.Context
import android.os.Build
import android.os.PowerManager
import android.os.SystemClock
import info.nightscout.androidaps.Constants
@ -9,9 +10,11 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.Config
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.androidaps.queue.events.EventQueueChanged
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.shared.logging.AAPSLogger
@ -25,7 +28,9 @@ class QueueThread internal constructor(
private val rxBus: RxBus,
private val activePlugin: ActivePlugin,
private val rh: ResourceHelper,
private val sp: SP
private val sp: SP,
private val androidPermission: AndroidPermission,
private val config: Config
) : Thread() {
private var connectLogged = false
@ -46,6 +51,14 @@ class QueueThread internal constructor(
while (true) {
val secondsElapsed = (System.currentTimeMillis() - connectionStartTime) / 1000
val pump = activePlugin.activePump
// Manifest.permission.BLUETOOTH_CONNECT
if (config.PUMPDRIVERS && Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31)
if (androidPermission.permissionNotGranted(context, "android.permission.BLUETOOTH_CONNECT")) {
aapsLogger.debug(LTag.PUMPQUEUE, "no permission")
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.CONNECTING))
SystemClock.sleep(1000)
continue
}
if (!pump.isConnected() && secondsElapsed > Constants.PUMP_MAX_CONNECTION_TIME_IN_SECONDS) {
rxBus.send(EventDismissBolusProgressIfRunning(null, null))
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.connectiontimedout)))

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps.skins
import info.nightscout.androidaps.R
import info.nightscout.androidaps.dependencyInjection.SkinsModule
import info.nightscout.androidaps.di.SkinsModule
import info.nightscout.shared.sharedPreferences.SP
import okhttp3.internal.toImmutableMap
import javax.inject.Inject

View file

@ -24,7 +24,7 @@ class CarbTimer @Inject constructor(
private val timerUtil: TimerUtil
) {
fun scheduleReminder(seconds: Long, text: String? = null) =
fun scheduleReminder(seconds: Int, text: String? = null) =
timerUtil.scheduleReminder(seconds, text ?: rh.gs(R.string.timetoeat))
fun scheduleEatReminder() {

View file

@ -456,7 +456,7 @@ class BolusWizard @Inject constructor(
}
if (useAlarm && carbs > 0 && carbTime > 0) {
carbTimer.scheduleReminder(T.mins(carbTime.toLong()).secs())
carbTimer.scheduleReminder(T.mins(carbTime.toLong()).secs().toInt())
}
}
})

View file

@ -266,12 +266,55 @@
android:contentDescription="@string/show_calculation"
app:srcCompat="@drawable/ic_visibility" />
<ImageView
android:id="@+id/bg_enabled_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="-11dp"
android:paddingEnd="-11dp"
android:scaleX="0.5"
android:scaleY="0.5"
app:srcCompat="@drawable/ic_xdrip"/>
<ImageView
android:id="@+id/trend_enabled_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="-11dp"
android:paddingEnd="-11dp"
android:scaleX="0.5"
android:scaleY="0.5"
app:srcCompat="@drawable/ic_fortyfiveup" />
<ImageView
android:id="@+id/iob_enabled_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="-11dp"
android:paddingEnd="-11dp"
android:scaleX="0.5"
android:scaleY="0.5"
app:srcCompat="@drawable/ic_bolus" />
<ImageView
android:id="@+id/cob_enabled_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingStart="-11dp"
android:paddingEnd="-11dp"
android:scaleX="0.5"
android:scaleY="0.5"
app:srcCompat="@drawable/ic_cp_bolus_carbs" />
<Button
android:id="@+id/cancel"
style="@style/mdtp_ActionButton.Text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/mdtp_cancel"
android:textAlignment="textEnd" />
@ -281,7 +324,7 @@
style="@style/mdtp_ActionButton.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginEnd="8dp"
android:text="@string/mdtp_ok" />
</LinearLayout>
@ -532,7 +575,7 @@
android:layout_height="match_parent">
<CheckBox
android:id="@+id/bolus_iob_checkbox"
android:id="@+id/iob_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp"
@ -542,7 +585,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="130dp"
android:text="@string/bolus_iob_label"
android:text="@string/iob"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
@ -553,42 +596,7 @@
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/bolus_iob_insulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"
android:gravity="end"
android:textAppearance="?android:attr/textAppearanceSmall" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/basal_iob_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="32dp"
android:checked="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="130dp"
android:text="@string/treatments_wizard_basaliob_label"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:width="50dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/basal_iob_insulin"
android:id="@+id/iob_insulin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50dp"

View file

@ -8,102 +8,130 @@
card_view:cardBackgroundColor="?android:colorBackground">
<LinearLayout
android:id="@+id/food_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/left_right_split"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingLeft="3dp"
android:paddingRight="3dp">
<TextView
android:id="@+id/name"
android:layout_width="0dp"
<LinearLayout
android:id="@+id/name_and_info_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:text="Name"
android:textStyle="bold"
tools:ignore="HardcodedText" />
android:gravity="start">
<TextView
android:id="@+id/portion"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Portion"
tools:ignore="HardcodedText" />
<LinearLayout
android:id="@+id/name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/carbs"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Carbs"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Name"
android:textStyle="bold"
android:textSize="@dimen/twenty_four_dp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/info_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:orientation="horizontal"
android:layout_marginLeft="5dp">
<TextView
android:id="@+id/carbs"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Carbs"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/portion"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Portion"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/fat"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Fat"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/protein"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Protein"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/energy"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Energy"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/buttons_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="end">
<ImageView
android:id="@+id/ic_calculator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:padding="2dp"
android:orientation="horizontal"
android:src="@drawable/ic_calculator" />
<ImageView
android:id="@+id/ic_remove"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:padding="2dp"
android:orientation="horizontal"
android:src="@drawable/ic_trash_outline" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="end"
android:orientation="horizontal">
<TextView
android:id="@+id/fat"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Fat"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/protein"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Protein"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/energy"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="end"
android:text="Energy"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/ns_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="30dp"
android:text="NS"
android:textAlignment="viewEnd"
android:textColor="@color/colorSetTempButton"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="5dp"
android:paddingStart="10dp"
android:text="@string/remove_button"
android:textAlignment="viewEnd"
android:textColor="@android:color/holo_orange_light" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@color/list_delimiter" />

View file

@ -6,7 +6,7 @@
<string name="treatmentssafety_title">Seguridad de tratamientos</string>
<string name="treatmentssafety_maxbolus_title">Máximo bolo permitido [U]</string>
<string name="treatmentssafety_maxcarbs_title">Máximos carbohidratos permitidos [g]</string>
<string name="nav_preferences_plugin">%1$s preferencias</string>
<string name="nav_preferences_plugin">Preferencias de %1$s</string>
<string name="nav_preferences">Preferencias</string>
<string name="nav_refreshtreatments">Actualizar los tratamientos desde Nightscout</string>
<string name="nav_resetdb">Restablecer las bases de datos</string>
@ -27,7 +27,7 @@
<string name="description_smb">Algoritmo más reciente para usuarios avanzados</string>
<string name="description_overview">Muestra el estado actual de tu lazo y los botones para las acciones más usadas</string>
<string name="description_persistent_notification">Muestra una notificación en curso con un breve resumen de lo que está haciendo tu lazo</string>
<string name="description_profile_local">Definir un perfil disponible fuera de linea.</string>
<string name="description_profile_local">Define un perfil que esté disponible cuando tengas una desconexión</string>
<string name="description_pump_mdi">Integración de bomba de insulina para personas que usan múltiples dosis de insulina diarias, en su terapia de diabetes</string>
<string name="description_pump_virtual">Integración de bombas de insulina que aún no tienen ningún controlador disponible (lazo abierto)</string>
<string name="description_sensitivity_aaps">La sensibilidad se calcula de la misma manera que en Oref0, pero puede especificarse el rango de tiempo. La absorción de carbohidratos mínima se calcula con el máximo tiempo de absorción de carbohidratos en preferencias</string>
@ -94,8 +94,8 @@
<string name="loop_tbrsetbypump_label">Basal temporal en la bomba</string>
<string name="noapsselected">NO APS Seleccionado o resultado entregado</string>
<string name="safety">Seguridad</string>
<string name="openapsma_disabled">Complemento desactivado</string>
<string name="constraints_violation">Violación restricciones</string>
<string name="openapsma_disabled">El complemento está deshabilitado</string>
<string name="constraints_violation">Violación de restricciones</string>
<string name="treatmentdeliveryerror">El bolo reportó un error. Comprueba manualmente la cantidad real de insulina entregada</string>
<string name="setbasalquestion">Aceptar nueva basal temporal:</string>
<string name="overview_treatment_label">Tratamiento</string>
@ -115,7 +115,7 @@
<string name="disabledloop">Lazo desactivado</string>
<string name="openloop_newsuggestion">Nueva propuesta disponible</string>
<string name="carbssuggestion">Sugerencia de carbohidratos</string>
<string name="unsupportednsversion">Versión no aceptada de Nightscout</string>
<string name="unsupportednsversion">Versión de Nightscout no soportada</string>
<string name="treatments_wizard_basaliob_label">Basal IOB</string>
<string name="bolusconstraintapplied">Restricción aplicada en bolo</string>
<string name="carbsconstraintapplied">Restricción aplicada en carbohidratos</string>
@ -133,15 +133,15 @@
<string name="exported">Ajustes exportados</string>
<string name="ue_exported">Entradas de usuario exportadas</string>
<string name="export_to">Exportar ajustes a</string>
<string name="import_from">Importar configuración de</string>
<string name="import_from">Importar ajustes desde</string>
<string name="setting_imported">Ajustes importados</string>
<string name="filenotfound">Archivo no encontrado</string>
<string name="nav_export">Exportar ajustes</string>
<string name="nav_import">Importar ajustes</string>
<string name="openapsma_maxbasal_title">Max U/h para la basal temporal</string>
<string name="openapsma_maxbasal_summary">Este valor es llamado max basal en OpenAPS</string>
<string name="openapsma_maxiob_title">Max IOB basal que OpenAPs puede emitir [U]</string>
<string name="openapsma_maxiob_summary">Este valor es llamado \"Max IOB\" en OpenAPS\nEsta es la cantidad máxima de insulina en [U] que APS puede entregar a la vez.</string>
<string name="openapsma_maxbasal_title">Máximas U/h que la basal temporal no podrá superar</string>
<string name="openapsma_maxbasal_summary">Este valor se llama \"Max basal\" en el contexto de OpenAPS</string>
<string name="openapsma_maxiob_title">Basal máxima que OpenAPS puede entregar [U]</string>
<string name="openapsma_maxiob_summary">Este valor se denomina \"Max IOB\" en OpenAPS\nEsta es la cantidad máxima de insulina en [U] que APS puede entregar a la vez.</string>
<string name="password_preferences_encrypt_prompt">Se le solicitará la contraseña maestra, que se utilizará para cifrar los ajustes exportados</string>
<string name="password_preferences_decrypt_prompt">Se le solicitará la contraseña maestra, que es necesaria para descifrar las preferencias importadas.</string>
<string name="preferences_export_canceled">¡Exportación cancelada! ¡Las preferencias NO se han exportado!</string>
@ -174,20 +174,20 @@
<string name="smscommunicator_stoppedsms">Servicio remoto de SMS detenido. Para reactivarlo, utilice AAPS en el movil maestro.</string>
<string name="smscommunicator_calibrationreplywithcode">Para enviar calibración %1$.2f responder con código %2$s</string>
<string name="smscommunicator_bolusfailed">Bolo fallido</string>
<string name="smscommunicator_remotebolusmindistance_summary">Número mínimo de minutos que deben transcursar entre un bolus remoto y el siguiente</string>
<string name="smscommunicator_remotebolusmindistance_summary">Número mínimo de minutos que deben transcurrir entre un bolo remoto y el siguiente</string>
<string name="smscommunicator_remotebolusmindistance">Cuántos minutos deben transcurrir, al menos, entre un bolo y el siguiente</string>
<string name="smscommunicator_remotebolusmindistance_caveat">Por su seguridad, para editar esta preferencia es necesario añadir al menos 2 números de teléfono.</string>
<string name="bolusrequested">Entregando %1$.2f U</string>
<string name="smscommunicator_bolusdelivered">Bolo %1$.2fU enviado correctamente</string>
<string name="smscommunicator_mealbolusdelivered">Bolo de comida %1$.2f U entregado con éxito</string>
<string name="smscommunicator_bolusdelivered">Bolo %1$.2fU entregado correctamente</string>
<string name="smscommunicator_mealbolusdelivered">Bolo de comida %1$.2f U entregado correctamente</string>
<string name="smscommunicator_mealbolusdelivered_tt">Objetivo %1$s para %2$d minutos</string>
<string name="smscommunicator_tt_set">Objetivo %1$s para %2$d minutos establecido correctamente</string>
<string name="smscommunicator_tt_canceled">Objetivo temporal cancelado con éxito</string>
<string name="smscommunicator_tt_canceled">Objetivo temporal cancelado correctamente</string>
<string name="smscommunicator_remotecommandsallowed">Permitir comandos remotos vía SMS</string>
<string name="smscommunicator_loophasbeendisabled">Lazo se ha desactivado</string>
<string name="smscommunicator_loophasbeenenabled">Lazo se ha activado</string>
<string name="smscommunicator_loophasbeendisabled">El lazo se ha desactivado</string>
<string name="smscommunicator_loophasbeenenabled">El lazo se ha activado</string>
<string name="smscommunicator_loopisenabled">Lazo activo</string>
<string name="smscommunicator_pumpconnectwithcode">Para conectar la infusora responder con el código %1$s</string>
<string name="smscommunicator_pumpconnectwithcode">Para conectar la bomba, responder con el código %1$s</string>
<string name="smscommunicator_pumpconnectfail">Error al conectar a la bomba</string>
<string name="smscommunicator_pumpdisconnectwithcode">Para desconectar la bomba durante %1$dminutos, responde con el código %2$s</string>
<string name="smscommunicator_pumpdisconnected">Bomba desconectada</string>
@ -197,34 +197,34 @@
<string name="smscommunicator_basalreplywithcode">Para iniciar una basal de %1$.2fU/h durante %2$d min, responder con el código %3$s</string>
<string name="smscommunicator_profilereplywithcode">Para cambiar el perfil a %1$s %2$d%% responder con el código %3$s</string>
<string name="smscommunicator_extendedreplywithcode">Para iniciar un bolo extendido de %1$.2fU durante %2$d minutos, responder con el código %3$s</string>
<string name="smscommunicator_carbsreplywithcode">Para introducir %1$dg en %2$s responder con código %3$s</string>
<string name="smscommunicator_carbsreplywithcode">Para introducir %1$dg en %2$s, responder con el código %3$s</string>
<string name="smscommunicator_basalpctreplywithcode">Para iniciar una basal de %1$d%% durante %2$d min, responder con el código %3$s</string>
<string name="smscommunicator_suspendreplywithcode">Para cancelar lazo por %1$d minutos responde con código %2$s</string>
<string name="smscommunicator_loopresumereplywithcode">Para reanudar el lazo, responder con código %1$s</string>
<string name="smscommunicator_loopenablereplywithcode">Para activar el lazo, responder con código %1$s</string>
<string name="smscommunicator_loopdisablereplywithcode">Para desactivar el lazo, responder con código %1$s</string>
<string name="smscommunicator_tempbasalset">Basal temporal %1$.2fU/h para %2$d min iniciada correctamente</string>
<string name="smscommunicator_extendedset">Bolo ampliado de %1$.2fU durante %2$d min se inició correctamente</string>
<string name="smscommunicator_carbsset">Carbohidratos %1$d g ingresados correctamente</string>
<string name="smscommunicator_suspendreplywithcode">Para suspender el lazo durante %1$d minutos, responde con el código %2$s</string>
<string name="smscommunicator_loopresumereplywithcode">Para reanudar el lazo, responde con el código %1$s</string>
<string name="smscommunicator_loopenablereplywithcode">Para activar el lazo, responder con el código %1$s</string>
<string name="smscommunicator_loopdisablereplywithcode">Para desactivar el lazo, responder con el código %1$s</string>
<string name="smscommunicator_tempbasalset">Basal temporal %1$.2fU/h durante %2$d minutos iniciada correctamente</string>
<string name="smscommunicator_extendedset">Bolo extendido de %1$.2fU durante %2$d minutos se inició correctamente</string>
<string name="smscommunicator_carbsset">Carbohidratos %1$d g ingresados correctamente</string>
<string name="smscommunicator_carbsfailed">Error al introducir %1$dg de carbohidratos</string>
<string name="smscommunicator_tempbasalset_percent">Basal temporal de %1$d%% durante %2$d min iniciada correctamente</string>
<string name="smscommunicator_tempbasalfailed">Fallo inicio basal temporal</string>
<string name="smscommunicator_tempbasalset_percent">Basal temporal de %1$d%% durante %2$d minutos iniciada correctamente</string>
<string name="smscommunicator_tempbasalfailed">Error al iniciar la basal temporal</string>
<string name="smscommunicator_extendedfailed">Error al iniciar el bolo extendido</string>
<string name="smscommunicator_basalstopreplywithcode">Para cancelar la basal temporal, responder con el código %1$s</string>
<string name="smscommunicator_extendedstopreplywithcode">Para parar el bolo extendido, responder con el código %1$s</string>
<string name="smscommunicator_tempbasalcanceled">Basal temporal cancelada</string>
<string name="smscommunicator_extendedcanceled">Bolo extendido cancelado</string>
<string name="smscommunicator_tempbasalcancelfailed">Fallo cancelación basal temporal</string>
<string name="smscommunicator_tempbasalcancelfailed">Error al cancelar la basal temporal</string>
<string name="smscommunicator_extendedcancelfailed">Error al cancelar el bolo extendido</string>
<string name="smscommunicator_unknowncommand">Comando desconocido o respuesta incorrecta</string>
<string name="quickwizard">Asistente</string>
<string name="quickwizardsettings">Asistente configuración</string>
<string name="quickwizardsettings">Asistente de configuración</string>
<string name="overview_editquickwizard_buttontext">Botón Texto:</string>
<string name="overview_editquickwizard_carbs">Carbohidratos:</string>
<string name="overview_editquickwizard_valid">Validar:</string>
<string name="overview_editquickwizardlistactivity_add">Añadir</string>
<string name="overview_quickwizard_item_edit_button">Editar</string>
<string name="mealbolus">Bolo Comida</string>
<string name="mealbolus">Comida</string>
<string name="correctionbous">Corrección</string>
<string name="actions">Acciones</string>
<string name="ns_upload_only">(PELIGROSO DESHABILITAR) Sólo subida a Nightscout</string>
@ -252,7 +252,7 @@
<string name="sms_lastbg">Última Glucosa:</string>
<string name="mdi">Múltiples dosis de insulina (MDI)</string>
<string name="MM640g">MM640g</string>
<string name="ongoingnotificaction">Avisos permanentes</string>
<string name="ongoingnotificaction">Notificaciones en curso</string>
<string name="old_data">DATOS CADUCADOS</string>
<string name="sms_minago">hace %1$d min</string>
<string name="localprofile">Perfil</string>
@ -274,11 +274,11 @@
<string name="objectives_shortname">OBJ</string>
<string name="wear_shortname">RELOJ</string>
<string name="smscommunicator_shortname">SMS</string>
<string name="short_tabtitles">Título corto en pestaña</string>
<string name="short_tabtitles">Nombres cortos en pestañas</string>
<string name="always_use_shortavg">Usar siempre el delta medio corto, en lugar del delta simple</string>
<string name="always_use_shortavg_summary">Útil cuando los datos de fuentes sin filtrar como los de xDrip+ son inestables</string>
<string name="profile">Perfiles</string>
<string name="openapsama_max_daily_safety_multiplier_summary">Valor predeterminado: 3. Este valor es una protección de seguridad clave de OpenAPS. Limita la basal máxima que puede usar AAPS a un máximo de tres veces tu basal. Probablemente nunca necesites modificar este valor. Antes de modificarlo deberías tener en cuenta las discusiones sobre \"3x máx diaria; 4x actual\" por motivos de segurida</string>
<string name="openapsama_max_daily_safety_multiplier_summary">Valor predeterminado: 3. Este valor es una protección de seguridad clave de OpenAPS. Limita la basal máxima que puede usar AAPS a un máximo de tres veces tu basal. Probablemente nunca necesites modificar este valor. Antes de modificarlo deberías tener en cuenta las discusiones sobre \"3x máx diaria; 4x actual\" por motivos de seguridad</string>
<string name="openapsama_current_basal_safety_multiplier_summary">Valor predeterminado: 4. Esta es la otra mitad de los ajustes de seguridad de OpenAPS y de \"3x máx diaria, 4x actual\". Esto significa que tu basal, independientemente del valor de basal máxima que tengas configurado en la bomba, nunca podrá superar este valor multiplicado por tu basal actual. Esto se usa para evitar que las personas se encuentren en situaciones peligrosas por aumentar excesivamente la basal, sin entender como funciona el algoritmo. La mayoría de las personas nunca tendrán que cambiar estos valores. Si estás cerca de alcanzar éstos límites, deberías de ajustar otras configuraciones</string>
<string name="openapsama_autosens_max_summary">Valor predeterminado: 1.2\nEste parámetro establece un límite de seguridad máximo por defecto del 20% en autosens (y pronto en Autotune), que limita los valores máximos que puede: aumentar las basales, disminuir el factor de sensibilidad (ISF) y disminuir el objetivo de glucosa</string>
<string name="openapsama_autosens_min_summary">Valor predeterminado: 0.7\nEste parámetro establece un límite de seguridad mínimo por defecto del 30% en autosens, que limita los valores que puede: disminuir las basales, aumentar el factor de sensibilidad (ISF) y aumentar el objetivo de glucosa</string>
@ -516,8 +516,8 @@
<string name="enablesmbwithcob">Habilitar SMB con COB</string>
<string name="enablesmbwithcob_summary">Habilitar SMB cuando hay carbohidratos activos (COB)</string>
<string name="enablesmbwithtemptarget">Habilitar SMB con Objetivos Temporales</string>
<string name="enablesmbwithtemptarget_summary">Habilitar SMB cuando hay un Objetivo Temporal (TT) activo (ComiendoPronto, Actividad)</string>
<string name="enablesmbwithhightemptarget">Habilitar SMB con Objetivo Temporal Alto</string>
<string name="enablesmbwithtemptarget_summary">Habilitar SMB cuando hay un Objetivo Temporal (OT) activo (ComiendoPronto, Actividad, etc.)</string>
<string name="enablesmbwithhightemptarget">Habilitar SMB con Objetivos Temporales altos</string>
<string name="enablesmbwithhightemptarget_summary">Habilitar SMB cuando hay activo un objetivo temporal alto (ejercicio superior a 100 mg/dl o 5.5 mmol/l)</string>
<string name="overview_insulin_label">Insulina</string>
<string name="overview_buttons_selection">Botones</string>
@ -571,15 +571,15 @@
<string name="smbdisabledinpreferences">SMB deshabilitado en preferencias</string>
<string name="uamdisabledinpreferences">UAM deshabilitado en las preferencias</string>
<string name="uamdisabledoref1notselected">UAM deshabilitado al usar el plugin de sensibilidad Oref1</string>
<string name="maxbasalmultiplier">Multiplicador basal máximo</string>
<string name="maxdailybasalmultiplier">Multiplicador diario basal máximo</string>
<string name="maxbasalmultiplier">multiplicador basal máximo</string>
<string name="maxdailybasalmultiplier">multiplicador basal diario máximo</string>
<string name="smb_frequency_exceeded">Un Bolo ha sido entregado en los últimos 3 minutos, omitiendo SMB</string>
<string name="basal_set_correctly">Basal establecida correctamente</string>
<string name="limitingextendedbolus">Limitando el bolo extendido a %1$.1f U debido a %2$s</string>
<string name="limitingcarbs">Limitando carbohidratos a %1$d g debido a %2$s</string>
<string name="limitingiob">Limitando IOB a %1$.1f U debido a %2$s</string>
<string name="maxvalueinpreferences">Valor máximo en preferencias</string>
<string name="hardlimit">Límite estricto</string>
<string name="maxvalueinpreferences">valor máximo en preferencias</string>
<string name="hardlimit">límite estricto</string>
<string name="readstatusfailed">Error al leer estado</string>
<string name="record_pump_site_change">Anotar el cambio de sitio de la bomba</string>
<string name="record_insulin_cartridge_change">Anotar cambio del cartucho de insulina</string>

View file

@ -57,6 +57,7 @@
<string name="treatments_wizard_tt_label">TT</string>
<string name="treatments_wizard_carbs_label">Koolhydraten</string>
<string name="treatments_wizard_correction_label">Correctie</string>
<string name="bolus_iob_label">Bolus IOB</string>
<string name="openapsma_run">Nu uitvoeren</string>
<string name="vitualpump_label">VIRTUELE POMP</string>
<string name="openapsma_lastrun_label">Laatste berekening</string>
@ -121,7 +122,9 @@
<string name="careportal_newnstreatment_other">Andere</string>
<string name="careportal_newnstreatment_meter">Meter</string>
<string name="careportal_newnstreatment_sensor">Sensor</string>
<string name="carb_time_label">KH tijdsduur</string>
<string name="careportal_newnstreatment_duration_label">Tijdsduur</string>
<string name="profile_label">Profiel</string>
<string name="careportal_newnstreatment_glucosetype">Glucose type</string>
<string name="overview_tempbasal_button">Tijdelijk basaal</string>
<string name="overview_extendedbolus_button">Vertraagde bolus</string>
@ -135,7 +138,7 @@
<string name="filenotfound">Bestand niet gevonden</string>
<string name="nav_export">Exporteer instellingen</string>
<string name="nav_import">Importeer instellingen</string>
<string name="openapsma_maxbasal_title">Maximaal instelbaar basaal Eh/u</string>
<string name="openapsma_maxbasal_title">Maximaal instelbaar basaal E/uur</string>
<string name="openapsma_maxbasal_summary">Dit is de maximale waarde waarop het basaal door OpenAPS ingesteld kan worden</string>
<string name="openapsma_maxiob_title">Maximale basaal IOB, dat OpenAPS kan toedienen [E]</string>
<string name="openapsma_maxiob_summary">Deze waarde wordt de Max IOB genoemd in OpenAPS context\nDit is de maximale insuline hoeveelheid in [E] dat APS in één keer kan toedienen.</string>
@ -200,7 +203,7 @@
<string name="smscommunicator_loopresumereplywithcode">Om loop te hervatten antwoord met code %1$s</string>
<string name="smscommunicator_loopenablereplywithcode">Om loop in te schakelen antwoord met code %1$s</string>
<string name="smscommunicator_loopdisablereplywithcode">Om loop uit te schakelen antwoord met code %1$s</string>
<string name="smscommunicator_tempbasalset">Tijdelijk basaal %1$.2fE/u voor %2$d minuten succesvol gestart</string>
<string name="smscommunicator_tempbasalset">Tijdelijk basaal %1$.2fE/uur voor %2$d minuten succesvol gestart</string>
<string name="smscommunicator_extendedset">Vertraagde bolus %1$.2fE voor %2$d minuten succesvol gestart</string>
<string name="smscommunicator_carbsset">Koolhydraten %1$d g succesvol ingevoerd</string>
<string name="smscommunicator_carbsfailed">Invoeren van %1$dg koolhydraten is mislukt</string>
@ -352,6 +355,7 @@
<string name="smscommunicator_wrongduration">Verkeerde tijdsduur</string>
<string name="smscommunicator_loopsuspended">Loop onderbroken</string>
<string name="smscommunicator_loopresumed">Loop hervat</string>
<string name="bg_trend_label">15min trend</string>
<string name="treatments_wizard_cob_label">COB</string>
<string name="superbolus">Superbolus</string>
<string name="ns_logappstartedevent">Log app start naar NS</string>
@ -517,6 +521,8 @@
<string name="enablesmbwithhightemptarget_summary">Schakel SMB in wanneer er een hoog tijdelijk doel actief is (uitvoeren boven 100 mg/dl of 5,5 mmol/l)</string>
<string name="overview_insulin_label">Insuline</string>
<string name="overview_buttons_selection">Knoppen</string>
<string name="show_calibration_button_summary">Stuurt een kalibratie naar xDrip+ of open het BYODA kalibratie venster</string>
<string name="show_cgm_button_summary">Opent xDrip+ of BYODA, terug knop om terug te gaan naar AAPS</string>
<string name="carb_increment_button_message">Aantal koolhydraten toevoegen wanneer de knop wordt ingedrukt</string>
<string name="insulin_increment_button_message">Hoeveelheid insuline dat wordt toegevoegd wanneer er op de knop gedrukt wordt</string>
<string name="error_starting_cgm">Kon de CGM applicatie niet starten. Zorg dat deze geïnstalleerd is.</string>
@ -622,6 +628,7 @@
<string name="exitwizard">De installatiewizard overslaan</string>
<string name="setupwizard_loop_description">Druk op de knop hieronder om AndroidAPS basaalwijzigingen te laten voorstellen/uitvoeren</string>
<string name="setupwizard_sensitivity_description">Gevoeligheid plugin wordt gebruikt voor de detectie van de gevoeligheid en COB berekening. Voor meer info bezoek:</string>
<string name="setupwizard_sensitivity_url">https://androidaps.readthedocs.io/en/latest/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="nsclientinfotext">NSClient zorgt voor verbinding met Nightscout. Je kunt dit deel nu overslaan, maar pas de Doelen afronden als je het hebt ingesteld.</string>
<string name="diawarning">Onthoud: nieuwe insuline profielen vereisen een minimale DIA van 5 uur. DIA 5 6h op nieuw profiel is gelijk aan DIA 3h op oude insuline profielen.</string>
<string name="setupwizard_aps_description">Selecteer een van beschikbare algoritmen. Ze zijn gesorteerd van oudste naar nieuwste. Nieuwer algoritme is meestal krachtiger en agressiever. Dus als je een nieuwe looper bent, kun je waarschijnlijk beginnen met AMA en niet met de nieuwste. Vergeet niet de OpenAPS-documentatie te lezen en deze vóór gebruik te configureren.</string>
@ -633,6 +640,7 @@
<string name="needsystemwindowpermission">Toepassing vereist systeemvenstermachtiging voor meldingen</string>
<string name="needlocationpermission">App heeft locatie toestemming nodig voor Bluetooth scan en WiFi identificatie</string>
<string name="needstoragepermission">Applicatie heeft toestemming nodig om log bestanden op te slaan en instellingen te exporteren</string>
<string name="needconnectpermission">Applicatie heeft Bluetooth toestemming nodig</string>
<string name="request">Verzoek</string>
<string name="open_navigation">Open navigatie</string>
<string name="close_navigation">Sluit navigatie</string>
@ -888,6 +896,7 @@
<string name="error_in_isf_values">Fout in ISF waarden</string>
<string name="run_question">%s uitvoeren?</string>
<string name="invalid_profile_not_accepted">Ongeldig profiel %1$s niet geaccepteerd door NS</string>
<string name="view">Weergeven</string>
<string name="errors">Foutmeldingen</string>
<string name="ns_sync_slow">Vertraag uploads</string>
<string name="data_status">BG data status</string>

View file

@ -57,6 +57,7 @@
<string name="treatments_wizard_tt_label">AT</string>
<string name="treatments_wizard_carbs_label">Hidratos</string>
<string name="treatments_wizard_correction_label">Corr</string>
<string name="bolus_iob_label">Bólus - IA</string>
<string name="openapsma_run">Executar agora</string>
<string name="vitualpump_label">BOMBA VIRTUAL</string>
<string name="openapsma_lastrun_label">Última execução</string>
@ -120,7 +121,9 @@
<string name="careportal_newnstreatment_other">Outro</string>
<string name="careportal_newnstreatment_meter">Medidor</string>
<string name="careportal_newnstreatment_sensor">Sensor</string>
<string name="carb_time_label">Hora dos Hidratos</string>
<string name="careportal_newnstreatment_duration_label">Duração</string>
<string name="profile_label">Perfil</string>
<string name="careportal_newnstreatment_glucosetype">Tipo de Glicose</string>
<string name="overview_tempbasal_button">Basal Temporária</string>
<string name="overview_extendedbolus_button">Bólus Prolongado</string>
@ -251,6 +254,7 @@
<string name="ongoingnotificaction">Notificação em curso</string>
<string name="old_data">DADOS ANTIGOS</string>
<string name="sms_minago">%1$dmin atrás</string>
<string name="localprofile">Perfil</string>
<string name="openapsama">OpenAPS AMA</string>
<string name="array_of_elements">Array de %1$d elementos.\nValor actual:</string>
<string name="openapsma_autosensdata_label">Dados Autosens</string>
@ -350,6 +354,7 @@
<string name="smscommunicator_wrongduration">Duração errada</string>
<string name="smscommunicator_loopsuspended">Loop suspenso</string>
<string name="smscommunicator_loopresumed">Loop retomado</string>
<string name="bg_trend_label">Tendência 15 min</string>
<string name="treatments_wizard_cob_label">HCA</string>
<string name="superbolus">Superbólus</string>
<string name="ns_logappstartedevent">Registar inicio da app no NS</string>
@ -486,6 +491,7 @@
<string name="dexcomg5_xdripupload_title">Enviar dados Glicose para xDrip+</string>
<string name="dexcomg5_xdripupload_summary">Seleccionar 640g/Eversense como fonte no xDrip+</string>
<string name="nsclientbg">Glicose ClienteNS</string>
<string name="nsclientbgshort">Glicemia do NS</string>
<string name="overview_editquickwizard_usebg">Cálculos Glicose</string>
<string name="overview_editquickwizard_usebolusiob">Cálculo de Bólus IA</string>
<string name="overview_editquickwizard_usebasaliob">Cálculo de Basal IA</string>
@ -619,6 +625,7 @@
<string name="exitwizard">Saltar assistente de configuração</string>
<string name="setupwizard_loop_description">Pressione o botão abaixo para permitir que a AndroidAPS sugira/faça alterações nas basais</string>
<string name="setupwizard_sensitivity_description">Plugin de Sensibilidade é usado para deteção de sensibilidade e cálculos HCA. Para mais info visite:</string>
<string name="setupwizard_sensitivity_url">https://androidaps.readthedocs.io/en/latest/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="nsclientinfotext">ClienteNS gere a ligação ao Nightscout. Pode saltar esta parte mas não será possível passar os objectivos até que o configure.</string>
<string name="diawarning">Lembre-se: novos perfis de insulina requerem diâmetro de pelo menos 5h. DIA 56h no novo perfil é igual ao diâmetro 3h nos antigos perfis de insulina.</string>
<string name="setupwizard_aps_description">Seleccione um dos algoritmos disponíveis. Eles são classificados do mais antigo para o mais recente. Algoritmo mais recente é geralmente mais forte e mais agressivo. Assim, se é novo looper, poderá provavelmente começar com AMA e não com a versão mais recente. Não se esqueça de ler a documentação de OpenAPS e configurá-lo antes de utilizar.</string>
@ -667,6 +674,7 @@
<string name="resettodefaults">Repor definições por defeito</string>
<string name="nsmalfunction">Erro de funcionamento do ClienteNS. Pondere reiniciar o NS e ClienteNS.</string>
<string name="time_offset">Fuso horário</string>
<string name="bolus_reminder">Lembrete para bólus mais tarde</string>
<string name="setupwizard_preferred_aps_mode">Modo APS preferido</string>
<string name="treatments_wizard_total_label">Total</string>
<string name="calculation_short">Calc</string>
@ -705,6 +713,7 @@
<string name="versionChecker">Verificador de Versão</string>
<string name="old_version">versão antiga</string>
<string name="very_old_version">versão muito antiga</string>
<string name="application_expired">A aplicação expirou</string>
<string name="new_version_warning">Nova versão para pelo menos %1$d dias disponíveis! Retorno a SGB após %2$d dias, o loop será desactivado após %3$d dias</string>
<string name="twohours">2h</string>
<string name="cobvsiob">HCA vs IA</string>
@ -735,6 +744,7 @@
<string name="clone_label">Clone</string>
<string name="saveorresetchangesfirst">Guardar ou repor as alterações actuais primeiro</string>
<string name="deletecurrentprofile">Eliminar perfil actual?</string>
<string name="copytolocalprofile">Criar novo perfil local a partir deste perfil?</string>
<string name="profilenamecontainsdot">Nome do perfil contém pontos.\nIsso não é suportado pelo NS.\nPerfil não é enviado para o NS.</string>
<string name="low_mark_comment">Valor mais baixo da área de intervalo (apenas exibição)</string>
<string name="high_mark_comment">Valor mais alto da área de intervalo (apenas exibição)</string>
@ -758,6 +768,7 @@
<string name="randombg_short">Glicose</string>
<string name="tools">Ferramentas</string>
<string name="show_calculation">Mostrar Localização</string>
<string name="show_removed">Exibir removidos</string>
<string name="clearqueueconfirm">Limpar fila? Todos os dados na fila serão perdidos!</string>
<string name="ebstopsloop">O uso do Bólus Prolongado irá parar o modo Loop Fechado durante o tempo do bólus prolongado. Quer realmente isso?</string>
<string name="closed_loop_disabled_with_eb">Loop Fechado desativado por causa da execução do Bólus Prolongado</string>
@ -815,6 +826,7 @@
<string name="dpvdefaultprofile">Perfil Padrão DPV</string>
<string name="setupwizard_pump_riley_link_status">Estado RileyLink:</string>
<string name="filter">Filtro</string>
<string name="copytolocalprofile_invalid">Não é possível criar o perfil. O perfil é inválido.</string>
<string name="cta_dont_kill_my_app_info">Não encerre minha app?</string>
<string name="smscommunicator_report_pump_ureachable_summary">Enviar SMS se evento de bomba inacessível for acionado</string>
<string name="smscommunicator_pump_ureachable">Reportar bomba inacessível</string>
@ -826,6 +838,7 @@
<string name="enablebolusadvisor_summary">Use lembrete para começar a comer mais tarde em vez di resultado do assistente durante a glicemia alta (\"pré-bolus\")</string>
<string name="time_to_eat">Hora de comer!\nExecutar assistente de Bólus e fazer cálculo novamente.</string>
<string name="timetoeat">Hora de comer</string>
<string name="bolusreminder">Lembrete de bólus</string>
<string name="fabric_upload_disabled">Envio de registos de erro desativado!</string>
<string name="graph_menu_divider_header">Gráfico</string>
<string name="chart_menu">Menu do Gráfico</string>

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
import info.nightscout.androidaps.queue.commands.*
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
@ -46,6 +47,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
@Mock lateinit var powerManager: PowerManager
@Mock lateinit var repository: AppRepository
@Mock lateinit var fileListProvider: PrefFileListProvider
@Mock lateinit var androidPermission: AndroidPermission
class CommandQueueMocked(
injector: HasAndroidInjector,
@ -62,9 +64,10 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
dateUtil: DateUtil,
repository: AppRepository,
fabricPrivacy: FabricPrivacy,
config: Config
config: Config,
androidPermission: AndroidPermission
) : CommandQueueImplementation(injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy, config) {
activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission) {
override fun notifyAboutNewCommand() {}
@ -107,7 +110,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
constraintChecker, profileFunction, activePlugin, context, sp,
BuildHelperImpl(config, fileListProvider), dateUtil,
repository,
fabricPrivacy, config)
fabricPrivacy, config, androidPermission)
testPumpPlugin = TestPumpPlugin(injector)
testPumpPlugin.pumpDescription.basalMinimumRate = 0.1
@ -142,7 +145,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
constraintChecker, profileFunction, activePlugin, context, sp,
BuildHelperImpl(config, fileListProvider),
dateUtil, repository,
fabricPrivacy, config)
fabricPrivacy, config, androidPermission)
// start with empty queue
Assert.assertEquals(0, commandQueue.size())

View file

@ -16,6 +16,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
import info.nightscout.androidaps.queue.commands.Command
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Assert
@ -33,6 +34,7 @@ class QueueThreadTest : TestBaseWithProfile() {
@Mock lateinit var fileListProvider: PrefFileListProvider
@Mock lateinit var powerManager: PowerManager
@Mock lateinit var repository: AppRepository
@Mock lateinit var androidPermission: AndroidPermission
val injector = HasAndroidInjector {
AndroidInjector {
@ -57,7 +59,7 @@ class QueueThreadTest : TestBaseWithProfile() {
commandQueue = CommandQueueImplementation(
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
profileFunction, activePlugin, context, sp,
BuildHelperImpl(config, fileListProvider), dateUtil, repository, fabricPrivacy, config
BuildHelperImpl(config, fileListProvider), dateUtil, repository, fabricPrivacy, config, androidPermission
)
val pumpDescription = PumpDescription()
@ -79,7 +81,7 @@ class QueueThreadTest : TestBaseWithProfile() {
.thenReturn(percentageConstraint)
Mockito.`when`(rh.gs(ArgumentMatchers.eq(R.string.temp_basal_absolute), anyObject(), anyObject())).thenReturn("TEMP BASAL %1\$.2f U/h %2\$d min")
sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp)
sut = QueueThread(commandQueue, context, aapsLogger, rxBus, activePlugin, rh, sp, androidPermission, config)
}
@Test

View file

@ -76,6 +76,14 @@ allprojects {
jvmTarget = "11"
}
}
// Workaround to support M1 builds. Room 2.4.0 fixes this but requires min compileSdkVersion
// 31 => remove when upgrading to Room 2.4.0
// Source: https://issuetracker.google.com/issues/174695268
configurations.configureEach {
resolutionStrategy {
force 'org.xerial:sqlite-jdbc:3.36.0.3'
}
}
}
task clean(type: Delete) {

View file

@ -20,8 +20,8 @@ import javax.inject.Singleton
@Singleton
class BlePreCheck @Inject constructor(
val context: Context,
val rh: ResourceHelper
private val context: Context,
private val rh: ResourceHelper
) {
companion object {
@ -43,8 +43,12 @@ class BlePreCheck @Inject constructor(
}
// change after SDK = 31+
if (Build.VERSION.SDK_INT >= /*Build.VERSION_CODES.S*/31) {
if (ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_CONNECT") != PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(context, "android.permission.BLUETOOTH_SCAN") != PackageManager.PERMISSION_GRANTED
)
//ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT), PERMISSION_REQUEST_BLUETOOTH)
ActivityCompat.requestPermissions(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"), PERMISSION_REQUEST_BLUETOOTH)
ActivityCompat.requestPermissions(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"), PERMISSION_REQUEST_BLUETOOTH)
return false
}
val bluetoothAdapter = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter

View file

@ -18,7 +18,7 @@ class TimerUtil @Inject constructor(
/**
* Schedule alarm in @seconds
*/
fun scheduleReminder(seconds: Long, text: String) {
fun scheduleReminder(seconds: Int, text: String) {
Intent(AlarmClock.ACTION_SET_TIMER).apply {
flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK
putExtra(AlarmClock.EXTRA_LENGTH, seconds)

View file

@ -80,7 +80,7 @@
<string name="unsafeusage">uso no seguro</string>
<string name="pump_unreachable">Bomba no alcanzable</string>
<string name="extended_bolus">Bolo extendido</string>
<string name="pump_time_updated">Hora de infusora actualizada</string>
<string name="pump_time_updated">Hora actualizada en la bomba</string>
<string name="exit">Salir</string>
<string name="removerecord">Eliminar registro</string>
<string name="loopisdisabled">Lazo desactivado</string>
@ -184,7 +184,7 @@
<string name="careportal_note_message">Nota : %1$s</string>
<string name="careportal_question_message">Pregunta : %1$s</string>
<string name="careportal_exercise_message">Ejercicio : %1$s</string>
<string name="careportal_pumpsitechange">Cambio de cánula de bomba</string>
<string name="careportal_pumpsitechange">Cambio de cánula</string>
<string name="careportal_cgmsensorinsert">Inserción de sensor</string>
<string name="careportal_cgmsensorstart">Inicio de Sensor</string>
<string name="careportal_cgm_sensor_stop">Detener sensor MCG</string>
@ -199,7 +199,7 @@
<string name="careportal_tempbasalend">Fin Basal Temp</string>
<string name="careportal_carbscorrection">Carbohidratos de corrección</string>
<string name="careportal_openapsoffline">OpenAPS sin conexión</string>
<string name="careportal_pumpbatterychange">Cambio batería de bomba</string>
<string name="careportal_pumpbatterychange">Cambiar batería de bomba</string>
<string name="careportal_temporarytarget">Objetivo temporal</string>
<string name="careportal_temporarytargetvalue">Valor objetivo temporal</string>
<string name="careportal_temporarytargetcancel">Cancelar Objetivo temporal</string>
@ -429,8 +429,8 @@
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal desactualizada.</string>
<string name="sms" comment="26 characters max for translation">SMS</string>
<string name="clicked_connect_to_pump" comment="26 characters max for translation">Pulsa sobre conectar a la bomba</string>
<string name="pump_driver_changed" comment="26 characters max for translation">Controlador de bomba cambiado.</string>
<string name="pump_driver_change" comment="26 characters max for translation">Cambio del controlador de la bomba.</string>
<string name="pump_driver_changed" comment="26 characters max for translation">Controlador de bomba cambiado</string>
<string name="pump_driver_change" comment="26 characters max for translation">Cambio del controlador de la bomba</string>
<string name="device_changed" comment="26 characters max for translation">Dispositivo cambiado</string>
<string name="clicked_refresh" comment="26 characters max for translation">Refresco pulsado</string>
<string name="scheduled_status_refresh" comment="26 characters max for translation">Refrescar estado programado</string>

View file

@ -131,5 +131,6 @@
<string name="num1pin">1: (12 digits)</string>
<string name="num2pin">2: (8 digits)</string>
<string name="basal_bolus_step">Basal/bolus step</string>
<string name="carbs_store_error">Carbs were probably not stored correctly. Manually check and store again if needed.</string>
</resources>

View file

@ -348,6 +348,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
DanaPump.HistoryEntry.CARBS.getValue(), carbtime, carbs, 0);
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.failed)
ErrorHelperActivity.Companion.runAlarm(context, rh.gs(R.string.carbs_store_error)
, rh.gs(R.string.error), R.raw.boluserror);
}
final long bolusStart = System.currentTimeMillis();

View file

@ -21,7 +21,7 @@ class DanaRSPacketAPSSetEventHistory(
init {
opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY
if ((packetType == DanaPump.HistoryEntry.CARBS.value || packetType == DanaPump.HistoryEntry.BOLUS.value) && param1 <= 0) param1 = 0
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: " + dateUtil.dateAndTimeString(time) + " type: " + packetType + " param1: " + param1 + " param2: " + param2)
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: " + dateUtil.dateAndTimeAndSecondsString(time) + " type: " + packetType + " param1: " + param1 + " param2: " + param2)
}
override fun getRequestParams(): ByteArray {

View file

@ -271,6 +271,8 @@ class DanaRSService : DaggerService() {
val msgSetHistoryEntryV2 = DanaRSPacketAPSSetEventHistory(injector, DanaPump.HistoryEntry.CARBS.value, carbTime, carbs, 0)
sendMessage(msgSetHistoryEntryV2)
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed)
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror)
}
val bolusStart = System.currentTimeMillis()
if (insulin > 0) {

View file

@ -2,10 +2,8 @@ package info.nightscout.androidaps.database.daos
import androidx.room.Dao
import androidx.room.Query
import info.nightscout.androidaps.database.TABLE_GLUCOSE_VALUES
import info.nightscout.androidaps.database.TABLE_TEMPORARY_BASALS
import info.nightscout.androidaps.database.embedments.InterfaceIDs
import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.database.entities.TemporaryBasal
import io.reactivex.Maybe
import io.reactivex.Single

View file

@ -15,7 +15,8 @@ class SyncPumpCancelTemporaryBasalIfAnyTransaction(
return result
val current = database.temporaryBasalDao.getTemporaryBasalActiveAt(timestamp, pumpType, pumpSerial).blockingGet()
if (current != null && current.interfaceIDs.endId == null) { // do not allow overwrite if cut by end event
current.end = timestamp
if (current.timestamp != timestamp) current.end = timestamp // prevent zero duration
else current.duration = 1
current.interfaceIDs.endId = endPumpId
database.temporaryBasalDao.updateExistingEntry(current)
result.updated.add(current)

View file

@ -105,9 +105,11 @@ class BLECommonService @Inject internal constructor(
scheduledDisconnection?.cancel(false)
scheduledDisconnection = null
if (bluetoothAdapter == null || bluetoothGatt == null) {
if (bluetoothAdapter == null || bluetoothGatt == null || uartIndicate == null) {
aapsLogger.error("disconnect is not possible: (mBluetoothAdapter == null) " + (bluetoothAdapter == null))
aapsLogger.error("disconnect is not possible: (mBluetoothGatt == null) " + (bluetoothGatt == null))
aapsLogger.error("disconnect is not possible: (uartIndicate == null) " + (uartIndicate == null))
isConnected = false
return
}
bluetoothGatt?.setCharacteristicNotification(uartIndicate, false)

View file

@ -100,7 +100,7 @@ class MedtronicHistoryActivity : DaggerActivity() {
val spinnerAdapter = ArrayAdapter(this, R.layout.spinner_centered, typeListFull)
historyTypeSpinner.adapter = spinnerAdapter
historyTypeSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (manualChange) return
val selected = historyTypeSpinner.selectedItem as TypeList
showingType = selected

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
<string name="dash_bolusdelivering">Podávání %1$.2f U</string>
<string name="omnipod_common_alert_delivery_suspended">Výdej inzulínu je pozastaven</string>
<string name="omnipod_dash_connection_lost">Ztraceno připojení k podu</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f IE</string>
<string name="dash_bolusdelivering">Gebe %1$.2f IE ab</string>
<string name="omnipod_common_alert_delivery_suspended">Insulinabgabe ist unterbrochen</string>
<string name="omnipod_dash_connection_lost">Verbindung zum Pod verloren</string>
</resources>

View file

@ -36,4 +36,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
<string name="dash_bolusdelivering">Entregando %1$.2f U</string>
<string name="omnipod_common_alert_delivery_suspended">Suspendida la entrega de insulina</string>
<string name="omnipod_dash_connection_lost">Conexión perdida con el pod</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
<string name="dash_bolusdelivering">Erogazione di %1$.2f U</string>
<string name="omnipod_common_alert_delivery_suspended">L\'erogazione di insulina è sospesa</string>
<string name="omnipod_dash_connection_lost">Persa connessione al pod</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f יח\'</string>
<string name="dash_bolusdelivering">מזריק %1$.2f יח\'</string>
<string name="omnipod_common_alert_delivery_suspended">הזרקת האינסולין מופסקת</string>
<string name="omnipod_dash_connection_lost">אבד החיבור לפוד</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f E</string>
<string name="dash_bolusdelivering">%1$.2f eh worden toegediend</string>
<string name="omnipod_common_alert_delivery_suspended">Insuline levering is opgeschort</string>
<string name="omnipod_dash_connection_lost">Verbinding met pod verbroken</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f E</string>
<string name="dash_bolusdelivering">Leverer %1$.2f E</string>
<string name="omnipod_common_alert_delivery_suspended">Insulintilførsel er suspendert</string>
<string name="omnipod_dash_connection_lost">Mistet tilkoblingen til pod</string>
</resources>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Omnipod Dash - Description -->
<string name="omnipod_dash_pump_description">Integracja dla pompy Omnipod Dash (nowy, posiadając Bluetooth model z niebieską osłonką na igłę).</string>
<string name="omnipod_dash_pump_description">Integracja dla pompy Omnipod Dash (nowy, posiadający Bluetooth model z niebieską osłonką na igłę).</string>
<!-- Omnipod Dash - Keys -->
<!-- Omnipod Dash - History -->
<string name="omnipod_dash_history_title">Historia Poda</string>
@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f U</string>
<string name="dash_bolusdelivering">Dostarczanie %1$.2f U</string>
<string name="omnipod_common_alert_delivery_suspended">Podawanie insuliny zawieszone</string>
<string name="omnipod_dash_connection_lost">Utracono połączenie z Podem</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f ед</string>
<string name="dash_bolusdelivering">Подается болюс %1$.2f ед</string>
<string name="omnipod_common_alert_delivery_suspended">Введение инсулина приостановлено</string>
<string name="omnipod_dash_connection_lost">Потеряно соединение с подом</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f JI</string>
<string name="dash_bolusdelivering">Podávanie %1$.2f JI</string>
<string name="omnipod_common_alert_delivery_suspended">Podávanie inzulínu je pozastavené</string>
<string name="omnipod_dash_connection_lost">Stratilo sa spojenie s Podom</string>
</resources>

View file

@ -35,4 +35,5 @@
<string name="omnipod_common_history_bolus_value">%1$.2f Ü</string>
<string name="dash_bolusdelivering">%1$.2f Ü gönderiliyor</string>
<string name="omnipod_common_alert_delivery_suspended">İnsülin iletimi askıya alındı</string>
<string name="omnipod_dash_connection_lost">Pod ile bağlantı koptu</string>
</resources>

View file

@ -43,6 +43,7 @@ class RileyLinkBLE @Inject constructor(private val context: Context) {
private val gattDebugEnabled = true
private var manualDisconnect = false
//val bluetoothAdapter: BluetoothAdapter = BluetoothAdapter.getDefaultAdapter()
val bluetoothAdapter: BluetoothAdapter? get() = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter
private val bluetoothGattCallback: BluetoothGattCallback
var rileyLinkDevice: BluetoothDevice? = null

View file

@ -9,12 +9,14 @@
<TextView
android:id="@+id/riley_link_ble_config_scan_item_device_name"
style="@style/TextAppearance.AppCompat.Medium.Inverse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp" />
<TextView
android:id="@+id/riley_link_ble_config_scan_item_device_address"
style="@style/TextAppearance.AppCompat.Medium.Inverse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />

View file

@ -12,7 +12,6 @@ import android.support.wearable.complications.ComplicationManager;
import android.support.wearable.complications.ComplicationProviderService;
import android.support.wearable.complications.ComplicationText;
import android.support.wearable.complications.ProviderUpdateRequester;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -30,6 +29,8 @@ import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.Inevitable;
import info.nightscout.androidaps.interaction.utils.Persistence;
import info.nightscout.androidaps.interaction.utils.WearUtil;
import info.nightscout.shared.logging.AAPSLogger;
import info.nightscout.shared.logging.LTag;
/**
* Base class for all complications
@ -42,6 +43,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
@Inject WearUtil wearUtil;
@Inject DisplayFormat displayFormat;
@Inject Persistence persistence;
@Inject AAPSLogger aapsLogger;
// Not derived from DaggerService, do injection here
@Override
@ -50,8 +52,6 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
super.onCreate();
}
private static final String TAG = BaseComplicationProviderService.class.getSimpleName();
public static final String KEY_COMPLICATIONS = "complications";
private static final String KEY_LAST_SHOWN_SINCE_VALUE = "lastSince";
private static final String KEY_STALE_REPORTED = "staleReported";
@ -116,9 +116,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
case ComplicationData.TYPE_LARGE_IMAGE:
return buildComplicationData(dataType, raw, complicationPendingIntent);
default:
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
break;
}
@ -165,9 +163,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
case ComplicationData.TYPE_LARGE_IMAGE:
return buildComplicationData(dataType, raw, complicationPendingIntent);
default:
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
break;
}
@ -197,7 +193,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
@Override
public void onComplicationActivated(
int complicationId, int dataType, ComplicationManager complicationManager) {
Log.d(TAG, "onComplicationActivated(): " + complicationId + " of kind: " + getProviderCanonicalName());
aapsLogger.warn(LTag.WEAR, "onComplicationActivated(): " + complicationId + " of kind: " + getProviderCanonicalName());
persistence.putString("complication_" + complicationId, getProviderCanonicalName());
persistence.putBoolean("complication_" + complicationId + "_since", usesSinceField());
@ -226,7 +222,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
@Override
public void onComplicationUpdate(
int complicationId, int dataType, ComplicationManager complicationManager) {
Log.d(TAG, "onComplicationUpdate() id: " + complicationId + " of class: " + getProviderCanonicalName());
aapsLogger.warn(LTag.WEAR, "onComplicationUpdate() id: " + complicationId + " of class: " + getProviderCanonicalName());
// Create Tap Action so that the user can checkIfUpdateNeeded an update by tapping the complication.
final ComponentName thisProvider = new ComponentName(this, getProviderCanonicalName());
@ -238,7 +234,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
final RawDisplayData raw = new RawDisplayData(wearUtil);
raw.updateForComplicationsFromPersistence(persistence);
Log.d(TAG, "Complication data: " + raw.toDebugString());
aapsLogger.warn(LTag.WEAR, "Complication data: " + raw.toDebugString());
// store what is currently rendered in 'SGV since' field, to detect if it was changed and need update
persistence.putString(KEY_LAST_SHOWN_SINCE_VALUE, displayFormat.shortTimeSince(raw.datetime));
@ -277,7 +273,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
*/
@Override
public void onComplicationDeactivated(int complicationId) {
Log.d(TAG, "onComplicationDeactivated(): " + complicationId);
aapsLogger.warn(LTag.WEAR, "onComplicationDeactivated(): " + complicationId);
persistence.removeFromSet(KEY_COMPLICATIONS, "complication_" + complicationId);
@ -296,11 +292,11 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
*/
public void checkIfUpdateNeeded() {
Log.d(TAG, "Pending check if update needed - " + persistence.getString(KEY_COMPLICATIONS, ""));
aapsLogger.warn(LTag.WEAR, "Pending check if update needed - " + persistence.getString(KEY_COMPLICATIONS, ""));
inevitable.task(TASK_ID_REFRESH_COMPLICATION, 15 * Constants.SECOND_IN_MS, () -> {
if (wearUtil.isBelowRateLimit("complication-checkIfUpdateNeeded", 5)) {
Log.d(TAG, "Checking if update needed");
aapsLogger.warn(LTag.WEAR, "Checking if update needed");
requestUpdateIfSinceChanged();
// We reschedule need for check - to make sure next check will Inevitable go in next 15s
checkIfUpdateNeeded();
@ -329,7 +325,7 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
persistence.putString(KEY_LAST_SHOWN_SINCE_VALUE, calcSince);
persistence.putBoolean(KEY_STALE_REPORTED, isStale);
Log.d(TAG, "Detected refresh of time needed! Reason: "
aapsLogger.warn(LTag.WEAR, "Detected refresh of time needed! Reason: "
+ (isStale ? "- stale detected" : "")
+ (sinceWasChanged ? "- since changed from: " + lastSince + " to: " + calcSince : ""));
@ -348,11 +344,11 @@ public abstract class BaseComplicationProviderService extends ComplicationProvid
*/
private void requestUpdate(Set<String> providers) {
for (String provider : providers) {
Log.d(TAG, "Pending update of " + provider);
aapsLogger.warn(LTag.WEAR, "Pending update of " + provider);
// We wait with updating allowing all request, from various sources, to arrive
inevitable.task("update-req-" + provider, 700, () -> {
if (wearUtil.isBelowRateLimit("update-req-" + provider, 2)) {
Log.d(TAG, "Requesting update of " + provider);
aapsLogger.warn(LTag.WEAR, "Requesting update of " + provider);
final ComponentName componentName = new ComponentName(getApplicationContext(), provider);
final ProviderUpdateRequester providerUpdateRequester = new ProviderUpdateRequester(getApplicationContext(), componentName);
providerUpdateRequester.requestUpdateAll();

View file

@ -11,6 +11,7 @@ import dagger.android.AndroidInjection;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.SmallestDoubleString;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
@ -26,26 +27,22 @@ public class BrCobIobComplication extends BaseComplicationProviderService {
super.onCreate();
}
private static final String TAG = BrCobIobComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
if (dataType == ComplicationData.TYPE_SHORT_TEXT) {
final String cob = new SmallestDoubleString(raw.sCOB2, SmallestDoubleString.Units.USE).minimise(displayFormat.MIN_FIELD_LEN_COB);
final String iob = new SmallestDoubleString(raw.sIOB1, SmallestDoubleString.Units.USE).minimise(Math.max(displayFormat.MIN_FIELD_LEN_IOB, (displayFormat.MAX_FIELD_LEN_SHORT -1) - cob.length()));
final String iob = new SmallestDoubleString(raw.sIOB1, SmallestDoubleString.Units.USE).minimise(Math.max(displayFormat.MIN_FIELD_LEN_IOB, (displayFormat.MAX_FIELD_LEN_SHORT - 1) - cob.length()));
final ComplicationData.Builder builder = new ComplicationData.Builder(ComplicationData.TYPE_SHORT_TEXT)
.setShortText(ComplicationText.plainText(displayFormat.basalRateSymbol()+raw.sBasalRate))
.setShortText(ComplicationText.plainText(displayFormat.basalRateSymbol() + raw.sBasalRate))
.setShortTitle(ComplicationText.plainText(cob + " " + iob))
.setTapAction(complicationPendingIntent);
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -3,19 +3,16 @@ package info.nightscout.androidaps.complications;
import android.app.PendingIntent;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.Pair;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
*/
public class CobDetailedComplication extends BaseComplicationProviderService {
private static final String TAG = CobDetailedComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -33,9 +30,7 @@ public class CobDetailedComplication extends BaseComplicationProviderService {
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -4,18 +4,16 @@ import android.app.PendingIntent;
import android.graphics.drawable.Icon;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
*/
public class CobIconComplication extends BaseComplicationProviderService {
private static final String TAG = CobIconComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -33,9 +31,7 @@ public class CobIconComplication extends BaseComplicationProviderService {
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -3,19 +3,16 @@ package info.nightscout.androidaps.complications;
import android.app.PendingIntent;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.SmallestDoubleString;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
*/
public class CobIobComplication extends BaseComplicationProviderService {
private static final String TAG = CobIobComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -31,9 +28,7 @@ public class CobIobComplication extends BaseComplicationProviderService {
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -3,19 +3,16 @@ package info.nightscout.androidaps.complications;
import android.app.PendingIntent;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.Pair;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
*/
public class IobDetailedComplication extends BaseComplicationProviderService {
private static final String TAG = IobDetailedComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -33,9 +30,7 @@ public class IobDetailedComplication extends BaseComplicationProviderService {
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -4,20 +4,17 @@ import android.app.PendingIntent;
import android.graphics.drawable.Icon;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.androidaps.interaction.utils.SmallestDoubleString;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
*/
public class IobIconComplication extends BaseComplicationProviderService {
private static final String TAG = IobIconComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -36,9 +33,7 @@ public class IobIconComplication extends BaseComplicationProviderService {
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -3,13 +3,13 @@ package info.nightscout.androidaps.complications;
import android.app.PendingIntent;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
@ -25,8 +25,6 @@ public class LongStatusComplication extends BaseComplicationProviderService {
super.onCreate();
}
private static final String TAG = LongStatusComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -45,9 +43,7 @@ public class LongStatusComplication extends BaseComplicationProviderService {
break;
default:
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -3,13 +3,13 @@ package info.nightscout.androidaps.complications;
import android.app.PendingIntent;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
@ -25,8 +25,6 @@ public class LongStatusFlippedComplication extends BaseComplicationProviderServi
super.onCreate();
}
private static final String TAG = LongStatusFlippedComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -45,9 +43,7 @@ public class LongStatusFlippedComplication extends BaseComplicationProviderServi
break;
default:
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -3,13 +3,13 @@ package info.nightscout.androidaps.complications;
import android.app.PendingIntent;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.DisplayFormat;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
@ -25,8 +25,6 @@ public class SgvComplication extends BaseComplicationProviderService {
super.onCreate();
}
private static final String TAG = SgvComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -41,9 +39,7 @@ public class SgvComplication extends BaseComplicationProviderService {
complicationData = builder.build();
break;
default:
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -4,19 +4,18 @@ import android.app.PendingIntent;
import android.graphics.drawable.Icon;
import android.support.wearable.complications.ComplicationData;
import android.support.wearable.complications.ComplicationText;
import android.util.Log;
import androidx.annotation.DrawableRes;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
*/
public class UploaderBattery extends BaseComplicationProviderService {
private static final String TAG = UploaderBattery.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -31,43 +30,89 @@ public class UploaderBattery extends BaseComplicationProviderService {
level = Integer.parseInt(raw.sUploaderBattery);
level = Math.max(Math.min(level, 100), 0);
levelStr = level + "%";
int iconNo = (int)Math.floor(level / 10.0);
int iconNo = (int) Math.floor(level / 10.0);
if (level > 95) {
iconNo = 10;
}
switch (iconNo) {
case 10: batteryIcon = R.drawable.ic_battery_charging_wireless; break;
case 9: batteryIcon = R.drawable.ic_battery_charging_wireless_90; break;
case 8: batteryIcon = R.drawable.ic_battery_charging_wireless_80; break;
case 7: batteryIcon = R.drawable.ic_battery_charging_wireless_70; break;
case 6: batteryIcon = R.drawable.ic_battery_charging_wireless_60; break;
case 5: batteryIcon = R.drawable.ic_battery_charging_wireless_50; break;
case 4: batteryIcon = R.drawable.ic_battery_charging_wireless_40; break;
case 3: batteryIcon = R.drawable.ic_battery_charging_wireless_30; break;
case 2: batteryIcon = R.drawable.ic_battery_charging_wireless_20; break;
case 1: batteryIcon = R.drawable.ic_battery_charging_wireless_10; break;
case 0: batteryIcon = R.drawable.ic_battery_alert_variant_outline; break;
default: batteryIcon = R.drawable.ic_battery_charging_wireless_outline;
case 10:
batteryIcon = R.drawable.ic_battery_charging_wireless;
break;
case 9:
batteryIcon = R.drawable.ic_battery_charging_wireless_90;
break;
case 8:
batteryIcon = R.drawable.ic_battery_charging_wireless_80;
break;
case 7:
batteryIcon = R.drawable.ic_battery_charging_wireless_70;
break;
case 6:
batteryIcon = R.drawable.ic_battery_charging_wireless_60;
break;
case 5:
batteryIcon = R.drawable.ic_battery_charging_wireless_50;
break;
case 4:
batteryIcon = R.drawable.ic_battery_charging_wireless_40;
break;
case 3:
batteryIcon = R.drawable.ic_battery_charging_wireless_30;
break;
case 2:
batteryIcon = R.drawable.ic_battery_charging_wireless_20;
break;
case 1:
batteryIcon = R.drawable.ic_battery_charging_wireless_10;
break;
case 0:
batteryIcon = R.drawable.ic_battery_alert_variant_outline;
break;
default:
batteryIcon = R.drawable.ic_battery_charging_wireless_outline;
}
switch (iconNo) {
case 10: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_burnin; break;
case 9: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_90_burnin; break;
case 8: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_80_burnin; break;
case 7: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_70_burnin; break;
case 6: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_60_burnin; break;
case 5: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_50_burnin; break;
case 4: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_40_burnin; break;
case 3: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_30_burnin; break;
case 2: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_20_burnin; break;
case 1: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_10_burnin; break;
case 0: burnInBatteryIcon = R.drawable.ic_battery_alert_variant_outline; break;
default: burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_outline;
case 10:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_burnin;
break;
case 9:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_90_burnin;
break;
case 8:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_80_burnin;
break;
case 7:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_70_burnin;
break;
case 6:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_60_burnin;
break;
case 5:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_50_burnin;
break;
case 4:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_40_burnin;
break;
case 3:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_30_burnin;
break;
case 2:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_20_burnin;
break;
case 1:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_10_burnin;
break;
case 0:
burnInBatteryIcon = R.drawable.ic_battery_alert_variant_outline;
break;
default:
burnInBatteryIcon = R.drawable.ic_battery_charging_wireless_outline;
}
} catch (NumberFormatException ex){
Log.e(TAG, "Cannot parse battery level of: " + raw.sUploaderBattery);
} catch (NumberFormatException ex) {
aapsLogger.error(LTag.WEAR, "Cannot parse battery level of: " + raw.sUploaderBattery);
}
}
@ -95,9 +140,7 @@ public class UploaderBattery extends BaseComplicationProviderService {
.setTapAction(complicationPendingIntent);
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -8,14 +8,13 @@ import android.graphics.BitmapFactory;
import android.graphics.drawable.Icon;
import android.support.wearable.complications.ComplicationData;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import java.io.IOException;
import java.io.InputStream;
import info.nightscout.androidaps.Aaps;
import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.shared.logging.LTag;
/*
* Created by dlvoy on 2019-11-12
@ -24,8 +23,6 @@ public abstract class WallpaperComplication extends BaseComplicationProviderServ
public abstract String getWallpaperAssetsFileName();
private static final String TAG = WallpaperComplication.class.getSimpleName();
public ComplicationData buildComplicationData(int dataType, RawDisplayData raw, PendingIntent complicationPendingIntent) {
ComplicationData complicationData = null;
@ -42,19 +39,17 @@ public abstract class WallpaperComplication extends BaseComplicationProviderServ
final ComplicationData.Builder builder = new ComplicationData.Builder(ComplicationData.TYPE_LARGE_IMAGE);
AssetManager assetManager = getAssets();
try (InputStream istr = assetManager.open(getWallpaperAssetsFileName())) {
Bitmap bitmap = BitmapFactory.decodeStream(istr);
Bitmap scaled = Bitmap.createScaledBitmap(bitmap, width, height, true);
builder.setLargeImage(Icon.createWithBitmap(scaled));
try (InputStream iStr = assetManager.open(getWallpaperAssetsFileName())) {
Bitmap bitmap = BitmapFactory.decodeStream(iStr);
Bitmap scaled = Bitmap.createScaledBitmap(bitmap, width, height, true);
builder.setLargeImage(Icon.createWithBitmap(scaled));
} catch (IOException e) {
Log.e(TAG, "Cannot read wallpaper asset: "+e.getMessage(), e);
aapsLogger.error(LTag.WEAR, "Cannot read wallpaper asset: " + e.getMessage(), e);
}
complicationData = builder.build();
} else {
if (Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, "Unexpected complication type " + dataType);
}
aapsLogger.warn(LTag.WEAR, "Unexpected complication type " + dataType);
}
return complicationData;
}

View file

@ -1,13 +1,8 @@
package info.nightscout.androidaps.di
import android.net.wifi.hotspot2.pps.HomeSp
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.complications.BaseComplicationProviderService
import info.nightscout.androidaps.complications.BrCobIobComplication
import info.nightscout.androidaps.complications.LongStatusComplication
import info.nightscout.androidaps.complications.LongStatusFlippedComplication
import info.nightscout.androidaps.complications.SgvComplication
import info.nightscout.androidaps.complications.*
import info.nightscout.androidaps.data.ListenerService
import info.nightscout.androidaps.watchfaces.*
@ -16,15 +11,23 @@ import info.nightscout.androidaps.watchfaces.*
abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesListenerService(): ListenerService
@ContributesAndroidInjector abstract fun contributesBaseComplicationProviderService(): BaseComplicationProviderService
@ContributesAndroidInjector abstract fun contributesBrCobIobComplication(): BrCobIobComplication
@ContributesAndroidInjector abstract fun contributesCobDetailedComplication(): CobDetailedComplication
@ContributesAndroidInjector abstract fun contributesCobIconComplication(): CobIconComplication
@ContributesAndroidInjector abstract fun contributesCobIobComplication(): CobIobComplication
@ContributesAndroidInjector abstract fun contributesIobDetailedComplication(): IobDetailedComplication
@ContributesAndroidInjector abstract fun contributesIobIconComplication(): IobIconComplication
@ContributesAndroidInjector abstract fun contributesLongStatusComplication(): LongStatusComplication
@ContributesAndroidInjector abstract fun contributesLongStatusFlippedComplication(): LongStatusFlippedComplication
@ContributesAndroidInjector abstract fun contributesSgvComplication(): SgvComplication
@ContributesAndroidInjector abstract fun contributesUploaderBattery(): UploaderBattery
@ContributesAndroidInjector abstract fun contributesWallpaperComplication(): WallpaperComplication
@ContributesAndroidInjector abstract fun contributesBaseWatchFace(): BaseWatchFace
@ContributesAndroidInjector abstract fun contributesHome(): Home
@ContributesAndroidInjector abstract fun contributesHome2(): Home2
@ContributesAndroidInjector abstract fun contributesHomeSp(): HomeSp
@ContributesAndroidInjector abstract fun contributesLargeHome(): LargeHome
@ContributesAndroidInjector abstract fun contributesSteampunk(): Steampunk
@ContributesAndroidInjector abstract fun contributesDigitalStyle(): DigitalStyle

View file

@ -69,7 +69,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
}
public final Point displaySize = new Point();
public TextView mTime, mHour, mMinute, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight;
public TextView mTime, mHour, mMinute, mTimePeriod, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight;
public TextView mSimpleSvg, mSimpleDirection, mSimpleTime;
public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand;
public View mSimpleUi;
@ -130,15 +130,13 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
}
private void setupBatteryReceiver() {
if (sharedPrefs.getBoolean("simplify_ui_charging", false)) {
if (sharedPrefs.getBoolean("simplify_ui_charging", false) && batteryReceiver == null) {
IntentFilter intentBatteryFilter = new IntentFilter();
intentBatteryFilter.addAction(BatteryManager.ACTION_CHARGING);
intentBatteryFilter.addAction(BatteryManager.ACTION_DISCHARGING);
isCharging = checkIsCharging();
batteryReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
isCharging = checkIsCharging();
setDataFields();
invalidate();
}
@ -168,6 +166,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mTime = stub.findViewById(R.id.watch_time);
mHour = stub.findViewById(R.id.hour);
mMinute = stub.findViewById(R.id.minute);
mTimePeriod = stub.findViewById(R.id.timePeriod);
mDay = stub.findViewById(R.id.day);
mDayName = stub.findViewById(R.id.dayname);
mMonth = stub.findViewById(R.id.month);
@ -286,7 +285,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
}
}
private boolean checkIsCharging() {
private boolean isCharging() {
IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = this.registerReceiver(null, iFilter);
int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
@ -490,7 +489,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
}
void setDataFieldsSimpleUi() {
if (sharedPrefs.getBoolean("simplify_ui_charging", false) && isCharging) {
if (sharedPrefs.getBoolean("simplify_ui_charging", false) && isCharging()) {
mSimpleUi.setVisibility(View.VISIBLE);
mSimpleSvg.setText(rawData.sSgv);
@ -519,6 +518,11 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
}
}
@Override
protected void on24HourFormatChanged(boolean is24HourFormat) {
setDateAndTime();
}
public void setDateAndTime() {
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
@ -527,8 +531,13 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
}
Date now = new Date();
SimpleDateFormat sdfHour = new SimpleDateFormat("HH");
SimpleDateFormat sdfHour;
SimpleDateFormat sdfMinute = new SimpleDateFormat("mm");
if (DateFormat.is24HourFormat(this)) {
sdfHour = new SimpleDateFormat("HH");
} else {
sdfHour = new SimpleDateFormat("hh");
}
sHour = sdfHour.format(now);
sMinute = sdfMinute.format(now);
@ -537,6 +546,16 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mMinute.setText(sMinute);
}
if(mTimePeriod != null) {
if (!DateFormat.is24HourFormat(this)) {
mTimePeriod.setVisibility(View.VISIBLE);
SimpleDateFormat sdfPeriod = new SimpleDateFormat("a");
mTimePeriod.setText(sdfPeriod.format(now).toUpperCase());
} else {
mTimePeriod.setVisibility(View.GONE);
}
}
if (mDate != null && mDay != null && mMonth != null) {
if (sharedPrefs.getBoolean("show_date", false)) {
if (mDayName != null) {

View file

@ -9,7 +9,6 @@
tools:context=".watchfaces.DigitalStyle"
tools:deviceIds="wear_square">
<!-- background-image with shapes elements-->
<LinearLayout
android:id="@+id/shapes_elements"
@ -265,7 +264,6 @@
android:layout_weight="13.95" />
</LinearLayout>
<!-- right side 5/8 width -->
<LinearLayout
android:layout_width="0dp"
@ -385,14 +383,13 @@
android:layout_height="0dp"
android:layout_weight="4"
android:gravity="left|center_vertical"
android:orientation="horizontal"
android:weightSum="1">
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="-5dp"
android:layout_weight="1">
android:layout_marginTop="-5dp">
<!-- hour -->
<TextView
android:id="@+id/hour"
@ -405,6 +402,13 @@
android:textColor="@color/white"
android:textSize="40sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<!-- minute -->
<TextView
@ -413,15 +417,27 @@
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6sp"
android:layout_marginBottom="-8sp"
android:fontFamily="@font/roboto_condensed_bold"
android:paddingTop="5sp"
android:text="MI"
android:textColor="@color/light_grey"
android:textSize="26sp"
android:textStyle="bold" />
<!-- 12h period AM / PM-->
<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="8sp"
android:fontFamily="@font/roboto_condensed_bold"
android:text="AM"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- right side 1/2 height - bottom halft -->
@ -549,7 +565,6 @@
android:visibility="gone" />
<!-- FLAGs -->
<TextView
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
@ -558,5 +573,4 @@
android:text=""
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>

View file

@ -9,7 +9,6 @@
tools:context=".watchfaces.DigitalStyle"
tools:deviceIds="wear_round">
<!-- background-image with shapes elements-->
<LinearLayout
android:id="@+id/shapes_elements"
@ -266,7 +265,6 @@
android:layout_weight="13.95" />
</LinearLayout>
<!-- right side 5/8 width -->
<LinearLayout
android:layout_width="0dp"
@ -386,14 +384,12 @@
android:layout_height="0dp"
android:layout_weight="4"
android:gravity="left|center_vertical"
android:orientation="horizontal"
android:weightSum="1">
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="-5dp"
android:layout_weight="1">
android:layout_marginTop="-5dp">
<!-- hour -->
<TextView
android:id="@+id/hour"
@ -406,6 +402,13 @@
android:textColor="@color/white"
android:textSize="40sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<!-- minute -->
<TextView
@ -414,15 +417,27 @@
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="6sp"
android:layout_marginBottom="-8sp"
android:fontFamily="@font/roboto_condensed_bold"
android:paddingTop="5sp"
android:text="MI"
android:textColor="@color/light_grey"
android:textSize="26sp"
android:textStyle="bold" />
<!-- 12h period AM / PM -->
<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8sp"
android:fontFamily="@font/roboto_condensed_bold"
android:gravity="top"
android:text="AM"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- right side 1/2 height - bottom halft -->
@ -549,8 +564,8 @@
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
<!-- FLAGs -->
<!-- FLAGs -->
<TextView
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
@ -559,4 +574,4 @@
android:text=""
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">bílá</string>
<string name="color_name_black">černá</string>
<string name="color_name_multicolor">multicolor</string>
<string name="pref_simplify_ui_charging">Zjednodušené rozhraní pro nabíjení</string>
<string name="pref_simplify_ui_charging_sum">Zobrazit pouze čas a glykémii při nabíjení</string>
<string name="pref_vibrate_hourly">Vibrovat každou hodinu</string>
<string name="pref_show_weeknumber">Zobrazit číslo týdne</string>
<string name="digitalstyle_pref_your_style">Váš styl:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">weiß</string>
<string name="color_name_black">schwarz</string>
<string name="color_name_multicolor">mehrfarbig</string>
<string name="pref_simplify_ui_charging">Ladeschnittstelle vereinfachen</string>
<string name="pref_simplify_ui_charging_sum">BZ und Zeit nur beim Laden anzeigen</string>
<string name="pref_vibrate_hourly">stündlich vibrieren</string>
<string name="pref_show_weeknumber">Kalenderwoche anzeigen</string>
<string name="digitalstyle_pref_your_style">Ihr Stil:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">Blanco</string>
<string name="color_name_black">Negro</string>
<string name="color_name_multicolor">Multicolor</string>
<string name="pref_simplify_ui_charging">Simplificar la interfaz de carga</string>
<string name="pref_simplify_ui_charging_sum">Sólo mostrar hora y glucosa cuando está cargando</string>
<string name="pref_vibrate_hourly">Vibrar cada hora</string>
<string name="pref_show_weeknumber">Mostrar número de semana</string>
<string name="digitalstyle_pref_your_style">Tu estilo:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">bianco</string>
<string name="color_name_black">nero</string>
<string name="color_name_multicolor">multicolore</string>
<string name="pref_simplify_ui_charging">Semplifica interfaccia di caricamento</string>
<string name="pref_simplify_ui_charging_sum">Mostra solo tempo e BG durante la carica</string>
<string name="pref_vibrate_hourly">Vibra a ogni ora</string>
<string name="pref_show_weeknumber">Mostra numero settimana</string>
<string name="digitalstyle_pref_your_style">Il tuo stile:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">לבן</string>
<string name="color_name_black">שחור</string>
<string name="color_name_multicolor">צבעוני</string>
<string name="pref_simplify_ui_charging">פשט את ממשק הטעינה</string>
<string name="pref_simplify_ui_charging_sum">מציג את השעה ואת רמת הסוכר בלבד בזמן טעינה</string>
<string name="pref_vibrate_hourly">רטט אחת לשעה</string>
<string name="pref_show_weeknumber">הצג מס\' שבוע</string>
<string name="digitalstyle_pref_your_style">הסגנון שלכם:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">wit</string>
<string name="color_name_black">zwart</string>
<string name="color_name_multicolor">multicolor</string>
<string name="pref_simplify_ui_charging">Vereenvoudig weergave tijdens opladen</string>
<string name="pref_simplify_ui_charging_sum">Toon alleen tijd en BG tijdens het opladen</string>
<string name="pref_vibrate_hourly">Tril ieder uur</string>
<string name="pref_show_weeknumber">Weeknummer weergeven</string>
<string name="digitalstyle_pref_your_style">Jouw stijl:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">hvit</string>
<string name="color_name_black">svart</string>
<string name="color_name_multicolor">flerfarget</string>
<string name="pref_simplify_ui_charging">Forenkle lader brukergrensesnittet</string>
<string name="pref_simplify_ui_charging_sum">Vis kun tid og BS ved lading</string>
<string name="pref_vibrate_hourly">Vibrer hver time</string>
<string name="pref_show_weeknumber">Vis ukenummer</string>
<string name="digitalstyle_pref_your_style">Din stil:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">biały</string>
<string name="color_name_black">czarny</string>
<string name="color_name_multicolor">wielokolorowy</string>
<string name="pref_simplify_ui_charging">Uprość przy ładowaniu</string>
<string name="pref_simplify_ui_charging_sum">Pokaż tylko czas i glikemię podczas ładowania</string>
<string name="pref_vibrate_hourly">Wibruj co godzinę</string>
<string name="pref_show_weeknumber">Pokaż numer tygodnia</string>
<string name="digitalstyle_pref_your_style">Styl:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">белый</string>
<string name="color_name_black">black</string>
<string name="color_name_multicolor">полихром</string>
<string name="pref_simplify_ui_charging">Упростить интерфейс зарядки</string>
<string name="pref_simplify_ui_charging_sum">При зарядке показывать только время и ГК</string>
<string name="pref_vibrate_hourly">Почасовая вибрация</string>
<string name="pref_show_weeknumber">Показывать номер недели</string>
<string name="digitalstyle_pref_your_style">Ваш стиль:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">biela</string>
<string name="color_name_black">čierna</string>
<string name="color_name_multicolor">viacfarebná</string>
<string name="pref_simplify_ui_charging">Zjednodušené rozhranie pre nabíjanie</string>
<string name="pref_simplify_ui_charging_sum">Zobrazovať pri nabíjaní iba čas a glykémiu</string>
<string name="pref_vibrate_hourly">Vibrovať každú hodinu</string>
<string name="pref_show_weeknumber">Zobraziť číslo týždňa</string>
<string name="digitalstyle_pref_your_style">Váš štýl:</string>

View file

@ -122,6 +122,8 @@
<string name="color_name_white">beyaz</string>
<string name="color_name_black">siyah</string>
<string name="color_name_multicolor">çok renkli</string>
<string name="pref_simplify_ui_charging">Basitleştirilmiş şarj arayüzü</string>
<string name="pref_simplify_ui_charging_sum">Yalnızca şarj olurken zamanı ve KŞ\'ni göster</string>
<string name="pref_vibrate_hourly">Saatlik titreşim</string>
<string name="pref_show_weeknumber">Hafta numarasını göster</string>
<string name="digitalstyle_pref_your_style">Stilin:</string>