Start implementation of Source
This commit is contained in:
parent
0d68290a8c
commit
c3d593f7ae
2 changed files with 24 additions and 3 deletions
|
@ -111,8 +111,7 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
|||
override fun onBindViewHolder(holder: UserEntryViewHolder, position: Int) {
|
||||
val current = entries[position]
|
||||
holder.binding.date.text = dateUtil.dateAndTimeAndSecondsString(current.timestamp)
|
||||
holder.binding.action.text = translator.translate(current.action.name)
|
||||
holder.binding.action.setTextColor(resourceHelper.gc(current.action.colorGroup.colorId()))
|
||||
|
||||
if (current.s != "") {
|
||||
holder.binding.s.text = current.s
|
||||
holder.binding.s.visibility = View.VISIBLE
|
||||
|
@ -121,6 +120,7 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
|||
var valuesWithUnitString = ""
|
||||
var rStringParam = 0
|
||||
val separator = " "
|
||||
var source = ""
|
||||
for(v in current.values) {
|
||||
if (rStringParam >0)
|
||||
rStringParam--
|
||||
|
@ -144,11 +144,14 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
|||
-> valuesWithUnitString += DecimalFormatter.to2Decimal(v.dValue) + translator.translate(v.unit.name) + separator
|
||||
Units.G, Units.M, Units.H, Units.Percent
|
||||
-> valuesWithUnitString += v.iValue.toString() + translator.translate(v.unit.name) + separator
|
||||
Units.Source -> source = separator + translator.translate(v.sValue)
|
||||
else -> valuesWithUnitString += if (v.iValue != 0 || v.sValue != "") { v.value().toString() + separator } else ""
|
||||
}
|
||||
}
|
||||
holder.binding.values.text = valuesWithUnitString.trim()
|
||||
holder.binding.values.visibility = if (current.values.size > 0) View.VISIBLE else View.GONE
|
||||
holder.binding.action.text = translator.translate(current.action.name) + source
|
||||
holder.binding.action.setTextColor(resourceHelper.gc(current.action.colorGroup.colorId()))
|
||||
}
|
||||
|
||||
inner class UserEntryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
|
|
@ -141,7 +141,8 @@ data class UserEntry(
|
|||
@SerializedName("H") H ("h"), //Int
|
||||
@SerializedName("Percent") Percent ("%"), //Int
|
||||
@SerializedName("TherapyEvent") TherapyEvent ("TherapyEvent"), //String (All enum key translated by Translator function, mainly TherapyEvent)
|
||||
@SerializedName("R_String") R_String ("R.string") //Int
|
||||
@SerializedName("R_String") R_String ("R.string"), //Int
|
||||
@SerializedName("Source") Source ("Source") //String
|
||||
;
|
||||
|
||||
companion object {
|
||||
|
@ -149,6 +150,23 @@ data class UserEntry(
|
|||
fun fromText(unit: String?) = values().firstOrNull { it.text == unit } ?: None
|
||||
}
|
||||
}
|
||||
enum class Sources(val text: String) {
|
||||
@SerializedName("Manual") Manual ("Manual"), //Manual entry by user, given through AAPS (default)
|
||||
@SerializedName("External") External ("External"), //Manual entry by user, treatment given outside AAPS (for example Bolus with Serynge)
|
||||
@SerializedName("Automation") Automation ("Automation"), //From Automation plugin
|
||||
@SerializedName("Loop") Loop ("Loop"), //From Loop plugin
|
||||
@SerializedName("NS") NS ("NS"), //From NSClient plugin
|
||||
@SerializedName("Pump") Pump ("Pump"), //From Pump plugin (for example from pump history)
|
||||
@SerializedName("SMS") SMS ("SMS"), //From SMS plugin
|
||||
@SerializedName("Wear") Wear ("Wear"), //From Wear plugin
|
||||
@SerializedName("Unknown") Unknown ("Unknown") //if necessary
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun fromString(source: String?) = values().firstOrNull { it.name == source } ?: Unknown
|
||||
fun fromText(source: String?) = values().firstOrNull { it.text == source } ?: Unknown
|
||||
}
|
||||
}
|
||||
|
||||
enum class ColorGroup() {
|
||||
InsulinTreatment,
|
||||
|
|
Loading…
Reference in a new issue