diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-12-19 19:14:33 +0300 |
---|---|---|
committer | Niedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com> | 2020-12-21 13:49:02 +0300 |
commit | 11d7f548ecafce94b3f6a4dd32eb7e6b2ffff204 (patch) | |
tree | d5a449c75fd10abccc3e57eb3d4c14d0ec31fa95 | |
parent | 2a41a2ba0d8d72d83fb2d4308a24e69f82375e8e (diff) |
Performance improvement for editor
Signed-off-by: Stefan Niedermann <info@niedermann.it>
-rw-r--r-- | markdown/src/main/java/it/niedermann/android/markdown/markwon/MarkwonMarkdownUtil.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/markdown/src/main/java/it/niedermann/android/markdown/markwon/MarkwonMarkdownUtil.java b/markdown/src/main/java/it/niedermann/android/markdown/markwon/MarkwonMarkdownUtil.java index 8fe238784..d9ac64936 100644 --- a/markdown/src/main/java/it/niedermann/android/markdown/markwon/MarkwonMarkdownUtil.java +++ b/markdown/src/main/java/it/niedermann/android/markdown/markwon/MarkwonMarkdownUtil.java @@ -273,11 +273,9 @@ public class MarkwonMarkdownUtil { } } - private static void removeSpans(@NonNull Editable editable, @SuppressWarnings("SameParameterValue") @NonNull Class<?> clazz) { - final Object[] spansToRemove = editable.getSpans(0, editable.length(), Object.class); - for (Object span : spansToRemove) { - if (span.getClass() == clazz) - editable.removeSpan(span); + private static <T> void removeSpans(@NonNull Editable editable, @SuppressWarnings("SameParameterValue") Class<T> spanType) { + for (T span : editable.getSpans(0, editable.length(), spanType)) { + editable.removeSpan(span); } } } |