Updated category headers

closes #307
This commit is contained in:
Jay 2020-05-04 15:59:10 -04:00
parent 17f0754405
commit ba2d5e4a6d
2 changed files with 3 additions and 7 deletions

View File

@ -159,15 +159,14 @@ class LibraryHeaderItem(
val isAscending = category.isAscending()
val sortingMode = category.sortingMode()
val sortDrawable = if (category.isHidden) R.drawable.ic_expand_more_24dp
else when {
val sortDrawable = when {
sortingMode == LibrarySort.DRAG_AND_DROP || sortingMode == null -> R.drawable.ic_sort_white_24dp
if (sortingMode == LibrarySort.DATE_ADDED || sortingMode == LibrarySort.LATEST_CHAPTER || sortingMode == LibrarySort.LAST_READ) !isAscending else isAscending -> R.drawable.ic_arrow_down_white_24dp
else -> R.drawable.ic_arrow_up_white_24dp
}
sortText.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, sortDrawable, 0)
sortText.setText(if (category.isHidden) R.string.collasped else category.sortRes())
sortText.setText(category.sortRes())
expandImage.setImageResource(
if (category.isHidden) R.drawable.ic_expand_more_24dp
else R.drawable.ic_expand_less_24dp)
@ -210,10 +209,6 @@ class LibraryHeaderItem(
private fun showCatSortOptions() {
val category =
(adapter.getItem(adapterPosition) as? LibraryHeaderItem)?.category ?: return
if (category.isHidden) {
adapter.libraryListener.toggleCategoryVisibility(adapterPosition)
return
}
// Create a PopupMenu, giving it the clicked view for an anchor
val popup = PopupMenu(itemView.context, sortText)

View File

@ -35,6 +35,7 @@
<ImageView
android:id="@+id/collapse_arrow"
android:layout_marginStart="8dp"
android:layout_width="14dp"
android:layout_height="wrap_content"
android:contentDescription="@string/select_all"