Refactor UserEntry.Units and UserEntry.Actions translations (now included in Translator.kt)
=> Just missing TT_Reason included in #414
This commit is contained in:
parent
fcb3bfc6eb
commit
c08af324e2
4 changed files with 136 additions and 137 deletions
|
@ -111,7 +111,7 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
||||||
override fun onBindViewHolder(holder: UserEntryViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: UserEntryViewHolder, position: Int) {
|
||||||
val current = entries[position]
|
val current = entries[position]
|
||||||
holder.binding.date.text = dateUtil.dateAndTimeAndSecondsString(current.timestamp)
|
holder.binding.date.text = dateUtil.dateAndTimeAndSecondsString(current.timestamp)
|
||||||
holder.binding.action.text = resourceHelper.gs(current.action.stringId())
|
holder.binding.action.text = translator.translate(current.action.name)
|
||||||
holder.binding.action.setTextColor(resourceHelper.gc(current.action.colorGroup.colorId()))
|
holder.binding.action.setTextColor(resourceHelper.gc(current.action.colorGroup.colorId()))
|
||||||
if (current.s != "") {
|
if (current.s != "") {
|
||||||
holder.binding.s.text = current.s
|
holder.binding.s.text = current.s
|
||||||
|
@ -127,8 +127,9 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
||||||
else
|
else
|
||||||
when (v.unit) {
|
when (v.unit) {
|
||||||
Units.Timestamp -> valuesWithUnitString += dateUtil.dateAndTimeAndSecondsString(v.lValue) + separator
|
Units.Timestamp -> valuesWithUnitString += dateUtil.dateAndTimeAndSecondsString(v.lValue) + separator
|
||||||
Units.CPEvent -> valuesWithUnitString += translator.translate(v.sValue) + separator
|
Units.CPEvent -> valuesWithUnitString += translator.translate(v.sValue) + separator
|
||||||
Units.R_String -> {
|
Units.TT_Reason -> valuesWithUnitString += v.sValue + separator
|
||||||
|
Units.R_String -> {
|
||||||
rStringParam = v.lValue.toInt()
|
rStringParam = v.lValue.toInt()
|
||||||
when (rStringParam) { //
|
when (rStringParam) { //
|
||||||
0 -> valuesWithUnitString += resourceHelper.gs(v.iValue) + separator
|
0 -> valuesWithUnitString += resourceHelper.gs(v.iValue) + separator
|
||||||
|
@ -138,11 +139,13 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
||||||
4 -> rStringParam = 0
|
4 -> rStringParam = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Units.Mg_Dl -> valuesWithUnitString += if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue) + resourceHelper.gs(Units.Mg_Dl.stringId()) + separator else DecimalFormatter.to1Decimal(v.dValue/Constants.MMOLL_TO_MGDL) + resourceHelper.gs(Units.Mmol_L.stringId()) + separator
|
Units.Mg_Dl -> valuesWithUnitString += if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue) + translator.translate(Units.Mg_Dl.name) + separator else DecimalFormatter.to1Decimal(v.dValue/Constants.MMOLL_TO_MGDL) + translator.translate(Units.Mmol_L.name) + separator
|
||||||
Units.Mmol_L -> valuesWithUnitString += if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue*Constants.MMOLL_TO_MGDL) + resourceHelper.gs(Units.Mg_Dl.stringId()) + separator else DecimalFormatter.to1Decimal(v.dValue) + resourceHelper.gs(Units.Mmol_L.stringId()) + separator
|
Units.Mmol_L -> valuesWithUnitString += if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue*Constants.MMOLL_TO_MGDL) + translator.translate(Units.Mg_Dl.name) + separator else DecimalFormatter.to1Decimal(v.dValue) + translator.translate(Units.Mmol_L.name) + separator
|
||||||
Units.U_H, Units.U -> valuesWithUnitString += DecimalFormatter.to2Decimal(v.dValue) + resourceHelper.gs(v.unit.stringId()) + separator
|
Units.U_H, Units.U
|
||||||
Units.G, Units.M, Units.H, Units.Percent -> valuesWithUnitString += v.iValue.toString() + resourceHelper.gs(v.unit.stringId()) + separator
|
-> valuesWithUnitString += DecimalFormatter.to2Decimal(v.dValue) + translator.translate(v.unit.name) + separator
|
||||||
else -> valuesWithUnitString += if (v.iValue != 0 || v.sValue != "") { v.value().toString() + if (!v.unit.stringId().equals(0)) resourceHelper.gs(v.unit.stringId()) + separator else separator } else ""
|
Units.G, Units.M, Units.H, Units.Percent
|
||||||
|
-> valuesWithUnitString += v.iValue.toString() + translator.translate(v.unit.name) + separator
|
||||||
|
else -> valuesWithUnitString += if (v.iValue != 0 || v.sValue != "") { v.value().toString() + separator } else ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
holder.binding.values.text = valuesWithUnitString.trim()
|
holder.binding.values.text = valuesWithUnitString.trim()
|
||||||
|
|
|
@ -8,7 +8,6 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
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.Translator
|
import info.nightscout.androidaps.utils.Translator
|
||||||
import info.nightscout.androidaps.utils.extensions.stringId
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.storage.Storage
|
import info.nightscout.androidaps.utils.storage.Storage
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -96,7 +95,7 @@ class ClassicPrefsFormat @Inject constructor(
|
||||||
entry.timestamp.toString() + ";" +
|
entry.timestamp.toString() + ";" +
|
||||||
dateUtil.dateAndTimeAndSecondsString(entry.timestamp) + ";" +
|
dateUtil.dateAndTimeAndSecondsString(entry.timestamp) + ";" +
|
||||||
dateUtil.timeString(entry.utcOffset) + ";" +
|
dateUtil.timeString(entry.utcOffset) + ";" +
|
||||||
csvString(entry.action.stringId()) + ";" +
|
csvString(entry.action) + ";" +
|
||||||
csvString(entry.s) + ";" +
|
csvString(entry.s) + ";" +
|
||||||
valueWithUnitToCsv(value)
|
valueWithUnitToCsv(value)
|
||||||
}
|
}
|
||||||
|
@ -104,7 +103,7 @@ class ClassicPrefsFormat @Inject constructor(
|
||||||
entry.timestamp.toString() + ";" +
|
entry.timestamp.toString() + ";" +
|
||||||
dateUtil.dateAndTimeAndSecondsString(entry.timestamp) + ";" +
|
dateUtil.dateAndTimeAndSecondsString(entry.timestamp) + ";" +
|
||||||
dateUtil.timeString(entry.utcOffset) + ";" +
|
dateUtil.timeString(entry.utcOffset) + ";" +
|
||||||
csvString(entry.action.stringId()) + ";" +
|
csvString(entry.action) + ";" +
|
||||||
csvString(entry.s) + ";;"
|
csvString(entry.s) + ";;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,18 +113,21 @@ class ClassicPrefsFormat @Inject constructor(
|
||||||
return when (v.unit) {
|
return when (v.unit) {
|
||||||
Units.Timestamp -> dateUtil.dateAndTimeAndSecondsString(v.lValue) + ";" + csvString(R.string.date)
|
Units.Timestamp -> dateUtil.dateAndTimeAndSecondsString(v.lValue) + ";" + csvString(R.string.date)
|
||||||
Units.CPEvent -> csvString(translator.translate(v.sValue)) + ";"
|
Units.CPEvent -> csvString(translator.translate(v.sValue)) + ";"
|
||||||
|
Units.TT_Reason -> csvString(v.sValue) + ";"
|
||||||
Units.R_String -> if (v.lValue.toInt() == 0) csvString(v.iValue) + ";" else ";" //If lValue > 0 it's a formated string, so hidden for
|
Units.R_String -> if (v.lValue.toInt() == 0) csvString(v.iValue) + ";" else ";" //If lValue > 0 it's a formated string, so hidden for
|
||||||
Units.Mg_Dl -> if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue) + ";" + csvString(Units.Mg_Dl.stringId()) else DecimalFormatter.to1Decimal(v.dValue/Constants.MMOLL_TO_MGDL) + ";" + csvString(Units.Mmol_L.stringId())
|
Units.Mg_Dl -> if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue) + ";" + csvString(Units.Mg_Dl) else DecimalFormatter.to1Decimal(v.dValue/Constants.MMOLL_TO_MGDL) + ";" + csvString(Units.Mmol_L)
|
||||||
Units.Mmol_L -> if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue*Constants.MMOLL_TO_MGDL) + ";" + csvString(Units.Mg_Dl.stringId()) else DecimalFormatter.to1Decimal(v.dValue) + ";" + csvString(Units.Mmol_L.stringId())
|
Units.Mmol_L -> if (profileFunction.getUnits()==Constants.MGDL) DecimalFormatter.to0Decimal(v.dValue*Constants.MMOLL_TO_MGDL) + ";" + csvString(Units.Mg_Dl) else DecimalFormatter.to1Decimal(v.dValue) + ";" + csvString(Units.Mmol_L)
|
||||||
Units.U_H, Units.U -> DecimalFormatter.to2Decimal(v.dValue) + ";" + csvString(v.unit.stringId())
|
Units.U_H, Units.U -> DecimalFormatter.to2Decimal(v.dValue) + ";" + csvString(v.unit)
|
||||||
Units.G, Units.M, Units.H, Units.Percent
|
Units.G, Units.M, Units.H, Units.Percent
|
||||||
-> v.iValue.toString() + ";" + csvString(v.unit.stringId())
|
-> v.iValue.toString() + ";" + csvString(v.unit)
|
||||||
else -> if (v.sValue != "") { csvString(v.sValue) + ";" + csvString(v.unit.stringId())}
|
else -> if (v.sValue != "") { csvString(v.sValue) + ";" + csvString(v.unit)}
|
||||||
else if (v.iValue != 0) { v.iValue.toString() + ";" + csvString(v.unit.stringId())}
|
else if (v.iValue != 0) { v.iValue.toString() + ";" + csvString(v.unit)}
|
||||||
else ";"
|
else ";"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun csvString(action: Action): String = "\"" + translator.translate(action.name).replace("\"", "\"\"") + "\""
|
||||||
|
private fun csvString(unit: Units): String = "\"" + translator.translate(unit.name).replace("\"", "\"\"") + "\""
|
||||||
private fun csvString(id: Int): String = if (id != 0) "\"" + resourceHelper.gs(id).replace("\"", "\"\"") + "\"" else ""
|
private fun csvString(id: Int): String = if (id != 0) "\"" + resourceHelper.gs(id).replace("\"", "\"\"") + "\"" else ""
|
||||||
private fun csvString(s: String): String = if (s != "") "\"" + s.replace("\"", "\"\"") + "\"" else ""
|
private fun csvString(s: String): String = if (s != "") "\"" + s.replace("\"", "\"\"") + "\"" else ""
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.utils
|
||||||
|
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
|
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -40,6 +41,119 @@ class Translator @Inject internal constructor(
|
||||||
TherapyEvent.MeterType.FINGER.text -> resourceHelper.gs(R.string.glucosetype_finger)
|
TherapyEvent.MeterType.FINGER.text -> resourceHelper.gs(R.string.glucosetype_finger)
|
||||||
TherapyEvent.MeterType.SENSOR.text -> resourceHelper.gs(R.string.glucosetype_sensor)
|
TherapyEvent.MeterType.SENSOR.text -> resourceHelper.gs(R.string.glucosetype_sensor)
|
||||||
TherapyEvent.MeterType.MANUAL.text -> resourceHelper.gs(R.string.manual)
|
TherapyEvent.MeterType.MANUAL.text -> resourceHelper.gs(R.string.manual)
|
||||||
|
|
||||||
|
Action.BOLUS.name -> resourceHelper.gs(R.string.uel_bolus)
|
||||||
|
Action.BOLUS_WIZARD.name -> resourceHelper.gs(R.string.uel_bolus_wizard)
|
||||||
|
Action.BOLUS_ADVISOR.name -> resourceHelper.gs(R.string.uel_bolus_advisor)
|
||||||
|
Action.BOLUS_RECORD.name -> resourceHelper.gs(R.string.uel_bolus_record)
|
||||||
|
Action.EXTENDED_BOLUS.name -> resourceHelper.gs(R.string.uel_extended_bolus)
|
||||||
|
Action.SUPERBOLUS_TBR.name -> resourceHelper.gs(R.string.uel_superbolus_tbr)
|
||||||
|
Action.CARBS.name -> resourceHelper.gs(R.string.uel_carbs)
|
||||||
|
Action.EXTENDED_CARBS.name -> resourceHelper.gs(R.string.uel_extended_carbs)
|
||||||
|
Action.TEMP_BASAL.name -> resourceHelper.gs(R.string.uel_temp_basal)
|
||||||
|
Action.TT.name -> resourceHelper.gs(R.string.uel_tt)
|
||||||
|
Action.TT_ACTIVITY.name -> resourceHelper.gs(R.string.uel_tt_activity)
|
||||||
|
Action.TT_EATING_SOON.name -> resourceHelper.gs(R.string.uel_tt_eating_soon)
|
||||||
|
Action.TT_HYPO.name -> resourceHelper.gs(R.string.uel_tt_hypo)
|
||||||
|
Action.NEW_PROFILE.name -> resourceHelper.gs(R.string.uel_new_profile)
|
||||||
|
Action.CLONE_PROFILE.name -> resourceHelper.gs(R.string.uel_clone_profile)
|
||||||
|
Action.STORE_PROFILE.name -> resourceHelper.gs(R.string.uel_store_profile)
|
||||||
|
Action.PROFILE_SWITCH.name -> resourceHelper.gs(R.string.uel_profile_switch)
|
||||||
|
Action.PROFILE_SWITCH_CLONED.name -> resourceHelper.gs(R.string.uel_profile_switch_cloned)
|
||||||
|
Action.CLOSED_LOOP_MODE.name -> resourceHelper.gs(R.string.uel_closed_loop_mode)
|
||||||
|
Action.LGS_LOOP_MODE.name -> resourceHelper.gs(R.string.uel_lgs_loop_mode)
|
||||||
|
Action.OPEN_LOOP_MODE.name -> resourceHelper.gs(R.string.uel_open_loop_mode)
|
||||||
|
Action.LOOP_DISABLED.name -> resourceHelper.gs(R.string.uel_loop_disabled)
|
||||||
|
Action.LOOP_ENABLED.name -> resourceHelper.gs(R.string.uel_loop_enabled)
|
||||||
|
Action.RECONNECT.name -> resourceHelper.gs(R.string.uel_reconnect)
|
||||||
|
Action.DISCONNECT_15M.name -> resourceHelper.gs(R.string.uel_disconnect_15m)
|
||||||
|
Action.DISCONNECT_30M.name -> resourceHelper.gs(R.string.uel_disconnect_30m)
|
||||||
|
Action.DISCONNECT_1H.name -> resourceHelper.gs(R.string.uel_disconnect_1h)
|
||||||
|
Action.DISCONNECT_2H.name -> resourceHelper.gs(R.string.uel_disconnect_2h)
|
||||||
|
Action.DISCONNECT_3H.name -> resourceHelper.gs(R.string.uel_disconnect_3h)
|
||||||
|
Action.RESUME.name -> resourceHelper.gs(R.string.uel_resume)
|
||||||
|
Action.SUSPEND_1H.name -> resourceHelper.gs(R.string.uel_suspend_1h)
|
||||||
|
Action.SUSPEND_2H.name -> resourceHelper.gs(R.string.uel_suspend_2h)
|
||||||
|
Action.SUSPEND_3H.name -> resourceHelper.gs(R.string.uel_suspend_3h)
|
||||||
|
Action.SUSPEND_10H.name -> resourceHelper.gs(R.string.uel_suspend_10h)
|
||||||
|
Action.HW_PUMP_ALLOWED.name -> resourceHelper.gs(R.string.uel_hw_pump_allowed)
|
||||||
|
Action.CLEAR_PAIRING_KEYS.name -> resourceHelper.gs(R.string.uel_clear_pairing_keys)
|
||||||
|
Action.ACCEPTS_TEMP_BASAL.name -> resourceHelper.gs(R.string.uel_accepts_temp_basal)
|
||||||
|
Action.CANCEL_TEMP_BASAL.name -> resourceHelper.gs(R.string.uel_cancel_temp_basal)
|
||||||
|
Action.CANCEL_EXTENDED_BOLUS.name -> resourceHelper.gs(R.string.uel_cancel_extended_bolus)
|
||||||
|
Action.CANCEL_TT.name -> resourceHelper.gs(R.string.uel_cancel_tt)
|
||||||
|
Action.CAREPORTAL.name -> resourceHelper.gs(R.string.uel_careportal)
|
||||||
|
Action.CALIBRATION.name -> resourceHelper.gs(R.string.uel_calibration)
|
||||||
|
Action.INSULIN_CHANGE.name -> resourceHelper.gs(R.string.uel_insulin_change)
|
||||||
|
Action.PRIME_BOLUS.name -> resourceHelper.gs(R.string.uel_prime_bolus)
|
||||||
|
Action.SITE_CHANGE.name -> resourceHelper.gs(R.string.uel_site_change)
|
||||||
|
Action.TREATMENT.name -> resourceHelper.gs(R.string.uel_treatment)
|
||||||
|
Action.CAREPORTAL_NS_REFRESH.name -> resourceHelper.gs(R.string.uel_careportal_ns_refresh)
|
||||||
|
Action.PROFILE_SWITCH_NS_REFRESH.name -> resourceHelper.gs(R.string.uel_profile_switch_ns_refresh)
|
||||||
|
Action.TREATMENTS_NS_REFRESH.name -> resourceHelper.gs(R.string.uel_treatments_ns_refresh)
|
||||||
|
Action.TT_NS_REFRESH.name -> resourceHelper.gs(R.string.uel_tt_ns_refresh)
|
||||||
|
Action.AUTOMATION_REMOVED.name -> resourceHelper.gs(R.string.uel_automation_removed)
|
||||||
|
Action.BG_REMOVED.name -> resourceHelper.gs(R.string.uel_bg_removed)
|
||||||
|
Action.CAREPORTAL_REMOVED.name -> resourceHelper.gs(R.string.uel_careportal_removed)
|
||||||
|
Action.EXTENDED_BOLUS_REMOVED.name -> resourceHelper.gs(R.string.uel_extended_bolus_removed)
|
||||||
|
Action.FOOD_REMOVED.name -> resourceHelper.gs(R.string.uel_food_removed)
|
||||||
|
Action.PROFILE_REMOVED.name -> resourceHelper.gs(R.string.uel_profile_removed)
|
||||||
|
Action.PROFILE_SWITCH_REMOVED.name -> resourceHelper.gs(R.string.uel_profile_switch_removed)
|
||||||
|
Action.RESTART_EVENTS_REMOVED.name -> resourceHelper.gs(R.string.uel_restart_events_removed)
|
||||||
|
Action.TREATMENT_REMOVED.name -> resourceHelper.gs(R.string.uel_treatment_removed)
|
||||||
|
Action.TT_REMOVED.name -> resourceHelper.gs(R.string.uel_tt_removed)
|
||||||
|
Action.NS_PAUSED.name -> resourceHelper.gs(R.string.uel_ns_paused)
|
||||||
|
Action.NS_RESUME.name -> resourceHelper.gs(R.string.uel_ns_resume)
|
||||||
|
Action.NS_QUEUE_CLEARED.name -> resourceHelper.gs(R.string.uel_ns_queue_cleared)
|
||||||
|
Action.NS_SETTINGS_COPIED.name -> resourceHelper.gs(R.string.uel_ns_settings_copied)
|
||||||
|
Action.ERROR_DIALOG_OK.name -> resourceHelper.gs(R.string.uel_error_dialog_ok)
|
||||||
|
Action.ERROR_DIALOG_MUTE.name -> resourceHelper.gs(R.string.uel_error_dialog_mute)
|
||||||
|
Action.ERROR_DIALOG_MUTE_5MIN.name -> resourceHelper.gs(R.string.uel_error_dialog_mute_5min)
|
||||||
|
Action.OBJECTIVE_STARTED.name -> resourceHelper.gs(R.string.uel_objective_started)
|
||||||
|
Action.OBJECTIVE_UNSTARTED.name -> resourceHelper.gs(R.string.uel_objective_unstarted)
|
||||||
|
Action.OBJECTIVES_SKIPPED.name -> resourceHelper.gs(R.string.uel_objectives_skipped)
|
||||||
|
Action.STAT_RESET.name -> resourceHelper.gs(R.string.uel_stat_reset)
|
||||||
|
Action.DELETE_LOGS.name -> resourceHelper.gs(R.string.uel_delete_logs)
|
||||||
|
Action.DELETE_FUTURE_TREATMENTS.name -> resourceHelper.gs(R.string.uel_delete_future_treatments)
|
||||||
|
Action.EXPORT_SETTINGS.name -> resourceHelper.gs(R.string.uel_export_settings)
|
||||||
|
Action.IMPORT_SETTINGS.name -> resourceHelper.gs(R.string.uel_import_settings)
|
||||||
|
Action.RESET_DATABASES.name -> resourceHelper.gs(R.string.uel_reset_databases)
|
||||||
|
Action.EXPORT_DATABASES.name -> resourceHelper.gs(R.string.uel_export_databases)
|
||||||
|
Action.IMPORT_DATABASES.name -> resourceHelper.gs(R.string.uel_import_databases)
|
||||||
|
Action.OTP_EXPORT.name -> resourceHelper.gs(R.string.uel_otp_export)
|
||||||
|
Action.OTP_RESET.name -> resourceHelper.gs(R.string.uel_otp_reset)
|
||||||
|
Action.SMS_BASAL.name -> resourceHelper.gs(R.string.uel_sms_basal)
|
||||||
|
Action.SMS_BOLUS.name -> resourceHelper.gs(R.string.uel_sms_bolus)
|
||||||
|
Action.SMS_CAL.name -> resourceHelper.gs(R.string.uel_sms_cal)
|
||||||
|
Action.SMS_CARBS.name -> resourceHelper.gs(R.string.uel_sms_carbs)
|
||||||
|
Action.SMS_EXTENDED_BOLUS.name -> resourceHelper.gs(R.string.uel_sms_extended_bolus)
|
||||||
|
Action.SMS_LOOP_DISABLED.name -> resourceHelper.gs(R.string.uel_sms_loop_disabled)
|
||||||
|
Action.SMS_LOOP_ENABLED.name -> resourceHelper.gs(R.string.uel_sms_loop_enabled)
|
||||||
|
Action.SMS_LOOP_RESUME.name -> resourceHelper.gs(R.string.uel_sms_loop_resume)
|
||||||
|
Action.SMS_LOOP_SUSPEND.name -> resourceHelper.gs(R.string.uel_sms_loop_suspend)
|
||||||
|
Action.SMS_PROFILE.name -> resourceHelper.gs(R.string.uel_sms_profile)
|
||||||
|
Action.SMS_PUMP_CONNECT.name -> resourceHelper.gs(R.string.uel_sms_pump_connect)
|
||||||
|
Action.SMS_PUMP_DISCONNECT.name -> resourceHelper.gs(R.string.uel_sms_pump_disconnect)
|
||||||
|
Action.SMS_SMS.name -> resourceHelper.gs(R.string.uel_sms_sms)
|
||||||
|
Action.SMS_TT.name -> resourceHelper.gs(R.string.uel_sms_tt)
|
||||||
|
Action.TT_DELETED_FROM_NS.name -> resourceHelper.gs(R.string.uel_tt_deleted_from_ns)
|
||||||
|
Action.TT_FROM_NS.name -> resourceHelper.gs(R.string.uel_tt_from_ns)
|
||||||
|
Action.TT_CANCELED_FROM_NS.name -> resourceHelper.gs(R.string.uel_tt_canceleted_from_ns)
|
||||||
|
Action.CAREPORTAL_DELETED_FROM_NS.name -> resourceHelper.gs(R.string.uel_careportal_deleted_from_ns)
|
||||||
|
Action.CAREPORTAL_FROM_NS.name -> resourceHelper.gs(R.string.uel_careportal_from_ns)
|
||||||
|
Action.EXPORT_CSV.name -> resourceHelper.gs(R.string.uel_export_csv)
|
||||||
|
|
||||||
|
Units.Mg_Dl.name -> resourceHelper.gs(R.string.mgdl)
|
||||||
|
Units.Mmol_L.name -> resourceHelper.gs(R.string.mmol)
|
||||||
|
Units.U.name -> resourceHelper.gs(R.string.insulin_unit_shortname)
|
||||||
|
Units.U_H.name -> resourceHelper.gs(R.string.profile_ins_units_per_hour)
|
||||||
|
Units.G.name -> resourceHelper.gs(R.string.shortgram)
|
||||||
|
Units.M.name -> resourceHelper.gs(R.string.shortminute)
|
||||||
|
Units.H.name -> resourceHelper.gs(R.string.shorthour)
|
||||||
|
Units.Percent.name -> resourceHelper.gs(R.string.shortpercent)
|
||||||
|
Units.None.name -> ""
|
||||||
|
|
||||||
else -> resourceHelper.gs(R.string.unknown)
|
else -> resourceHelper.gs(R.string.unknown)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,112 +3,6 @@ package info.nightscout.androidaps.utils.extensions
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||||
|
|
||||||
fun Action.stringId(): Int {
|
|
||||||
return when (this) {
|
|
||||||
Action.BOLUS -> R.string.uel_bolus
|
|
||||||
Action.BOLUS_WIZARD -> R.string.uel_bolus_wizard
|
|
||||||
Action.BOLUS_ADVISOR -> R.string.uel_bolus_advisor
|
|
||||||
Action.BOLUS_RECORD -> R.string.uel_bolus_record
|
|
||||||
Action.EXTENDED_BOLUS -> R.string.uel_extended_bolus
|
|
||||||
Action.SUPERBOLUS_TBR -> R.string.uel_superbolus_tbr
|
|
||||||
Action.CARBS -> R.string.uel_carbs
|
|
||||||
Action.EXTENDED_CARBS -> R.string.uel_extended_carbs
|
|
||||||
Action.TEMP_BASAL -> R.string.uel_temp_basal
|
|
||||||
Action.TT -> R.string.uel_tt
|
|
||||||
Action.TT_ACTIVITY -> R.string.uel_tt_activity
|
|
||||||
Action.TT_EATING_SOON -> R.string.uel_tt_eating_soon
|
|
||||||
Action.TT_HYPO -> R.string.uel_tt_hypo
|
|
||||||
Action.NEW_PROFILE -> R.string.uel_new_profile
|
|
||||||
Action.CLONE_PROFILE -> R.string.uel_clone_profile
|
|
||||||
Action.STORE_PROFILE -> R.string.uel_store_profile
|
|
||||||
Action.PROFILE_SWITCH -> R.string.uel_profile_switch
|
|
||||||
Action.PROFILE_SWITCH_CLONED -> R.string.uel_profile_switch_cloned
|
|
||||||
Action.CLOSED_LOOP_MODE -> R.string.uel_closed_loop_mode
|
|
||||||
Action.LGS_LOOP_MODE -> R.string.uel_lgs_loop_mode
|
|
||||||
Action.OPEN_LOOP_MODE -> R.string.uel_open_loop_mode
|
|
||||||
Action.LOOP_DISABLED -> R.string.uel_loop_disabled
|
|
||||||
Action.LOOP_ENABLED -> R.string.uel_loop_enabled
|
|
||||||
Action.RECONNECT -> R.string.uel_reconnect
|
|
||||||
Action.DISCONNECT_15M -> R.string.uel_disconnect_15m
|
|
||||||
Action.DISCONNECT_30M -> R.string.uel_disconnect_30m
|
|
||||||
Action.DISCONNECT_1H -> R.string.uel_disconnect_1h
|
|
||||||
Action.DISCONNECT_2H -> R.string.uel_disconnect_2h
|
|
||||||
Action.DISCONNECT_3H -> R.string.uel_disconnect_3h
|
|
||||||
Action.RESUME -> R.string.uel_resume
|
|
||||||
Action.SUSPEND_1H -> R.string.uel_suspend_1h
|
|
||||||
Action.SUSPEND_2H -> R.string.uel_suspend_2h
|
|
||||||
Action.SUSPEND_3H -> R.string.uel_suspend_3h
|
|
||||||
Action.SUSPEND_10H -> R.string.uel_suspend_10h
|
|
||||||
Action.HW_PUMP_ALLOWED -> R.string.uel_hw_pump_allowed
|
|
||||||
Action.CLEAR_PAIRING_KEYS -> R.string.uel_clear_pairing_keys
|
|
||||||
Action.ACCEPTS_TEMP_BASAL -> R.string.uel_accepts_temp_basal
|
|
||||||
Action.CANCEL_TEMP_BASAL -> R.string.uel_cancel_temp_basal
|
|
||||||
Action.CANCEL_EXTENDED_BOLUS -> R.string.uel_cancel_extended_bolus
|
|
||||||
Action.CANCEL_TT -> R.string.uel_cancel_tt
|
|
||||||
Action.CAREPORTAL -> R.string.uel_careportal
|
|
||||||
Action.CALIBRATION -> R.string.uel_calibration
|
|
||||||
Action.INSULIN_CHANGE -> R.string.uel_insulin_change
|
|
||||||
Action.PRIME_BOLUS -> R.string.uel_prime_bolus
|
|
||||||
Action.SITE_CHANGE -> R.string.uel_site_change
|
|
||||||
Action.TREATMENT -> R.string.uel_treatment
|
|
||||||
Action.CAREPORTAL_NS_REFRESH -> R.string.uel_careportal_ns_refresh
|
|
||||||
Action.PROFILE_SWITCH_NS_REFRESH -> R.string.uel_profile_switch_ns_refresh
|
|
||||||
Action.TREATMENTS_NS_REFRESH -> R.string.uel_treatments_ns_refresh
|
|
||||||
Action.TT_NS_REFRESH -> R.string.uel_tt_ns_refresh
|
|
||||||
Action.AUTOMATION_REMOVED -> R.string.uel_automation_removed
|
|
||||||
Action.BG_REMOVED -> R.string.uel_bg_removed
|
|
||||||
Action.CAREPORTAL_REMOVED -> R.string.uel_careportal_removed
|
|
||||||
Action.EXTENDED_BOLUS_REMOVED -> R.string.uel_extended_bolus_removed
|
|
||||||
Action.FOOD_REMOVED -> R.string.uel_food_removed
|
|
||||||
Action.PROFILE_REMOVED -> R.string.uel_profile_removed
|
|
||||||
Action.PROFILE_SWITCH_REMOVED -> R.string.uel_profile_switch_removed
|
|
||||||
Action.RESTART_EVENTS_REMOVED -> R.string.uel_restart_events_removed
|
|
||||||
Action.TREATMENT_REMOVED -> R.string.uel_treatment_removed
|
|
||||||
Action.TT_REMOVED -> R.string.uel_tt_removed
|
|
||||||
Action.NS_PAUSED -> R.string.uel_ns_paused
|
|
||||||
Action.NS_RESUME -> R.string.uel_ns_resume
|
|
||||||
Action.NS_QUEUE_CLEARED -> R.string.uel_ns_queue_cleared
|
|
||||||
Action.NS_SETTINGS_COPIED -> R.string.uel_ns_settings_copied
|
|
||||||
Action.ERROR_DIALOG_OK -> R.string.uel_error_dialog_ok
|
|
||||||
Action.ERROR_DIALOG_MUTE -> R.string.uel_error_dialog_mute
|
|
||||||
Action.ERROR_DIALOG_MUTE_5MIN -> R.string.uel_error_dialog_mute_5min
|
|
||||||
Action.OBJECTIVE_STARTED -> R.string.uel_objective_started
|
|
||||||
Action.OBJECTIVE_UNSTARTED -> R.string.uel_objective_unstarted
|
|
||||||
Action.OBJECTIVES_SKIPPED -> R.string.uel_objectives_skipped
|
|
||||||
Action.STAT_RESET -> R.string.uel_stat_reset
|
|
||||||
Action.DELETE_LOGS -> R.string.uel_delete_logs
|
|
||||||
Action.DELETE_FUTURE_TREATMENTS -> R.string.uel_delete_future_treatments
|
|
||||||
Action.EXPORT_SETTINGS -> R.string.uel_export_settings
|
|
||||||
Action.IMPORT_SETTINGS -> R.string.uel_import_settings
|
|
||||||
Action.RESET_DATABASES -> R.string.uel_reset_databases
|
|
||||||
Action.EXPORT_DATABASES -> R.string.uel_export_databases
|
|
||||||
Action.IMPORT_DATABASES -> R.string.uel_import_databases
|
|
||||||
Action.OTP_EXPORT -> R.string.uel_otp_export
|
|
||||||
Action.OTP_RESET -> R.string.uel_otp_reset
|
|
||||||
Action.SMS_BASAL -> R.string.uel_sms_basal
|
|
||||||
Action.SMS_BOLUS -> R.string.uel_sms_bolus
|
|
||||||
Action.SMS_CAL -> R.string.uel_sms_cal
|
|
||||||
Action.SMS_CARBS -> R.string.uel_sms_carbs
|
|
||||||
Action.SMS_EXTENDED_BOLUS -> R.string.uel_sms_extended_bolus
|
|
||||||
Action.SMS_LOOP_DISABLED -> R.string.uel_sms_loop_disabled
|
|
||||||
Action.SMS_LOOP_ENABLED -> R.string.uel_sms_loop_enabled
|
|
||||||
Action.SMS_LOOP_RESUME -> R.string.uel_sms_loop_resume
|
|
||||||
Action.SMS_LOOP_SUSPEND -> R.string.uel_sms_loop_suspend
|
|
||||||
Action.SMS_PROFILE -> R.string.uel_sms_profile
|
|
||||||
Action.SMS_PUMP_CONNECT -> R.string.uel_sms_pump_connect
|
|
||||||
Action.SMS_PUMP_DISCONNECT -> R.string.uel_sms_pump_disconnect
|
|
||||||
Action.SMS_SMS -> R.string.uel_sms_sms
|
|
||||||
Action.SMS_TT -> R.string.uel_sms_tt
|
|
||||||
Action.TT_DELETED_FROM_NS -> R.string.uel_tt_deleted_from_ns
|
|
||||||
Action.TT_FROM_NS -> R.string.uel_tt_from_ns
|
|
||||||
Action.TT_CANCELED_FROM_NS -> R.string.uel_tt_canceleted_from_ns
|
|
||||||
Action.CAREPORTAL_DELETED_FROM_NS -> R.string.uel_careportal_deleted_from_ns
|
|
||||||
Action.CAREPORTAL_FROM_NS -> R.string.uel_careportal_from_ns
|
|
||||||
Action.EXPORT_CSV -> R.string.uel_export_csv
|
|
||||||
else -> R.string.uel_unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ColorGroup.colorId(): Int {
|
fun ColorGroup.colorId(): Int {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
ColorGroup.InsulinTreatment -> R.color.basal
|
ColorGroup.InsulinTreatment -> R.color.basal
|
||||||
|
@ -123,17 +17,3 @@ fun ColorGroup.colorId(): Int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Units.stringId(): Int {
|
|
||||||
return when (this) {
|
|
||||||
Units.Mg_Dl -> R.string.mgdl
|
|
||||||
Units.Mmol_L -> R.string.mmol
|
|
||||||
Units.U -> R.string.insulin_unit_shortname
|
|
||||||
Units.U_H -> R.string.profile_ins_units_per_hour
|
|
||||||
Units.G -> R.string.shortgram
|
|
||||||
Units.M -> R.string.shortminute
|
|
||||||
Units.H -> R.string.shorthour
|
|
||||||
Units.Percent -> R.string.shortpercent
|
|
||||||
Units.R_String -> R.string.formated_string
|
|
||||||
else -> 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue