diff --git a/app/src/main/java/com/quran/labs/androidquran/view/HighlightingImageView.java b/app/src/main/java/com/quran/labs/androidquran/view/HighlightingImageView.java index c6b5834f28..bd2484344b 100644 --- a/app/src/main/java/com/quran/labs/androidquran/view/HighlightingImageView.java +++ b/app/src/main/java/com/quran/labs/androidquran/view/HighlightingImageView.java @@ -69,6 +69,7 @@ public class HighlightingImageView extends AppCompatImageView { private boolean isNightMode; private boolean isColorFilterOn; private int nightModeTextBrightness = Constants.DEFAULT_NIGHT_MODE_TEXT_BRIGHTNESS; + private int topBottom; // Params for drawing text private int fontSize; @@ -143,13 +144,9 @@ public HighlightingImageView(Context context, AttributeSet attrs) { } public void setIsScrollable(boolean scrollable, boolean landscape) { - int topBottom = scrollable ? scrollableHeaderFooterSize : - landscape ? dualPageHeaderFooterSize : headerFooterSize; + topBottom = scrollable ? scrollableHeaderFooterSize : + landscape ? dualPageHeaderFooterSize : headerFooterSize; verticalOffsetForScrolling = topBottom; - setPadding(horizontalSafeOffset, - topBottom + topSafeOffset, - horizontalSafeOffset, - topBottom + bottomSafeOffset); fontSize = scrollable ? scrollableHeaderFooterFontSize : landscape ? dualPageHeaderFooterFontSize : headerFooterFontSize; } @@ -525,6 +522,15 @@ protected void onDraw(@NonNull Canvas canvas) { overlayText(canvas, getImageMatrix()); } + if(!didDraw){ + setPadding(horizontalSafeOffset, topSafeOffset, horizontalSafeOffset, bottomSafeOffset); + } else { + setPadding(horizontalSafeOffset, + topBottom + topSafeOffset, + horizontalSafeOffset, + topBottom + bottomSafeOffset); + } + // run additional image draw helpers if any if (imageDrawHelpers != null && pageCoordinates != null) { for (ImageDrawHelper imageDrawHelper : imageDrawHelpers) {