improved showing of history items
This commit is contained in:
@ -35,9 +35,8 @@ class HistoryActivity : AppCompatActivity() {
|
|||||||
val adapter = HistoryListAdapter(this, uaHistory)
|
val adapter = HistoryListAdapter(this, uaHistory)
|
||||||
listview.adapter = adapter
|
listview.adapter = adapter
|
||||||
listview.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
|
listview.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
|
||||||
val row = uaHistory[position]
|
|
||||||
val i = Intent()
|
val i = Intent()
|
||||||
i.putExtra("peer_uri", row.peerURI)
|
i.putExtra("peer_uri", uaHistory[position].peerURI)
|
||||||
setResult(Activity.RESULT_OK, i)
|
setResult(Activity.RESULT_OK, i)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
@ -89,6 +88,10 @@ class HistoryActivity : AppCompatActivity() {
|
|||||||
for (i in History.indices.reversed()) {
|
for (i in History.indices.reversed()) {
|
||||||
val h = History[i]
|
val h = History[i]
|
||||||
if (h.aor == aor) {
|
if (h.aor == aor) {
|
||||||
|
var peer_uri = h.peerURI
|
||||||
|
if (Utils.uriHostPart(peer_uri) == Utils.uriHostPart(aor)) {
|
||||||
|
peer_uri = Utils.uriUserPart(peer_uri)
|
||||||
|
}
|
||||||
val time: String
|
val time: String
|
||||||
if (isToday(h.time)) {
|
if (isToday(h.time)) {
|
||||||
val fmt = SimpleDateFormat("HH:mm")
|
val fmt = SimpleDateFormat("HH:mm")
|
||||||
@ -99,15 +102,15 @@ class HistoryActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
if (h.direction == "in") {
|
if (h.direction == "in") {
|
||||||
if (h.connected) {
|
if (h.connected) {
|
||||||
uaHistory.add(HistoryRow(h.peerURI, R.drawable.arrow_down_green, time))
|
uaHistory.add(HistoryRow(peer_uri, R.drawable.arrow_down_green, time))
|
||||||
} else {
|
} else {
|
||||||
uaHistory.add(HistoryRow(h.peerURI, R.drawable.arrow_down_red, time))
|
uaHistory.add(HistoryRow(peer_uri, R.drawable.arrow_down_red, time))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (h.connected) {
|
if (h.connected) {
|
||||||
uaHistory.add(HistoryRow(h.peerURI, R.drawable.arrow_up_green, time))
|
uaHistory.add(HistoryRow(peer_uri, R.drawable.arrow_up_green, time))
|
||||||
} else {
|
} else {
|
||||||
uaHistory.add(HistoryRow(h.peerURI, R.drawable.arrow_up_red, time))
|
uaHistory.add(HistoryRow(peer_uri, R.drawable.arrow_up_red, time))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
posAtHistory.add(i)
|
posAtHistory.add(i)
|
||||||
|
|||||||
@ -650,12 +650,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
internal var In = ArrayList<Call>()
|
internal var In = ArrayList<Call>()
|
||||||
internal var Out = ArrayList<Call>()
|
internal var Out = ArrayList<Call>()
|
||||||
|
|
||||||
private val RECORD_AUDIO_PERMISSION = 1
|
const val RECORD_AUDIO_PERMISSION = 1
|
||||||
private val EDIT_ACCOUNTS_CODE = 1
|
const val EDIT_ACCOUNTS_CODE = 1
|
||||||
private val EDIT_CONTACTS_CODE = 2
|
const val EDIT_CONTACTS_CODE = 2
|
||||||
private val EDIT_CONFIG_CODE = 3
|
const val EDIT_CONFIG_CODE = 3
|
||||||
private val HISTORY_CODE = 4
|
const val HISTORY_CODE = 4
|
||||||
private val ABOUT_CODE = 5
|
const val ABOUT_CODE = 5
|
||||||
|
|
||||||
external fun contacts_remove()
|
external fun contacts_remove()
|
||||||
external fun contact_add(contact: String)
|
external fun contact_add(contact: String)
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.tutpro.baresip
|
package com.tutpro.baresip
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
|
||||||
@ -64,4 +63,15 @@ object Utils {
|
|||||||
alertDialog.show()
|
alertDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun uriHostPart(uri: String): String {
|
||||||
|
return uri.substringAfter("@")
|
||||||
|
.substringBefore(":")
|
||||||
|
.substringBefore(";")
|
||||||
|
.substringBefore(">")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun uriUserPart(uri: String): String {
|
||||||
|
return uri.substringAfter(":").substringBefore("@")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user