Skip to content

Commit

Permalink
Tweaks to highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Aug 17, 2024
1 parent fdc484a commit c0e7b5c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public Spannable getSpannable() {
}

public boolean hasSpans() {
return _spannable != null && _groups.size() > 0;
return _spannable != null && !_groups.isEmpty();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">18dp</dimen>
<dimen name="activity_horizontal_margin">10dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="editor_bottom_margin">32dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
Expand Down

0 comments on commit c0e7b5c

Please sign in to comment.