From fd54dc5aff2e2df0c0773ac0ce7936094edfeb39 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Aug 2016 16:34:42 +0200 Subject: [PATCH] wrap dynamic tags into multiple lines. fixes #2003 --- .../eu/siacs/conversations/ui/ContactDetailsActivity.java | 6 ++++-- .../eu/siacs/conversations/ui/adapter/ListItemAdapter.java | 4 +++- src/main/res/layout/activity_contact_details.xml | 5 +++-- src/main/res/layout/contact.xml | 6 +++--- src/main/res/layout/list_item_tag.xml | 3 ++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index af1a9917..836e345b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -28,6 +28,8 @@ import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.Toast; +import com.wefika.flowlayout.FlowLayout; + import org.openintents.openpgp.util.OpenPgpUtils; import java.security.cert.X509Certificate; @@ -113,7 +115,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd private Button addContactButton; private QuickContactBadge badge; private LinearLayout keys; - private LinearLayout tags; + private FlowLayout tags; private boolean showDynamicTags = false; private boolean showLastSeen = false; private String messageFingerprint; @@ -215,7 +217,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd } }); keys = (LinearLayout) findViewById(R.id.details_contact_keys); - tags = (LinearLayout) findViewById(R.id.tags); + tags = (FlowLayout) findViewById(R.id.tags); if (getActionBar() != null) { getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java index c29b01bc..655d52b4 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -16,6 +16,8 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.wefika.flowlayout.FlowLayout; + import java.lang.ref.WeakReference; import java.util.List; import java.util.concurrent.RejectedExecutionException; @@ -60,7 +62,7 @@ public class ListItemAdapter extends ArrayAdapter { TextView tvName = (TextView) view.findViewById(R.id.contact_display_name); TextView tvJid = (TextView) view.findViewById(R.id.contact_jid); ImageView picture = (ImageView) view.findViewById(R.id.contact_photo); - LinearLayout tagLayout = (LinearLayout) view.findViewById(R.id.tags); + FlowLayout tagLayout = (FlowLayout) view.findViewById(R.id.tags); List tags = item.getTags(activity); if (tags.size() == 0 || !this.showDynamicTags) { diff --git a/src/main/res/layout/activity_contact_details.xml b/src/main/res/layout/activity_contact_details.xml index cfd3179e..ce62081e 100644 --- a/src/main/res/layout/activity_contact_details.xml +++ b/src/main/res/layout/activity_contact_details.xml @@ -44,14 +44,15 @@ android:textSize="?attr/TextSizeHeadline" android:textStyle="bold" /> - - + - - + \ No newline at end of file