mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
properly show favorite private contacts from Simple Contacts Pro
This commit is contained in:
@ -56,6 +56,6 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.29.9'
|
||||
implementation 'com.simplemobiletools:commons:5.29.10'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class DialpadActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
speedDialValues = config.getSpeedDialValues()
|
||||
privateCursor = getMyContactsContentProviderCursorLoader().loadInBackground()
|
||||
privateCursor = getMyContactsCursor().loadInBackground()
|
||||
|
||||
dialpad_0_holder.setOnClickListener { dialpadPressed('0', it) }
|
||||
dialpad_1.setOnClickListener { dialpadPressed('1', it) }
|
||||
|
@ -74,7 +74,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
val privateCursor = context?.getMyContactsContentProviderCursorLoader()?.loadInBackground()
|
||||
val privateCursor = context?.getMyContactsCursor()?.loadInBackground()
|
||||
SimpleContactsHelper(context).getAvailableContacts(false) { contacts ->
|
||||
allContacts = contacts
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import com.reddit.indicatorfastscroll.FastScrollItemIndicator
|
||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.MyContactsContentProvider
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
|
||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||
import com.simplemobiletools.commons.models.SimpleContact
|
||||
@ -47,8 +48,16 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
val privateCursor = context?.getMyFavoriteContactsCursor()?.loadInBackground()
|
||||
SimpleContactsHelper(context).getAvailableContacts(true) { contacts ->
|
||||
allContacts = contacts
|
||||
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(context, privateCursor)
|
||||
if (privateContacts.isNotEmpty()) {
|
||||
allContacts.addAll(privateContacts)
|
||||
allContacts.sort()
|
||||
}
|
||||
|
||||
activity?.runOnUiThread {
|
||||
gotContacts(contacts)
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
override fun primaryColorChanged(color: Int) {}
|
||||
|
||||
override fun refreshItems() {
|
||||
val privateCursor = context?.getMyContactsContentProviderCursorLoader()?.loadInBackground()
|
||||
val privateCursor = context?.getMyContactsCursor()?.loadInBackground()
|
||||
RecentsHelper(context).getRecentCalls { recents ->
|
||||
SimpleContactsHelper(context).getAvailableContacts(false) { contacts ->
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(context, privateCursor)
|
||||
|
@ -6,7 +6,7 @@ import android.net.Uri
|
||||
import android.telecom.Call
|
||||
import android.telecom.InCallService
|
||||
import android.telecom.VideoProfile
|
||||
import com.simplemobiletools.commons.extensions.getMyContactsContentProviderCursorLoader
|
||||
import com.simplemobiletools.commons.extensions.getMyContactsCursor
|
||||
import com.simplemobiletools.commons.helpers.MyContactsContentProvider
|
||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
@ -71,7 +71,7 @@ class CallManager {
|
||||
if (callContact.name != callContact.number) {
|
||||
callback(callContact)
|
||||
} else {
|
||||
val privateCursor = context.getMyContactsContentProviderCursorLoader().loadInBackground()
|
||||
val privateCursor = context.getMyContactsCursor().loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
val privateContacts = MyContactsContentProvider.getSimpleContacts(context, privateCursor)
|
||||
val privateContact = privateContacts.firstOrNull { it.phoneNumber == callContact.number }
|
||||
|
@ -15,7 +15,7 @@ class RecentsHelper(private val context: Context) {
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
fun getRecentCalls(callback: (ArrayList<RecentCall>) -> Unit) {
|
||||
val privateCursor = context.getMyContactsContentProviderCursorLoader().loadInBackground()
|
||||
val privateCursor = context.getMyContactsCursor().loadInBackground()
|
||||
ensureBackgroundThread {
|
||||
if (!context.hasPermission(PERMISSION_READ_CALL_LOG)) {
|
||||
callback(ArrayList())
|
||||
|
Reference in New Issue
Block a user