Fix issue with list adapter.

This commit is contained in:
Amine Bou 2018-01-12 06:24:06 +01:00
parent 0d007f1492
commit ec71ab3c6f

View File

@ -67,7 +67,6 @@ class ItemListAdapter(
val itm = items[position] val itm = items[position]
holder.mView.favButton.isLiked = itm.starred
holder.mView.title.text = Html.fromHtml(itm.title) holder.mView.title.text = Html.fromHtml(itm.title)
holder.mView.sourceTitleAndDate.text = itm.sourceAndDateText() holder.mView.sourceTitleAndDate.text = itm.sourceAndDateText()
@ -108,9 +107,14 @@ class ItemListAdapter(
c.bitmapCenterCrop(itm.getThumbnail(c), holder.mView.itemImage) c.bitmapCenterCrop(itm.getThumbnail(c), holder.mView.itemImage)
} }
if (bars[position]) { // TODO: maybe handle this differently. It crashes when changing tab
holder.mView.actionBar.visibility = View.VISIBLE try {
} else { if (bars[position]) {
holder.mView.actionBar.visibility = View.VISIBLE
} else {
holder.mView.actionBar.visibility = View.GONE
}
} catch (e: IndexOutOfBoundsException) {
holder.mView.actionBar.visibility = View.GONE holder.mView.actionBar.visibility = View.GONE
} }