diff options
author | lookshe <github@lookshe.org> | 2015-01-03 23:19:05 +0100 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2015-01-03 23:19:05 +0100 |
commit | 95e2a539517c27b3235acd582f17968c8e301e81 (patch) | |
tree | 213bbeed798751e949376d85f4d7d0bd30c5fbfa /src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java | |
parent | 48717dd7d37c066ab626fc626a2ced626ef21d42 (diff) | |
parent | 4f4eff2353f4e359b5582c8e808a4e88631c3e74 (diff) |
Merge branch 'master' of ssh://git.fucktheforce.de/conversations
Conflicts:
src/main/java/eu/siacs/conversations/Config.java
src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
src/main/java/eu/siacs/conversations/utils/UIHelper.java
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java | 22 |
1 files changed, 22 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 0865d1aa..91fb021c 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.ui.adapter; import java.util.List; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.ui.XmppActivity; @@ -10,6 +11,7 @@ import eu.siacs.conversations.xmpp.jid.Jid; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -22,6 +24,17 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { protected XmppActivity activity; protected boolean showDynamicTags = false; + private View.OnClickListener onTagTvClick = new View.OnClickListener() { + @Override + public void onClick(View view) { + if (view instanceof TextView && mOnTagClickedListener != null) { + TextView tv = (TextView) view; + final String tag = tv.getText().toString(); + mOnTagClickedListener.onTagClicked(tag); + } + } + }; + private OnTagClickedListener mOnTagClickedListener = null; public ListItemAdapter(XmppActivity activity, List<ListItem> objects) { super(activity, 0, objects); @@ -53,6 +66,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag,tagLayout,false); tv.setText(tag.getName()); tv.setBackgroundColor(tag.getColor()); + tv.setOnClickListener(this.onTagTvClick); tagLayout.addView(tv); } } @@ -68,4 +82,12 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { return view; } + public void setOnTagClickedListener(OnTagClickedListener listener) { + this.mOnTagClickedListener = listener; + } + + public interface OnTagClickedListener { + public void onTagClicked(String tag); + } + } |