Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
7bb2f446b7
2 changed files with 20 additions and 1 deletions
|
@ -72,7 +72,7 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sumLabel(): String {
|
private fun sumLabel(): String {
|
||||||
val profile = localProfilePlugin.profile?.getDefaultProfile()
|
val profile = localProfilePlugin.getEditProfile()
|
||||||
val sum = profile?.let { ProfileSealed.Pure(profile).baseBasalSum() } ?: 0.0
|
val sum = profile?.let { ProfileSealed.Pure(profile).baseBasalSum() } ?: 0.0
|
||||||
return " ∑" + DecimalFormatter.to2Decimal(sum) + resourceHelper.gs(R.string.insulin_unit_shortname)
|
return " ∑" + DecimalFormatter.to2Decimal(sum) + resourceHelper.gs(R.string.insulin_unit_shortname)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.androidaps.data.PureProfile
|
import info.nightscout.androidaps.data.PureProfile
|
||||||
import info.nightscout.androidaps.events.EventProfileStoreChanged
|
import info.nightscout.androidaps.events.EventProfileStoreChanged
|
||||||
import info.nightscout.androidaps.extensions.blockFromJsonArray
|
import info.nightscout.androidaps.extensions.blockFromJsonArray
|
||||||
|
import info.nightscout.androidaps.extensions.pureProfileFromJson
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
|
@ -21,6 +22,7 @@ import info.nightscout.androidaps.receivers.DataWorker
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import info.nightscout.androidaps.utils.HardLimits
|
import info.nightscout.androidaps.utils.HardLimits
|
||||||
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
|
@ -123,6 +125,23 @@ class LocalProfilePlugin @Inject constructor(
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getEditProfile(): PureProfile? {
|
||||||
|
val profile = JSONObject()
|
||||||
|
with(profiles[currentProfileIndex]) {
|
||||||
|
profile.put("dia", dia)
|
||||||
|
profile.put("carbratio", ic)
|
||||||
|
profile.put("sens", isf)
|
||||||
|
profile.put("basal", basal)
|
||||||
|
profile.put("target_low", targetLow)
|
||||||
|
profile.put("target_high", targetHigh)
|
||||||
|
profile.put("units", if (mgdl) Constants.MGDL else Constants.MMOL)
|
||||||
|
profile.put("timezone", TimeZone.getDefault().id)
|
||||||
|
}
|
||||||
|
val defaultUnits = JsonHelper.safeGetStringAllowNull(profile, "units", null)
|
||||||
|
return pureProfileFromJson(profile, dateUtil, defaultUnits)
|
||||||
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun storeSettings(activity: FragmentActivity? = null) {
|
fun storeSettings(activity: FragmentActivity? = null) {
|
||||||
for (i in 0 until numOfProfiles) {
|
for (i in 0 until numOfProfiles) {
|
||||||
|
|
Loading…
Reference in a new issue