in history, show time if call has been done today

This commit is contained in:
Juha Heinanen
2018-05-14 22:46:45 +03:00
parent ae4b7c355a
commit 7a9935709a

View File

@ -7,8 +7,7 @@ import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.ImageView
import android.widget.TextView
import java.util.ArrayList
import java.util.*
class HistoryListAdapter(private val cxt: Context, private val rows: ArrayList<HistoryRow>) :
ArrayAdapter<HistoryRow>(cxt, R.layout.history_row, rows) {
@ -22,7 +21,13 @@ class HistoryListAdapter(private val cxt: Context, private val rows: ArrayList<H
val peerURIView = rowView.findViewById(R.id.peer_uri) as TextView
peerURIView.text = row.peerURI
val timeView = rowView.findViewById(R.id.time) as TextView
timeView.text = row.time
val now = GregorianCalendar()
if (row.time.get(Calendar.YEAR).equals(now.get(Calendar.YEAR)) &&
row.time.get(Calendar.DAY_OF_YEAR).equals(now.get(Calendar.DAY_OF_YEAR)))
timeView.text = String.format("%02d", row.time.get(Calendar.HOUR_OF_DAY)) + ":" +
String.format("%02d", row.time.get(Calendar.HOUR_OF_DAY))
else
timeView.text = row.time
return rowView
}