show duration of careportal events

This commit is contained in:
Milos Kozak 2020-01-15 21:55:53 +01:00
parent ab51cb4d01
commit 7607185086
3 changed files with 24 additions and 15 deletions

View file

@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsCarepor
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.OKDialog
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -106,6 +107,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
val careportalEvent = careportalEventList[position]
holder.ns.visibility = if (NSUpload.isIdValid(careportalEvent._id)) View.VISIBLE else View.GONE
holder.date.text = DateUtil.dateAndTimeString(careportalEvent.date)
holder.duration.text = if (careportalEvent.durationInMsec() == 0L) "" else DateUtil.niceTimeScalar(careportalEvent.durationInMsec())
holder.note.text = careportalEvent.notes
holder.type.text = Translator.translate(careportalEvent.eventType)
holder.remove.tag = careportalEvent
@ -118,6 +120,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
inner class CareportalEventsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var cv: CardView = itemView.findViewById(R.id.careportal_cardview)
var date: TextView = itemView.findViewById(R.id.careportal_date)
var duration: TextView = itemView.findViewById(R.id.careportal_duration)
var type: TextView = itemView.findViewById(R.id.careportal_type)
var note: TextView = itemView.findViewById(R.id.careportal_note)
var remove: TextView = itemView.findViewById(R.id.careportal_remove)

View file

@ -23,33 +23,39 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical|right"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:gravity="center_vertical|end"
android:paddingStart="10dp"
android:paddingEnd="5dp"
android:text="{fa-clock-o}" />
<TextView
android:id="@+id/careportal_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dp"
android:paddingEnd="10dp"
android:text="1.1.2000 18:00"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/careportal_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingEnd="10dp"/>
<TextView
android:id="@+id/careportal_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingRight="10dp"
android:paddingEnd="10dp"
android:text=""
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:text="" />
@ -57,7 +63,7 @@
android:id="@+id/ns_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:text="NS"
android:textColor="@color/colorSetTempButton" />
@ -70,19 +76,19 @@
<TextView
android:id="@+id/careportal_note"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingEnd="10dp"
android:text="Activity" />
<TextView
android:id="@+id/careportal_remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:text="@string/overview_quickwizard_item_remove_button"
android:textAlignment="viewEnd"
android:textColor="@android:color/holo_orange_light" />
@ -92,10 +98,9 @@
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />

View file

@ -885,6 +885,7 @@
<string name="ago">ago</string>
<string name="format_hours">%1$.2f h</string>
<string name="format_mins">%1$d mins</string>
<string name="format_mins_short">%1$dm</string>
<string name="key_enableSMB_always" translatable="false">enableSMB_always</string>
<string name="key_enableSMB_with_COB" translatable="false">enableSMB_with_COB</string>
<string name="key_enableSMB_with_temptarget" translatable="false">enableSMB_with_temptarget</string>