mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
Fixed set status tracking dialog + hide tracked filter conditions
show only if logged into a service
This commit is contained in:
parent
36b893efe1
commit
c5ad0fc692
@ -5,6 +5,7 @@ import android.util.AttributeSet
|
|||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
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.ui.catalogue.filter.TriStateItem
|
||||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
||||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.MultiSort.Companion.SORT_ASC
|
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_IGNORE
|
||||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_INCLUDE
|
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_INCLUDE
|
||||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView.Item.TriStateGroup.Companion.STATE_EXCLUDE
|
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
|
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)
|
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)
|
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()
|
unread.state = preferences.filterUnread().getOrDefault()
|
||||||
completed.state = preferences.filterCompleted().getOrDefault()
|
completed.state = preferences.filterCompleted().getOrDefault()
|
||||||
tracked.state = preferences.filterTracked().getOrDefault()
|
tracked.state = preferences.filterTracked().getOrDefault()
|
||||||
tracked
|
|
||||||
}
|
}
|
||||||
catch (e: Exception) {
|
catch (e: Exception) {
|
||||||
preferences.upgradeFilters()
|
preferences.upgradeFilters()
|
||||||
|
@ -40,6 +40,7 @@ class SetTrackStatusDialog<T> : DialogController
|
|||||||
return MaterialDialog(activity!!)
|
return MaterialDialog(activity!!)
|
||||||
.title(R.string.status)
|
.title(R.string.status)
|
||||||
.negativeButton(android.R.string.cancel)
|
.negativeButton(android.R.string.cancel)
|
||||||
|
.positiveButton(android.R.string.ok)
|
||||||
.listItemsSingleChoice(items = statusString, initialSelection = selectedIndex)
|
.listItemsSingleChoice(items = statusString, initialSelection = selectedIndex)
|
||||||
{ dialog, position, _ ->
|
{ dialog, position, _ ->
|
||||||
(targetController as? Listener)?.setStatus(item, position)
|
(targetController as? Listener)?.setStatus(item, position)
|
||||||
|
Loading…
Reference in New Issue
Block a user