diff --git a/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java b/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java index d5dfc845c5..63fcb96e93 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java +++ b/app/src/main/java/net/gsantner/markor/frontend/textview/HighlightingEditor.java @@ -97,7 +97,6 @@ public void afterTextChanged(final Editable s) { // Listen to and update highlighting final ViewTreeObserver observer = getViewTreeObserver(); observer.addOnScrollChangedListener(() -> updateHighlighting(false)); - observer.addOnGlobalLayoutListener(() -> updateHighlighting(false)); // Fix for Android 12 perf issues - https://github.com/gsantner/markor/discussions/1794 setEmojiCompatEnabled(false); @@ -122,8 +121,8 @@ protected void onDraw(Canvas canvas) { // --------------------------------------------------------------------------------------------- private boolean isScrollSignificant() { - return (_oldHlRect.top - _hlRect.top) > _hlShiftThreshold || - (_hlRect.bottom - _oldHlRect.bottom) > _hlShiftThreshold; + return Math.abs(_oldHlRect.top - _hlRect.top) > _hlShiftThreshold || + Math.abs(_hlRect.bottom - _oldHlRect.bottom) > _hlShiftThreshold; } private void updateHighlighting(final boolean recompute) { diff --git a/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java b/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java index 3b30f6af21..8d64023b8a 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java +++ b/app/src/main/java/net/gsantner/markor/frontend/textview/SyntaxHighlighterBase.java @@ -213,7 +213,7 @@ public Spannable getSpannable() { } public boolean hasSpans() { - return _spannable != null && _groups.size() > 0; + return _spannable != null && !_groups.isEmpty(); } /** diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index bea7dc1ab6..307809d0e1 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,6 +1,6 @@ - 18dp + 10dp 16dp 32dp 8dp