small code cleanup at the ViewContactActivity
This commit is contained in:
parent
54df14442d
commit
8aadcb04c1
|
@ -138,6 +138,29 @@ class ViewContactActivity : ContactActivity() {
|
|||
|
||||
private fun setupViewContact() {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
||||
setupFavorite()
|
||||
setupNames()
|
||||
setupPhoneNumbers()
|
||||
setupEmails()
|
||||
setupAddresses()
|
||||
setupEvents()
|
||||
setupNotes()
|
||||
setupOrganization()
|
||||
setupWebsites()
|
||||
setupGroups()
|
||||
setupContactSource()
|
||||
}
|
||||
|
||||
private fun setupFavorite() {
|
||||
contact_toggle_favorite.apply {
|
||||
beVisible()
|
||||
setImageDrawable(getStarDrawable(contact!!.starred == 1))
|
||||
tag = contact!!.starred
|
||||
applyColorFilter(config.textColor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupNames() {
|
||||
contact!!.apply {
|
||||
contact_prefix.text = prefix
|
||||
contact_prefix.beVisibleIf(prefix.isNotEmpty() && showFields and SHOW_PREFIX_FIELD != 0)
|
||||
|
@ -158,34 +181,9 @@ class ViewContactActivity : ContactActivity() {
|
|||
contact_name_image.beInvisible()
|
||||
(contact_photo.layoutParams as RelativeLayout.LayoutParams).bottomMargin = resources.getDimension(R.dimen.medium_margin).toInt()
|
||||
}
|
||||
|
||||
if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) {
|
||||
contact_source.text = getPublicContactSource(source)
|
||||
contact_source_image.beVisible()
|
||||
contact_source.beVisible()
|
||||
} else {
|
||||
contact_source_image.beGone()
|
||||
contact_source.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
contact_toggle_favorite.apply {
|
||||
beVisible()
|
||||
setImageDrawable(getStarDrawable(contact!!.starred == 1))
|
||||
tag = contact!!.starred
|
||||
applyColorFilter(config.textColor)
|
||||
}
|
||||
|
||||
setupPhoneNumbers()
|
||||
setupEmails()
|
||||
setupAddresses()
|
||||
setupEvents()
|
||||
setupNotes()
|
||||
setupOrganization()
|
||||
setupWebsites()
|
||||
setupGroups()
|
||||
}
|
||||
|
||||
private fun setupPhoneNumbers() {
|
||||
contact_numbers_holder.removeAllViews()
|
||||
val phoneNumbers = contact!!.phoneNumbers
|
||||
|
@ -348,5 +346,16 @@ class ViewContactActivity : ContactActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupContactSource() {
|
||||
if (showFields and SHOW_CONTACT_SOURCE_FIELD != 0) {
|
||||
contact_source.text = getPublicContactSource(contact!!.source)
|
||||
contact_source_image.beVisible()
|
||||
contact_source.beVisible()
|
||||
} else {
|
||||
contact_source_image.beGone()
|
||||
contact_source.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getStarDrawable(on: Boolean) = resources.getDrawable(if (on) R.drawable.ic_star_on_big else R.drawable.ic_star_off_big)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue