quran_android icon indicating copy to clipboard operation
quran_android copied to clipboard

Refactor HighlightingImageView

Open murtraja opened this issue 3 years ago • 1 comments

This issue stems out from the discussion at #1313 (Floating Highlights) where it was proposed that HighlightingImageView is too cluttered and needs to be refactored out into standalone classes. Some classes related to ayah animation were already extracted out, but two remained. Need some pointers on how to deal with them as:

only two classes remain. AnimationUpdateListener and OverlayParams. These classes are using some members from the enclosing class, so I am not sure how will I refactor them.

More specifically, AnimationUpdateListener uses the following:

  1. invalidate(): to refresh the view, as we now have newly calculated animation coords
  2. highlightCoordinates: to put the newly calculated coords

OverlayParams uses the following:

  1. invalidate(): to refresh the view
  2. a bunch of constants which can be easily taken care of
  3. pageBounds: which is used exclusively by this class, so can be easily dealt with

Please note: in the actual code OverlayParams is a static data class, what I am referring to here is the "concept" of overlay parameters which can be refactored out. So, technically, in order to refactor, I have to not only create the class after including necessary methods in it, but also move it out from HighlightingImageView.

murtraja avatar Sep 19 '20 12:09 murtraja

@aabdurrahman I see that you've contributed in this respect. Feel free to close this issue.

murtraja avatar Feb 21 '22 17:02 murtraja