Created
September 21, 2015 09:06
-
-
Save CanOrhan/ea37e9d30b6b59937dab to your computer and use it in GitHub Desktop.
Slack Question
This file contains hidden or 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
//My Activity | |
@Override | |
protected void onStart() { | |
super.onStart(); | |
commentInput.addTextChangedListener(new OnCommentTextChangeListener(fragment)); | |
} | |
//My Adapter | |
@Override | |
public void onTextChanged(CharSequence charSequence, int start, int before, int count) { | |
String currentAdapterName = fragment.getCurrentAdapterName(); | |
boolean showUsers = true; | |
List<ExpressionLocation> hashtagLocations = hashtagDetector.getExpressionLocations(charSequence.toString()); | |
for (ExpressionLocation expressionLocation : hashtagLocations) { | |
if (expressionLocation.getEnd() >= (start + count)) { | |
if (!currentAdapterName.equals(hashtagAdapterName)) { | |
fragment.setAdapter(hashtagAdapter, hashtagAdapterName); | |
} | |
showUsers = false; | |
} | |
} | |
if(showUsers && !currentAdapterName.equals(commentsAdapterName)) { | |
fragment.setAdapter(commentsAdapter, commentsAdapterName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment