properly update the View screen if a number/email/event was removed
This commit is contained in:
parent
dc43fb93f8
commit
062ee8a6d4
|
@ -154,17 +154,13 @@ class ViewContactActivity : ContactActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupPhoneNumbers() {
|
private fun setupPhoneNumbers() {
|
||||||
|
contact_numbers_holder.removeAllViews()
|
||||||
val phoneNumbers = contact!!.phoneNumbers
|
val phoneNumbers = contact!!.phoneNumbers
|
||||||
phoneNumbers.forEachIndexed { index, number ->
|
phoneNumbers.forEach {
|
||||||
var numberHolder = contact_numbers_holder.getChildAt(index)
|
layoutInflater.inflate(R.layout.item_view_phone_number, contact_numbers_holder, false).apply {
|
||||||
if (numberHolder == null) {
|
contact_numbers_holder.addView(this)
|
||||||
numberHolder = layoutInflater.inflate(R.layout.item_view_phone_number, contact_numbers_holder, false)
|
contact_number.text = it.value
|
||||||
contact_numbers_holder.addView(numberHolder)
|
setupPhoneNumberTypePicker(contact_number_type, it.type)
|
||||||
}
|
|
||||||
|
|
||||||
numberHolder!!.apply {
|
|
||||||
contact_number.text = number.value
|
|
||||||
setupPhoneNumberTypePicker(contact_number_type, number.type)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,17 +169,13 @@ class ViewContactActivity : ContactActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupEmails() {
|
private fun setupEmails() {
|
||||||
|
contact_emails_holder.removeAllViews()
|
||||||
val emails = contact!!.emails
|
val emails = contact!!.emails
|
||||||
emails.forEachIndexed { index, email ->
|
emails.forEach {
|
||||||
var emailHolder = contact_emails_holder.getChildAt(index)
|
layoutInflater.inflate(R.layout.item_view_email, contact_emails_holder, false).apply {
|
||||||
if (emailHolder == null) {
|
contact_emails_holder.addView(this)
|
||||||
emailHolder = layoutInflater.inflate(R.layout.item_view_email, contact_emails_holder, false)
|
contact_email.text = it.value
|
||||||
contact_emails_holder.addView(emailHolder)
|
setupEmailTypePicker(contact_email_type, it.type)
|
||||||
}
|
|
||||||
|
|
||||||
emailHolder!!.apply {
|
|
||||||
contact_email.text = email.value
|
|
||||||
setupEmailTypePicker(contact_email_type, email.type)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,22 +184,14 @@ class ViewContactActivity : ContactActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupEvents() {
|
private fun setupEvents() {
|
||||||
|
contact_events_holder.removeAllViews()
|
||||||
val events = contact!!.events
|
val events = contact!!.events
|
||||||
events.forEachIndexed { index, event ->
|
events.forEach {
|
||||||
var eventHolder = contact_events_holder.getChildAt(index)
|
layoutInflater.inflate(R.layout.item_event, contact_events_holder, false).apply {
|
||||||
if (eventHolder == null) {
|
contact_events_holder.addView(this)
|
||||||
eventHolder = layoutInflater.inflate(R.layout.item_event, contact_events_holder, false)
|
contact_event.alpha = 1f
|
||||||
contact_events_holder.addView(eventHolder)
|
getDateTime(it.value, contact_event)
|
||||||
}
|
setupEventTypePicker(this as ViewGroup, it.type)
|
||||||
|
|
||||||
(eventHolder as ViewGroup).apply {
|
|
||||||
contact_event.apply {
|
|
||||||
getDateTime(event.value, this)
|
|
||||||
tag = event.value
|
|
||||||
alpha = 1f
|
|
||||||
}
|
|
||||||
|
|
||||||
setupEventTypePicker(this, event.type)
|
|
||||||
contact_event_remove.beGone()
|
contact_event_remove.beGone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,11 +154,7 @@
|
||||||
android:layout_below="@+id/contact_surname"
|
android:layout_below="@+id/contact_surname"
|
||||||
android:layout_toRightOf="@+id/contact_number_image"
|
android:layout_toRightOf="@+id/contact_number_image"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="@dimen/small_margin">
|
android:paddingLeft="@dimen/small_margin"/>
|
||||||
|
|
||||||
<include layout="@layout/item_view_phone_number"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/contact_email_image"
|
android:id="@+id/contact_email_image"
|
||||||
|
@ -178,11 +174,7 @@
|
||||||
android:layout_below="@+id/contact_numbers_holder"
|
android:layout_below="@+id/contact_numbers_holder"
|
||||||
android:layout_toRightOf="@+id/contact_name_image"
|
android:layout_toRightOf="@+id/contact_name_image"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="@dimen/small_margin">
|
android:paddingLeft="@dimen/small_margin"/>
|
||||||
|
|
||||||
<include layout="@layout/item_view_email"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/contact_event_image"
|
android:id="@+id/contact_event_image"
|
||||||
|
@ -201,11 +193,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/contact_emails_holder"
|
android:layout_below="@+id/contact_emails_holder"
|
||||||
android:layout_toRightOf="@+id/contact_name_image"
|
android:layout_toRightOf="@+id/contact_name_image"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"/>
|
||||||
|
|
||||||
<include layout="@layout/item_event"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/contact_source_image"
|
android:id="@+id/contact_source_image"
|
||||||
|
|
Loading…
Reference in New Issue