ContactItem improvements (#1324)
* ContactRepository: try to deduplicate phoneNumbers in a smart way * AndroidManifest: use CALL_PHONE permission to allow for making phone calls * Implement CallOnTap with contact results - contact activities that require permissions we do not have are not listed - add CallOnTap setting for phone number results on search behind contacts settings * utilize PhoneNumberUtils * navroute settings/search/contacts * queryIntentActivities -> resolveActivity * localization * Code formatting * Wrap contact search settings in preference category --------- Co-authored-by: MM20 <15646950+MM2-0@users.noreply.github.com>
This commit is contained in:
@@ -15,3 +15,15 @@ fun <T> List<T>.randomElementOrNull(): T? {
|
||||
fun <T> List<T>?.ifNullOrEmpty(block: () -> List<T>): List<T> {
|
||||
return if (this.isNullOrEmpty()) block() else this
|
||||
}
|
||||
|
||||
fun <T> List<T>.distinctByEquality(equalityPredicate: (T, T) -> Boolean): List<T> {
|
||||
if (size < 2) return this
|
||||
|
||||
val ret = mutableListOf<T>()
|
||||
|
||||
for (item in this) {
|
||||
if (ret.none { equalityPredicate(it, item) }) ret.add(item)
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user