Skip to content

Commit

Permalink
Make sure indices get updated
Browse files Browse the repository at this point in the history
  • Loading branch information
moezbhatti committed Dec 27, 2019
1 parent c46adbd commit fdf2e2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ class ContactAdapter @Inject constructor() : QkAdapter<Contact>() {
view.name.text = contact.name
view.name.setVisible(view.name.text.isNotEmpty())

val adapter = view.addresses.adapter as PhoneNumberAdapter
adapter.contact = contact
adapter.data = contact.numbers
(view.addresses.adapter as PhoneNumberAdapter).data = contact.numbers
}

/**
Expand All @@ -84,4 +82,6 @@ class ContactAdapter @Inject constructor() : QkAdapter<Contact>() {
numbers.add(contact.numbers[numberIndex])
}

override fun areContentsTheSame(old: Contact, new: Contact): Boolean = false

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ import android.view.ViewGroup
import com.moez.QKSMS.R
import com.moez.QKSMS.common.base.QkAdapter
import com.moez.QKSMS.common.base.QkViewHolder
import com.moez.QKSMS.model.Contact
import com.moez.QKSMS.model.PhoneNumber
import kotlinx.android.synthetic.main.contact_number_list_item.view.*

class PhoneNumberAdapter : QkAdapter<PhoneNumber>() {

lateinit var contact: Contact

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
val inflater = LayoutInflater.from(parent.context)
val view = inflater.inflate(R.layout.contact_number_list_item, parent, false)
Expand Down

0 comments on commit fdf2e2d

Please sign in to comment.