diff --git a/library/src/main/java/me/kaede/tagview/TagView.java b/library/src/main/java/me/kaede/tagview/TagView.java index 8dbeb4f..8b31287 100644 --- a/library/src/main/java/me/kaede/tagview/TagView.java +++ b/library/src/main/java/me/kaede/tagview/TagView.java @@ -40,7 +40,8 @@ public class TagView extends RelativeLayout { private LayoutInflater mInflater; private OnTagClickListener mClickListener; private OnTagDeleteListener mDeleteListener; - +//For save state write parcable + private SparseBooleanArray mCheckedTagArray = new SparseBooleanArray(); public TagView(Context context) { super(context, null); LogUtil.v(TAG,"[TagView]constructor 1"); @@ -146,6 +147,7 @@ private void drawTags() { // inflate tag layout View tagLayout = mInflater.inflate(R.layout.tagview_item, null); tagLayout.setId(listIndex); + mCheckedTagArray.put(position, false); tagLayout.setBackgroundDrawable(getSelector(tag)); // tag text TextView tagView = (TextView) tagLayout.findViewById(R.id.tv_tag_item_contain); @@ -159,8 +161,29 @@ private void drawTags() { tagLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - if (mClickListener != null) { - mClickListener.onTagClick(position, tag); + //if (mClickListener != null) { + // mClickListener.onTagClick(position, tag); + // } + //For Mange Clickabe and Click Single mode Tag: + if (mClickListener != null && tagLayout.isEnabled() && tagLayout.isClickable() ) { + Tag mTag1 =getTags().get(position); + if (!mCheckedTagArray.get(position)){ + + for (int i = 0; i