Merge pull request #414 from Philoul/UpdateTranslator

Fix TT Reason in TTDialog and add TT Reason to Translator
This commit is contained in:
Milos Kozak 2021-03-16 18:17:41 +01:00 committed by GitHub
commit e2e060b9a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 8 deletions

View file

@ -186,10 +186,10 @@ class TempTargetDialog : DialogFragmentWithDate() {
timestamp = eventTime,
duration = TimeUnit.MINUTES.toMillis(duration.toLong()),
reason = when (reason) {
"Eating Soon" -> TemporaryTarget.Reason.EATING_SOON
"Activity" -> TemporaryTarget.Reason.ACTIVITY
"Hypo" -> TemporaryTarget.Reason.HYPOGLYCEMIA
else -> TemporaryTarget.Reason.CUSTOM
resourceHelper.gs(R.string.eatingsoon) -> TemporaryTarget.Reason.EATING_SOON
resourceHelper.gs(R.string.activity) -> TemporaryTarget.Reason.ACTIVITY
resourceHelper.gs(R.string.hypo) -> TemporaryTarget.Reason.HYPOGLYCEMIA
else -> TemporaryTarget.Reason.CUSTOM
},
lowTarget = Profile.toMgdl(target, profileFunction.getUnits()),
highTarget = Profile.toMgdl(target, profileFunction.getUnits())

View file

@ -32,6 +32,7 @@ import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsTempTar
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.extensions.friendlyDescription
@ -58,6 +59,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
@Inject lateinit var nsUpload: NSUpload
@Inject lateinit var uploadQueue: UploadQueue
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var translator: Translator
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var aapsSchedulers: AapsSchedulers
@ -167,7 +169,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
holder.binding.duration.text = resourceHelper.gs(R.string.format_mins, T.msecs(tempTarget.duration).mins())
holder.binding.low.text = tempTarget.lowValueToUnitsToString(units)
holder.binding.high.text = tempTarget.highValueToUnitsToString(units)
holder.binding.reason.text = tempTarget.reason.text
holder.binding.reason.text = translator.translate(tempTarget.reason.text)
holder.binding.date.setTextColor(
when {
tempTarget.id == currentlyActiveTarget?.id -> resourceHelper.gc(R.color.colorActive)

View file

@ -318,9 +318,6 @@
<string name="openapsama_useautosens">Use Autosens feature</string>
<string name="refresheventsfromnightscout">Refresh events from NS</string>
<string name="deletefuturetreatments">Delete treatments in the future</string>
<string name="eatingsoon">Eating Soon</string>
<string name="hypo">Hypo</string>
<string name="activity">Activity</string>
<string name="actions_shortname">ACT</string>
<string name="configbuilder_shortname">CONF</string>
<string name="loop_shortname">LOOP</string>

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.utils
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.utils.resources.ResourceHelper
import javax.inject.Inject
@ -40,6 +41,12 @@ class Translator @Inject internal constructor(
TherapyEvent.MeterType.FINGER.text -> resourceHelper.gs(R.string.glucosetype_finger)
TherapyEvent.MeterType.SENSOR.text -> resourceHelper.gs(R.string.glucosetype_sensor)
TherapyEvent.MeterType.MANUAL.text -> resourceHelper.gs(R.string.manual)
TemporaryTarget.Reason.CUSTOM.text -> resourceHelper.gs(R.string.custom)
TemporaryTarget.Reason.HYPOGLYCEMIA.text -> resourceHelper.gs(R.string.hypo)
TemporaryTarget.Reason.EATING_SOON.text -> resourceHelper.gs(R.string.eatingsoon)
TemporaryTarget.Reason.ACTIVITY.text -> resourceHelper.gs(R.string.activity)
TemporaryTarget.Reason.AUTOMATION.text -> resourceHelper.gs(R.string.automation)
TemporaryTarget.Reason.WEAR.text -> resourceHelper.gs(R.string.wear)
else -> resourceHelper.gs(R.string.unknown)
}
}

View file

@ -267,6 +267,12 @@
<string name="glucosetype_sensor">Sensor</string>
<string name="manual">Manual</string>
<string name="unknown">unknown</string>
<string name="eatingsoon">Eating Soon</string>
<string name="hypo">Hypo</string>
<string name="activity">Activity</string>
<string name="wear">Wear</string>
<string name="automation">Automation</string>
<string name="custom">Custom</string>
<!-- Command-->
<string name="connectiontimedout">Connection timed out</string>