use of com.quran.labs.androidquran.ui.helpers.HighlightType in project quran_android by quran.
the class HighlightingImageView method onDraw.
@Override
protected void onDraw(@NonNull Canvas canvas) {
super.onDraw(canvas);
final Drawable d = getDrawable();
if (d == null) {
// no image, forget it.
return;
}
final Matrix matrix = getImageMatrix();
// Draw overlay text
didDraw = false;
if (overlayParams != null) {
overlayText(canvas, matrix);
}
// Draw each ayah highlight
if (coordinatesData != null && !currentHighlights.isEmpty()) {
alreadyHighlighted.clear();
for (Map.Entry<HighlightType, Set<String>> entry : currentHighlights.entrySet()) {
Paint paint = getPaintForHighlightType(entry.getKey());
for (String ayah : entry.getValue()) {
if (alreadyHighlighted.contains(ayah))
continue;
List<AyahBounds> rangesToDraw = coordinatesData.get(ayah);
if (rangesToDraw != null && !rangesToDraw.isEmpty()) {
for (AyahBounds b : rangesToDraw) {
matrix.mapRect(scaledRect, b.getBounds());
scaledRect.offset(0, getPaddingTop());
canvas.drawRect(scaledRect, paint);
}
alreadyHighlighted.add(ayah);
}
}
}
}
}
Aggregations