-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix removeSpan
crash on Android
#469
Changes from 4 commits
c974bdc
15652dc
0dfd7b9
c176a5e
ade58bc
88baac1
24a7e7f
c6186b4
f160781
1864419
feb5cd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ | |
|
||
public class MarkdownTextWatcher implements TextWatcher { | ||
private final MarkdownUtils mMarkdownUtils; | ||
|
||
private boolean mShouldSkip = false; | ||
private Editable mPreviousEditable; | ||
|
||
public MarkdownTextWatcher(@NonNull MarkdownUtils markdownUtils) { | ||
mMarkdownUtils = markdownUtils; | ||
|
@@ -22,17 +22,17 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) { | |
|
||
@Override | ||
public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
if (mShouldSkip) { | ||
return; | ||
} | ||
if (s instanceof SpannableStringBuilder) { | ||
mMarkdownUtils.applyMarkdownFormatting((SpannableStringBuilder) s); | ||
mShouldSkip = true; | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void afterTextChanged(Editable editable) { | ||
mShouldSkip = false; | ||
if (editable instanceof SpannableStringBuilder) { | ||
if (mPreviousEditable != null && mPreviousEditable.toString().equals(editable.toString())) { | ||
return; | ||
} | ||
mMarkdownUtils.applyMarkdownFormatting((SpannableStringBuilder) editable); | ||
mPreviousEditable = new SpannableStringBuilder(editable); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to store How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's make sense, please wait There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
} | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's restore the trailing newline
tomekzaw marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also remove this field as it's no longer used.