mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 18:11:53 +01:00
UI changes for library
Sort Arrow now point to the right direction for date add/latest chapter/last read Fast scroll now has an option to reach the bottom
This commit is contained in:
parent
3a941fa0e7
commit
26c5214d2e
@ -95,10 +95,11 @@ class LibraryCategoryAdapter(val libraryListener: LibraryListener) :
|
|||||||
fun getSectionText(position: Int): String? {
|
fun getSectionText(position: Int): String? {
|
||||||
val preferences: PreferencesHelper by injectLazy()
|
val preferences: PreferencesHelper by injectLazy()
|
||||||
val db: DatabaseHelper by injectLazy()
|
val db: DatabaseHelper by injectLazy()
|
||||||
|
if (position == itemCount - 1) return "-"
|
||||||
return when (val item: IFlexible<*>? = getItem(position)) {
|
return when (val item: IFlexible<*>? = getItem(position)) {
|
||||||
is LibraryHeaderItem ->
|
is LibraryHeaderItem ->
|
||||||
if (preferences.hideCategories().getOrDefault() || item.category.id == 0) null
|
if (preferences.hideCategories().getOrDefault() || item.category.id == 0) null
|
||||||
else getFirstLetter(item.category.name) +
|
else item.category.name.first().toString() +
|
||||||
"\u200B".repeat(max(0, item.category.order))
|
"\u200B".repeat(max(0, item.category.order))
|
||||||
is LibraryItem -> {
|
is LibraryItem -> {
|
||||||
when (preferences.librarySortingMode().getOrDefault()) {
|
when (preferences.librarySortingMode().getOrDefault()) {
|
||||||
@ -156,12 +157,14 @@ class LibraryCategoryAdapter(val libraryListener: LibraryListener) :
|
|||||||
override fun onCreateBubbleText(position: Int): String {
|
override fun onCreateBubbleText(position: Int): String {
|
||||||
val preferences: PreferencesHelper by injectLazy()
|
val preferences: PreferencesHelper by injectLazy()
|
||||||
val db: DatabaseHelper by injectLazy()
|
val db: DatabaseHelper by injectLazy()
|
||||||
|
if (position == itemCount - 1) return recyclerView.context.getString(R.string.bottom)
|
||||||
return when (val iFlexible: IFlexible<*>? = getItem(position)) {
|
return when (val iFlexible: IFlexible<*>? = getItem(position)) {
|
||||||
is LibraryHeaderItem ->
|
is LibraryHeaderItem ->
|
||||||
if (!preferences.hideCategories().getOrDefault()) iFlexible.category.name
|
if (!preferences.hideCategories().getOrDefault()) iFlexible.category.name
|
||||||
else recyclerView.context.getString(R.string.top)
|
else recyclerView.context.getString(R.string.top)
|
||||||
is LibraryItem -> {
|
is LibraryItem -> {
|
||||||
when (preferences.librarySortingMode().getOrDefault()) {
|
if (iFlexible.manga.isBlank()) ""
|
||||||
|
else when (preferences.librarySortingMode().getOrDefault()) {
|
||||||
LibrarySort.DRAG_AND_DROP -> {
|
LibrarySort.DRAG_AND_DROP -> {
|
||||||
if (!preferences.hideCategories().getOrDefault()) {
|
if (!preferences.hideCategories().getOrDefault()) {
|
||||||
val title = iFlexible.manga.title
|
val title = iFlexible.manga.title
|
||||||
|
@ -227,7 +227,9 @@ class LibraryController(
|
|||||||
recycler.adapter = adapter
|
recycler.adapter = adapter
|
||||||
fast_scroller.setupWithRecyclerView(recycler, { position ->
|
fast_scroller.setupWithRecyclerView(recycler, { position ->
|
||||||
val letter = adapter.getSectionText(position)
|
val letter = adapter.getSectionText(position)
|
||||||
if (!singleCategory && !adapter.isHeader(adapter.getItem(position))) null
|
if (!singleCategory &&
|
||||||
|
!adapter.isHeader(adapter.getItem(position)) &&
|
||||||
|
position != adapter.itemCount - 1) null
|
||||||
else if (letter != null) FastScrollItemIndicator.Text(letter)
|
else if (letter != null) FastScrollItemIndicator.Text(letter)
|
||||||
else FastScrollItemIndicator.Icon(R.drawable.star)
|
else FastScrollItemIndicator.Icon(R.drawable.star)
|
||||||
})
|
})
|
||||||
@ -442,7 +444,6 @@ class LibraryController(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
adapter.setItems(mangaMap)
|
adapter.setItems(mangaMap)
|
||||||
adapter.collapse(0)
|
|
||||||
singleCategory = presenter.categories.size <= 1
|
singleCategory = presenter.categories.size <= 1
|
||||||
|
|
||||||
setTitle()
|
setTitle()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package eu.kanade.tachiyomi.ui.library
|
package eu.kanade.tachiyomi.ui.library
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.text.SpannableString
|
||||||
|
import android.text.style.ForegroundColorSpan
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
@ -192,13 +194,21 @@ class LibraryHeaderItem(
|
|||||||
m.setOptionalIconsVisible(true)
|
m.setOptionalIconsVisible(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val isAscending = category.isAscending()
|
||||||
|
|
||||||
currentItem?.icon = tintVector(
|
currentItem?.icon = tintVector(
|
||||||
when {
|
when {
|
||||||
sortingMode == LibrarySort.DRAG_AND_DROP -> R.drawable.ic_check_white_24dp
|
sortingMode == LibrarySort.DRAG_AND_DROP -> R.drawable.ic_check_white_24dp
|
||||||
category.isAscending() -> R.drawable.ic_arrow_up_white_24dp
|
if (sortingMode == LibrarySort.DATE_ADDED ||
|
||||||
else -> R.drawable.ic_arrow_down_white_24dp
|
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
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
val s = SpannableString(currentItem?.title ?: "")
|
||||||
|
s.setSpan(ForegroundColorSpan(itemView.context.getResourceColor(android.R.attr.colorAccent)), 0, s.length, 0)
|
||||||
|
currentItem?.title = s
|
||||||
|
|
||||||
// Finally show the PopupMenu
|
// Finally show the PopupMenu
|
||||||
popup.show()
|
popup.show()
|
||||||
|
@ -59,7 +59,7 @@ class RecentsPresenter(
|
|||||||
val calWeek = Calendar.getInstance()
|
val calWeek = Calendar.getInstance()
|
||||||
calWeek.time = Date()
|
calWeek.time = Date()
|
||||||
if (query.isNotEmpty()) calWeek.add(Calendar.YEAR, -50)
|
if (query.isNotEmpty()) calWeek.add(Calendar.YEAR, -50)
|
||||||
else calWeek.add(Calendar.WEEK_OF_MONTH, -1)
|
else calWeek.add(Calendar.WEEK_OF_YEAR, -1)
|
||||||
|
|
||||||
val calDay = Calendar.getInstance()
|
val calDay = Calendar.getInstance()
|
||||||
calDay.time = Date()
|
calDay.time = Date()
|
||||||
|
Loading…
Reference in New Issue
Block a user