aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-16 17:21:21 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-16 17:21:21 +0100
commitcf00f3fade1e76ff9360e96d5505d49c7c89d5c4 (patch)
tree0617dcc0eff219a19e555aba6096e24d9ef2e30c /src/main/java/eu/siacs/conversations/ui
parent84b2ce10b7a38aaaa9d2d3ee8ad4e1213402640f (diff)
happy hanukkah
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java21
1 files changed, 21 insertions, 0 deletions
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 d78dbd6a..250a69c3 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
@@ -6,20 +6,26 @@ import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.ListItem;
import eu.siacs.conversations.ui.XmppActivity;
import android.content.Context;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.TextView;
public class ListItemAdapter extends ArrayAdapter<ListItem> {
protected XmppActivity activity;
+ protected boolean showDynamicTags = false;
public ListItemAdapter(XmppActivity activity, List<ListItem> objects) {
super(activity, 0, objects);
this.activity = activity;
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ this.showDynamicTags = preferences.getBoolean("show_dynamic_tags",false);
}
@Override
@@ -33,6 +39,21 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
TextView name = (TextView) view.findViewById(R.id.contact_display_name);
TextView jid = (TextView) view.findViewById(R.id.contact_jid);
ImageView picture = (ImageView) view.findViewById(R.id.contact_photo);
+ LinearLayout tagLayout = (LinearLayout) view.findViewById(R.id.tags);
+
+ List<ListItem.Tag> tags = item.getTags();
+ if (tags.size() == 0 || !this.showDynamicTags) {
+ tagLayout.setVisibility(View.GONE);
+ } else {
+ tagLayout.setVisibility(View.VISIBLE);
+ tagLayout.removeAllViewsInLayout();
+ for(ListItem.Tag tag : tags) {
+ TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag,tagLayout,false);
+ tv.setText(tag.getName());
+ tv.setBackgroundColor(tag.getColor());
+ tagLayout.addView(tv);
+ }
+ }
jid.setText(item.getJid().toString());
name.setText(item.getDisplayName());