Created
December 6, 2018 08:38
-
-
Save kyawhtut-cu/6528a593269469399d279b3e586927be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create global variable | |
private List<String> mTagList = new ArrayList<>(); | |
//add tags change listener to TagsEdittext | |
mItemTags.setTagsListener(new TagsEditText.TagsEditListener() { | |
@Override | |
public void onTagsChanged(Collection<String> collection) { | |
Timber.i("onTagsChanged : %s", collection); | |
if (mTagList.size() != mItemTags.getTags().size()) { | |
boolean isDataChange = false; | |
mTagList.clear(); | |
for (int index = 0; index < mItemTags.getTags().size(); index++) { | |
if (!mTagList.contains(mItemTags.getTags().get(index))) { | |
isDataChange = true; | |
mTagList.add(mItemTags.getTags().get(index)); | |
} | |
} | |
if (isDataChange) { | |
String[] tmp = new String[mTagList.size()]; | |
for (int index = 0; index < tmp.length; index++) { | |
tmp[index] = mTagList.get(index); | |
} | |
mItemTags.setTags(tmp); | |
} | |
} | |
} | |
@Override | |
public void onEditingFinished() { | |
Timber.i("onEditingFinished"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment