mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-19 20:38:53 +01:00
#1167 - Fix crash when displaying contact with multiple numbers
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package feature.compose
|
package feature.compose
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -33,7 +32,7 @@ import kotlinx.android.synthetic.main.contact_list_item.view.*
|
|||||||
import model.Contact
|
import model.Contact
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ContactAdapter @Inject constructor(private val context: Context) : QkAdapter<Contact>() {
|
class ContactAdapter @Inject constructor() : QkAdapter<Contact>() {
|
||||||
|
|
||||||
val contactSelected: Subject<Contact> = PublishSubject.create()
|
val contactSelected: Subject<Contact> = PublishSubject.create()
|
||||||
|
|
||||||
@@ -58,7 +57,7 @@ class ContactAdapter @Inject constructor(private val context: Context) : QkAdapt
|
|||||||
view.addresses.removeAllViews()
|
view.addresses.removeAllViews()
|
||||||
contact.numbers.forEachIndexed { index, number ->
|
contact.numbers.forEachIndexed { index, number ->
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
val numberView = View.inflate(context, R.layout.contact_number_list_item, null)
|
val numberView = View.inflate(view.context, R.layout.contact_number_list_item, null)
|
||||||
numberView.clicks().subscribe { contactSelected.onNext(copyContact(contact, index)) }
|
numberView.clicks().subscribe { contactSelected.onNext(copyContact(contact, index)) }
|
||||||
numberView.address.text = number.address
|
numberView.address.text = number.address
|
||||||
numberView.type.text = number.type
|
numberView.type.text = number.type
|
||||||
|
|||||||
Reference in New Issue
Block a user