show groups as the last field at contacts too

This commit is contained in:
tibbi 2019-09-15 21:11:11 +02:00
parent 4113aa681d
commit 8afdf0430e
2 changed files with 26 additions and 16 deletions

View File

@ -208,14 +208,13 @@ class ViewContactActivity : ContactActivity() {
setupAddresses()
setupIMs()
setupEvents()
setupWebsites()
setupGroups()
setupContactSources()
setupNotes()
setupOrganization()
setupWebsites()
setupContactSources()
}
}
setupGroups()
}
private fun launchEditContact(contact: Contact) {
@ -522,18 +521,29 @@ class ViewContactActivity : ContactActivity() {
private fun setupGroups() {
contact_groups_holder.removeAllViews()
val groups = contact!!.groups
if (groups.isNotEmpty() && showFields and SHOW_GROUPS_FIELD != 0) {
groups.forEach {
layoutInflater.inflate(R.layout.item_view_group, contact_groups_holder, false).apply {
val group = it
contact_groups_holder.addView(this)
contact_group.text = group.title
copyOnLongClick(group.title)
}
if (showFields and SHOW_GROUPS_FIELD != 0) {
var groups = contact!!.groups.toMutableSet() as LinkedHashSet<Group>
duplicateContacts.forEach {
groups.addAll(it.groups)
}
groups = groups.sortedBy { it.title }.toMutableSet() as LinkedHashSet<Group>
if (groups.isNotEmpty()) {
groups.forEach {
layoutInflater.inflate(R.layout.item_view_group, contact_groups_holder, false).apply {
val group = it
contact_groups_holder.addView(this)
contact_group.text = group.title
copyOnLongClick(group.title)
}
}
contact_groups_image.beVisible()
contact_groups_holder.beVisible()
} else {
contact_groups_image.beGone()
contact_groups_holder.beGone()
}
contact_groups_image.beVisible()
contact_groups_holder.beVisible()
} else {
contact_groups_image.beGone()
contact_groups_holder.beGone()

View File

@ -374,7 +374,7 @@
android:id="@+id/contact_sources_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_websites_holder"
android:layout_below="@+id/contact_groups_holder"
android:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical"
android:paddingStart="@dimen/small_margin"