mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-02-14 18:40:46 +01:00
avoid showing the same item in Recents multiple times in a row
This commit is contained in:
parent
6713f05ba7
commit
93558cc25a
@ -31,6 +31,7 @@ class RecentsHelper(private val context: Context) {
|
||||
|
||||
val sortOrder = "${Calls._ID} DESC LIMIT 100"
|
||||
|
||||
var previousRecentCallFrom = ""
|
||||
context.queryCursor(uri, projection, sortOrder = sortOrder) { cursor ->
|
||||
val id = cursor.getIntValue(Calls._ID)
|
||||
val number = cursor.getStringValue(Calls.NUMBER)
|
||||
@ -40,7 +41,12 @@ class RecentsHelper(private val context: Context) {
|
||||
val duration = cursor.getIntValue(Calls.DURATION)
|
||||
val type = cursor.getIntValue(Calls.TYPE)
|
||||
val recentCall = RecentCall(id, number, name, photoUri, startTS, duration, type)
|
||||
recentCalls.add(recentCall)
|
||||
|
||||
if ("$number$name" != previousRecentCallFrom) {
|
||||
recentCalls.add(recentCall)
|
||||
}
|
||||
|
||||
previousRecentCallFrom = "$number$name"
|
||||
}
|
||||
|
||||
callback(recentCalls)
|
||||
|
Loading…
x
Reference in New Issue
Block a user