display the correct time. display type
This commit is contained in:
parent
abfd71a4b8
commit
6cd06edd29
4 changed files with 16 additions and 4 deletions
|
@ -49,7 +49,7 @@ class DashHistory @Inject constructor(
|
|||
@Suppress("ReturnCount")
|
||||
fun createRecord(
|
||||
commandType: OmnipodCommandType,
|
||||
date: Long = System.currentTimeMillis(),
|
||||
date: Long = currentTimeMillis(),
|
||||
initialResult: InitialResult = InitialResult.NOT_SENT,
|
||||
tempBasalRecord: TempBasalRecord? = null,
|
||||
bolusRecord: BolusRecord? = null,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data
|
||||
|
||||
enum class InitialResult {
|
||||
NOT_SENT, FAILURE_SENDING, UNCONFIRMED, SENT
|
||||
NOT_SENT, FAILURE_SENDING, SENT
|
||||
}
|
||||
|
||||
enum class ResolvedResult {
|
||||
|
|
|
@ -20,4 +20,15 @@ data class HistoryRecordEntity(
|
|||
@Embedded(prefix = "bolusRecord_") val bolusRecord: BolusRecord?,
|
||||
val resolvedResult: ResolvedResult?,
|
||||
val resolvedAt: Long?
|
||||
)
|
||||
) {
|
||||
fun displayTimestamp(): Long {
|
||||
resolvedAt?.let {
|
||||
return it
|
||||
}
|
||||
return date
|
||||
}
|
||||
|
||||
fun isSuccess(): Boolean {
|
||||
return initialResult == InitialResult.SENT && resolvedResult == ResolvedResult.SUCCESS
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,13 +171,14 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
override fun onBindViewHolder(holder: HistoryViewHolder, position: Int) {
|
||||
val record: HistoryRecordEntity = historyList[position]
|
||||
record?.let {
|
||||
holder.timeView.text = DateTimeUtil.toStringFromTimeInMillis(record.date)
|
||||
holder.timeView.text = DateTimeUtil.toStringFromTimeInMillis(record.displayTimestamp())
|
||||
setValue(record, holder.valueView)
|
||||
setType(record, holder.typeView)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setType(record: HistoryRecordEntity, typeView: TextView) {
|
||||
typeView.text = resourceHelper.gs(record.commandType.resourceId)
|
||||
}
|
||||
|
||||
private fun setValue(historyEntry: HistoryRecordEntity, valueView: TextView) {
|
||||
|
|
Loading…
Reference in a new issue