renaming the helper class ContactsHelper to SimpleContactsHelper
This commit is contained in:
parent
9c5255701b
commit
f1edebb2dc
8 changed files with 31 additions and 31 deletions
|
|
@ -7,8 +7,8 @@ import android.view.Menu
|
|||
import android.view.WindowManager
|
||||
import com.reddit.indicatorfastscroll.FastScrollItemIndicator
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_CONTACTS
|
||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.models.SimpleContact
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
|
|
@ -103,7 +103,7 @@ class NewConversationActivity : SimpleActivity() {
|
|||
|
||||
private fun fetchContacts() {
|
||||
fillSuggestedContacts {
|
||||
ContactsHelper(this).getAvailableContacts {
|
||||
SimpleContactsHelper(this).getAvailableContacts {
|
||||
allContacts = it
|
||||
|
||||
runOnUiThread {
|
||||
|
|
@ -149,7 +149,7 @@ class NewConversationActivity : SimpleActivity() {
|
|||
val contact = it
|
||||
layoutInflater.inflate(R.layout.item_suggested_contact, null).apply {
|
||||
suggested_contact_name.text = contact.name
|
||||
ContactsHelper(this@NewConversationActivity).loadContactImage(contact.photoUri, suggested_contact_image, contact.name)
|
||||
SimpleContactsHelper(this@NewConversationActivity).loadContactImage(contact.photoUri, suggested_contact_image, contact.name)
|
||||
suggestions_holder.addView(this)
|
||||
setOnClickListener {
|
||||
launchThreadActivity(contact.phoneNumber, contact.name)
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import com.klinker.android.send_message.Settings
|
|||
import com.klinker.android.send_message.Transaction
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_READ_PHONE_STATE
|
||||
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.helpers.isNougatPlus
|
||||
import com.simplemobiletools.commons.models.SimpleContact
|
||||
|
|
@ -106,7 +106,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
return@ensureBackgroundThread
|
||||
}
|
||||
|
||||
val contact = SimpleContact(0, name, "", number)
|
||||
val contact = SimpleContact(0, 0, name, "", number)
|
||||
participants.add(contact)
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
thread_messages_list.adapter = adapter
|
||||
}
|
||||
|
||||
ContactsHelper(this).getAvailableContacts {
|
||||
SimpleContactsHelper(this).getAvailableContacts {
|
||||
runOnUiThread {
|
||||
val adapter = AutoCompleteTextViewAdapter(this, it)
|
||||
add_contact_or_number.setAdapter(adapter)
|
||||
|
|
@ -221,7 +221,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
confirm_inserted_number.setOnClickListener {
|
||||
val number = add_contact_or_number.value
|
||||
val contact = SimpleContact(number.hashCode(), number, "", number)
|
||||
val contact = SimpleContact(number.hashCode(), number.hashCode(), number, "", number)
|
||||
addSelectedContact(contact)
|
||||
}
|
||||
}
|
||||
|
|
@ -278,7 +278,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
if (availableSIMs.size > 1) {
|
||||
availableSIMs.forEachIndexed { index, subscriptionInfo ->
|
||||
var label = subscriptionInfo.displayName.toString()
|
||||
if (subscriptionInfo.number.isNotEmpty()) {
|
||||
if (subscriptionInfo.number?.isNotEmpty() == true) {
|
||||
label += " (${subscriptionInfo.number})"
|
||||
}
|
||||
val SIMCard = SIMCard(index + 1, subscriptionInfo.subscriptionId, label)
|
||||
|
|
@ -350,8 +350,8 @@ class ThreadActivity : SimpleActivity() {
|
|||
layoutInflater.inflate(R.layout.item_selected_contact, null).apply {
|
||||
selected_contact_name.text = contact.name
|
||||
selected_contact_remove.setOnClickListener {
|
||||
if (contact.id != participants.first().id) {
|
||||
removeSelectedContact(contact.id)
|
||||
if (contact.rawId != participants.first().rawId) {
|
||||
removeSelectedContact(contact.rawId)
|
||||
}
|
||||
}
|
||||
views.add(this)
|
||||
|
|
@ -362,7 +362,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
|
||||
private fun addSelectedContact(contact: SimpleContact) {
|
||||
add_contact_or_number.setText("")
|
||||
if (participants.map { it.id }.contains(contact.id)) {
|
||||
if (participants.map { it.rawId }.contains(contact.rawId)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ class ThreadActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun removeSelectedContact(id: Int) {
|
||||
participants = participants.filter { it.id != id }.toMutableList() as ArrayList<SimpleContact>
|
||||
participants = participants.filter { it.rawId != id }.toMutableList() as ArrayList<SimpleContact>
|
||||
showSelectedContacts()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue