Use apply instead of also
This commit is contained in:
parent
fe7d579408
commit
07a3a5883b
1 changed files with 14 additions and 14 deletions
|
@ -519,8 +519,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
phoneNumbers.forEachIndexed { index, number ->
|
phoneNumbers.forEachIndexed { index, number ->
|
||||||
val numberHolderView = binding.contactNumbersHolder.getChildAt(index)
|
val numberHolderView = binding.contactNumbersHolder.getChildAt(index)
|
||||||
val numberHolder = if (numberHolderView == null) {
|
val numberHolder = if (numberHolderView == null) {
|
||||||
ItemEditPhoneNumberBinding.inflate(layoutInflater, binding.contactNumbersHolder, false).also {
|
ItemEditPhoneNumberBinding.inflate(layoutInflater, binding.contactNumbersHolder, false).apply {
|
||||||
binding.contactNumbersHolder.addView(it.root)
|
binding.contactNumbersHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEditPhoneNumberBinding.bind(numberHolderView)
|
ItemEditPhoneNumberBinding.bind(numberHolderView)
|
||||||
|
@ -591,8 +591,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
contact!!.emails.forEachIndexed { index, email ->
|
contact!!.emails.forEachIndexed { index, email ->
|
||||||
val emailHolderView = binding.contactEmailsHolder.getChildAt(index)
|
val emailHolderView = binding.contactEmailsHolder.getChildAt(index)
|
||||||
val emailHolder = if (emailHolderView == null) {
|
val emailHolder = if (emailHolderView == null) {
|
||||||
ItemEditEmailBinding.inflate(layoutInflater, binding.contactEmailsHolder, false).also {
|
ItemEditEmailBinding.inflate(layoutInflater, binding.contactEmailsHolder, false).apply {
|
||||||
binding.contactEmailsHolder.addView(it.root)
|
binding.contactEmailsHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEditEmailBinding.bind(emailHolderView)
|
ItemEditEmailBinding.bind(emailHolderView)
|
||||||
|
@ -612,8 +612,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
contact!!.addresses.forEachIndexed { index, address ->
|
contact!!.addresses.forEachIndexed { index, address ->
|
||||||
val addressHolderView = binding.contactAddressesHolder.getChildAt(index)
|
val addressHolderView = binding.contactAddressesHolder.getChildAt(index)
|
||||||
val addressHolder = if (addressHolderView == null) {
|
val addressHolder = if (addressHolderView == null) {
|
||||||
ItemEditAddressBinding.inflate(layoutInflater, binding.contactAddressesHolder, false).also {
|
ItemEditAddressBinding.inflate(layoutInflater, binding.contactAddressesHolder, false).apply {
|
||||||
binding.contactAddressesHolder.addView(it.root)
|
binding.contactAddressesHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEditAddressBinding.bind(addressHolderView)
|
ItemEditAddressBinding.bind(addressHolderView)
|
||||||
|
@ -630,8 +630,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
contact!!.IMs.forEachIndexed { index, IM ->
|
contact!!.IMs.forEachIndexed { index, IM ->
|
||||||
val imHolderView = binding.contactImsHolder.getChildAt(index)
|
val imHolderView = binding.contactImsHolder.getChildAt(index)
|
||||||
val imHolder = if (imHolderView == null) {
|
val imHolder = if (imHolderView == null) {
|
||||||
ItemEditImBinding.inflate(layoutInflater, binding.contactImsHolder, false).also {
|
ItemEditImBinding.inflate(layoutInflater, binding.contactImsHolder, false).apply {
|
||||||
binding.contactImsHolder.addView(it.root)
|
binding.contactImsHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEditImBinding.bind(imHolderView)
|
ItemEditImBinding.bind(imHolderView)
|
||||||
|
@ -689,8 +689,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
contact!!.websites.forEachIndexed { index, website ->
|
contact!!.websites.forEachIndexed { index, website ->
|
||||||
val websitesHolderView = binding.contactWebsitesHolder.getChildAt(index)
|
val websitesHolderView = binding.contactWebsitesHolder.getChildAt(index)
|
||||||
val websitesHolder = if (websitesHolderView == null) {
|
val websitesHolder = if (websitesHolderView == null) {
|
||||||
ItemEditWebsiteBinding.inflate(layoutInflater, binding.contactWebsitesHolder, false).also {
|
ItemEditWebsiteBinding.inflate(layoutInflater, binding.contactWebsitesHolder, false).apply {
|
||||||
binding.contactWebsitesHolder.addView(it.root)
|
binding.contactWebsitesHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEditWebsiteBinding.bind(websitesHolderView)
|
ItemEditWebsiteBinding.bind(websitesHolderView)
|
||||||
|
@ -704,8 +704,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
contact!!.events.forEachIndexed { index, event ->
|
contact!!.events.forEachIndexed { index, event ->
|
||||||
val eventHolderView = binding.contactEventsHolder.getChildAt(index)
|
val eventHolderView = binding.contactEventsHolder.getChildAt(index)
|
||||||
val eventHolder = if (eventHolderView == null) {
|
val eventHolder = if (eventHolderView == null) {
|
||||||
ItemEventBinding.inflate(layoutInflater, binding.contactEventsHolder, false).also {
|
ItemEventBinding.inflate(layoutInflater, binding.contactEventsHolder, false).apply {
|
||||||
binding.contactEventsHolder.addView(it.root)
|
binding.contactEventsHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEventBinding.bind(eventHolderView)
|
ItemEventBinding.bind(eventHolderView)
|
||||||
|
@ -738,8 +738,8 @@ class EditContactActivity : ContactActivity() {
|
||||||
groups.forEachIndexed { index, group ->
|
groups.forEachIndexed { index, group ->
|
||||||
val groupHolderView = binding.contactGroupsHolder.getChildAt(index)
|
val groupHolderView = binding.contactGroupsHolder.getChildAt(index)
|
||||||
val groupHolder = if (groupHolderView == null) {
|
val groupHolder = if (groupHolderView == null) {
|
||||||
ItemEditGroupBinding.inflate(layoutInflater, binding.contactGroupsHolder, false).also {
|
ItemEditGroupBinding.inflate(layoutInflater, binding.contactGroupsHolder, false).apply {
|
||||||
binding.contactGroupsHolder.addView(it.root)
|
binding.contactGroupsHolder.addView(root)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ItemEditGroupBinding.bind(groupHolderView)
|
ItemEditGroupBinding.bind(groupHolderView)
|
||||||
|
|
Loading…
Reference in a new issue