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() setupAddresses()
setupIMs() setupIMs()
setupEvents() setupEvents()
setupWebsites()
setupGroups()
setupContactSources()
setupNotes() setupNotes()
setupOrganization() setupOrganization()
setupWebsites()
setupContactSources()
} }
} }
setupGroups()
} }
private fun launchEditContact(contact: Contact) { private fun launchEditContact(contact: Contact) {
@ -522,8 +521,15 @@ class ViewContactActivity : ContactActivity() {
private fun setupGroups() { private fun setupGroups() {
contact_groups_holder.removeAllViews() contact_groups_holder.removeAllViews()
val groups = contact!!.groups if (showFields and SHOW_GROUPS_FIELD != 0) {
if (groups.isNotEmpty() && 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 { groups.forEach {
layoutInflater.inflate(R.layout.item_view_group, contact_groups_holder, false).apply { layoutInflater.inflate(R.layout.item_view_group, contact_groups_holder, false).apply {
val group = it val group = it
@ -538,6 +544,10 @@ class ViewContactActivity : ContactActivity() {
contact_groups_image.beGone() contact_groups_image.beGone()
contact_groups_holder.beGone() contact_groups_holder.beGone()
} }
} else {
contact_groups_image.beGone()
contact_groups_holder.beGone()
}
} }
private fun setupContactSources() { private fun setupContactSources() {

View File

@ -374,7 +374,7 @@
android:id="@+id/contact_sources_holder" android:id="@+id/contact_sources_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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:layout_toEndOf="@+id/contact_name_image"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="@dimen/small_margin" android:paddingStart="@dimen/small_margin"