AndroidTagGroup icon indicating copy to clipboard operation
AndroidTagGroup copied to clipboard

Checked style is not working

Open ece321 opened this issue 8 years ago • 2 comments
trafficstars

Checked background and text color is not working. I tried to place it in the XML layout but it doesn't work.

ece321 avatar May 08 '17 11:05 ece321

I got the same problem too.

lazysong avatar Jun 01 '17 07:06 lazysong

I tried to go through the code and it seems that if it's not in append mode, the tag wont be set to checked. But if in append mode, the "onTagClickListener" wont be triggered. in function on line 615

class InternalTagClickListener implements OnClickListener {
        @Override
        public void onClick(View v) {
            final TagView tag = (TagView) v;
            if (isAppendMode) {
                if (tag.mState == TagView.STATE_INPUT) {
                    // If the clicked tag is in INPUT state, uncheck the previous checked tag if exists.
                    final TagView checkedTag = getCheckedTag();
                    if (checkedTag != null) {
                        checkedTag.setChecked(false);
                    }
                } else {
                    // If the clicked tag is currently checked, delete the tag.
                    if (tag.isChecked) {
                        deleteTag(tag);
                    } else {
                        // If the clicked tag is unchecked, uncheck the previous checked tag if exists,
                        // then check the clicked tag.
                        final TagView checkedTag = getCheckedTag();
                        if (checkedTag != null) {
                            checkedTag.setChecked(false);
                        }
                        tag.setChecked(true);
                    }
                }
            } else {
                if (mOnTagClickListener != null) {
                    mOnTagClickListener.onTagClick(tag.getText().toString());
                }
            }
        }
    }
The code 

checkedTag.setChecked

and 

if (mOnTagClickListener != null) {
    mOnTagClickListener.onTagClick(tag.getText().toString());
}

should execute irrespective of append mode or not.

DroidBoyJr avatar Jul 29 '18 05:07 DroidBoyJr