Fixed set status tracking dialog + hide tracked filter conditions

show only if logged into a service
This commit is contained in:
Jay 2020-01-13 18:57:41 -08:00
parent 36b893efe1
commit c5ad0fc692
2 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import android.util.AttributeSet
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.ui.catalogue.filter.TriStateItem
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.MultiSort.Companion.SORT_ASC
@ -13,6 +14,8 @@ import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.MultiSort.Companio
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_IGNORE
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_INCLUDE
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_EXCLUDE
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
/**
@ -81,7 +84,9 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
private val tracked = Item.TriStateGroup(R.string.tracked, this)
override val items = listOf(downloaded, unread, completed, tracked)
override val items = if (Injekt.get<TrackManager>().hasLoggedServices())
listOf(downloaded, unread, completed, tracked) else listOf(downloaded, unread,
completed)
override val header = Item.Header(R.string.action_filter)
@ -93,7 +98,6 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
unread.state = preferences.filterUnread().getOrDefault()
completed.state = preferences.filterCompleted().getOrDefault()
tracked.state = preferences.filterTracked().getOrDefault()
tracked
}
catch (e: Exception) {
preferences.upgradeFilters()

View File

@ -40,6 +40,7 @@ class SetTrackStatusDialog<T> : DialogController
return MaterialDialog(activity!!)
.title(R.string.status)
.negativeButton(android.R.string.cancel)
.positiveButton(android.R.string.ok)
.listItemsSingleChoice(items = statusString, initialSelection = selectedIndex)
{ dialog, position, _ ->
(targetController as? Listener)?.setStatus(item, position)