use of com.quran.labs.androidquran.widgets.JuzView in project quran_android by quran.
the class QuranListAdapter method bindRow.
private void bindRow(HeaderHolder vh, int position) {
ViewHolder holder = (ViewHolder) vh;
final QuranRow item = elements[position];
bindHeader(vh, position);
holder.number.setText(QuranUtils.getLocalizedNumber(context, item.sura));
holder.metadata.setVisibility(View.VISIBLE);
holder.metadata.setText(item.metadata);
holder.tags.setVisibility(View.GONE);
if (item.juzType != null) {
holder.image.setImageDrawable(new JuzView(context, item.juzType, item.juzOverlayText));
holder.image.setVisibility(View.VISIBLE);
holder.number.setVisibility(View.GONE);
} else if (item.imageResource == null) {
holder.number.setVisibility(View.VISIBLE);
holder.image.setVisibility(View.GONE);
} else {
holder.image.setImageResource(item.imageResource);
if (item.imageFilterColor == null) {
holder.image.setColorFilter(null);
} else {
holder.image.setColorFilter(item.imageFilterColor, PorterDuff.Mode.SRC_ATOP);
}
holder.image.setVisibility(View.VISIBLE);
holder.number.setVisibility(View.GONE);
List<Tag> tags = new ArrayList<>();
Bookmark bookmark = item.bookmark;
if (bookmark != null && !bookmark.tags.isEmpty() && showTags) {
for (int i = 0, bookmarkTags = bookmark.tags.size(); i < bookmarkTags; i++) {
Long tagId = bookmark.tags.get(i);
Tag tag = tagMap.get(tagId);
if (tag != null) {
tags.add(tag);
}
}
}
if (tags.isEmpty()) {
holder.tags.setVisibility(View.GONE);
} else {
holder.tags.setTags(tags);
holder.tags.setVisibility(View.VISIBLE);
}
}
}