Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
wildan-m committed Sep 11, 2024
1 parent 88baac1 commit 24a7e7f
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class MarkdownTextWatcher implements TextWatcher {
private final MarkdownUtils mMarkdownUtils;
private boolean mShouldSkip = false;
private String mPreviousEditable;
private String mPreviousText;

public MarkdownTextWatcher(@NonNull MarkdownUtils markdownUtils) {
mMarkdownUtils = markdownUtils;
Expand All @@ -22,18 +22,18 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {

}

@Override
public void afterTextChanged(Editable editable) {
if (editable instanceof SpannableStringBuilder) {
String currentText = editable.toString();
if (currentText.equals(mPreviousText)) {
return;
}
mMarkdownUtils.applyMarkdownFormatting((SpannableStringBuilder) editable);
mPreviousText = currentText;
}
if (editable instanceof SpannableStringBuilder) {
String currentText = editable.toString();
if (currentText.equals(mPreviousText)) {
return;
}
mMarkdownUtils.applyMarkdownFormatting((SpannableStringBuilder) editable);
mPreviousText = currentText;
}
}
}
}

0 comments on commit 24a7e7f

Please sign in to comment.