diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt index fba505ffaa..8cece0c509 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodHistoryActivity.kt @@ -180,9 +180,8 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { return typeList } - internal class TypeList(entryGroup: PumpHistoryEntryGroup) { + internal class TypeList(val entryGroup: PumpHistoryEntryGroup) { - val entryGroup: PumpHistoryEntryGroup = entryGroup val name: String = entryGroup.translated ?: "XXX TODO" override fun toString(): String { @@ -190,9 +189,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { } } - inner class RecyclerViewAdapter internal constructor(historyList: List) : RecyclerView.Adapter() { - - var historyList: List = historyList + inner class RecyclerViewAdapter internal constructor(var historyList: List) : RecyclerView.Adapter() { override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): HistoryViewHolder { val v: View = LayoutInflater.from(viewGroup.context).inflate( @@ -204,7 +201,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { override fun onBindViewHolder(holder: HistoryViewHolder, position: Int) { val record: HistoryRecord = historyList[position] - record?.let { + record.let { holder.timeView.text = DateTimeUtil.toStringFromTimeInMillis(it.displayTimestamp()) setValue(it, holder.valueView) setType(it, holder.typeView) @@ -225,15 +222,15 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() { valueView.text = when (historyEntry.commandType) { OmnipodCommandType.SET_TEMPORARY_BASAL -> { val tbr = historyEntry.record as TempBasalRecord - tbr?.let { + tbr.let { resourceHelper.gs(R.string.omnipod_common_history_tbr_value, it.rate, it.duration) - } ?: "n/a" + } } OmnipodCommandType.SET_BOLUS -> { val bolus = historyEntry.record as BolusRecord - bolus?.let { + bolus.let { resourceHelper.gs(R.string.omnipod_common_history_bolus_value, it.amout) - } ?: "n/a" + } } OmnipodCommandType.SET_BASAL_PROFILE, OmnipodCommandType.SET_TIME,