show the count of item repeats at the Recents tab

This commit is contained in:
tibbi
2020-05-11 14:36:41 +02:00
parent 4b04219976
commit b661f73a75
3 changed files with 14 additions and 3 deletions

View File

@ -41,10 +41,14 @@ class RecentsHelper(private val context: Context) {
val startTS = (cursor.getLongValue(Calls.DATE) / 1000L).toInt()
val duration = cursor.getIntValue(Calls.DURATION)
val type = cursor.getIntValue(Calls.TYPE)
val recentCall = RecentCall(id, number, name, photoUri, startTS, duration, type)
val neighbourIDs = ArrayList<Int>()
val recentCall = RecentCall(id, number, name, photoUri, startTS, duration, type, neighbourIDs)
// if we have 3 missed calls from the same number, show it just once
if ("$number$name" != previousRecentCallFrom) {
recentCalls.add(recentCall)
} else {
recentCalls.lastOrNull()?.neighbourIDs?.add(id)
}
previousRecentCallFrom = "$number$name"