mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 03:59:19 +01:00
Remove hide option from local source
This commit is contained in:
parent
54cfb2acdf
commit
58ba29fa16
@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.databinding.SourceMainControllerBinding
|
import eu.kanade.tachiyomi.databinding.SourceMainControllerBinding
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
|
import eu.kanade.tachiyomi.source.LocalSource
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe
|
import eu.kanade.tachiyomi.ui.base.controller.requestPermissionsSafe
|
||||||
@ -129,19 +130,23 @@ class SourceController :
|
|||||||
|
|
||||||
val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
|
val isPinned = item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
|
||||||
|
|
||||||
|
val items = mutableListOf(
|
||||||
|
Pair(
|
||||||
|
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin),
|
||||||
|
{ pinCatalogue(item.source, isPinned) }
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (item.source !is LocalSource) {
|
||||||
|
items.add(Pair(activity.getString(R.string.action_hide), { hideCatalogue(item.source) }))
|
||||||
|
}
|
||||||
|
|
||||||
MaterialDialog(activity)
|
MaterialDialog(activity)
|
||||||
.title(text = item.source.name)
|
.title(text = item.source.name)
|
||||||
.listItems(
|
.listItems(
|
||||||
items = listOf(
|
items = items.map { it.first },
|
||||||
activity.getString(R.string.action_hide),
|
|
||||||
activity.getString(if (isPinned) R.string.action_unpin else R.string.action_pin)
|
|
||||||
),
|
|
||||||
waitForPositiveButton = false
|
waitForPositiveButton = false
|
||||||
) { dialog, which, _ ->
|
) { dialog, which, _ ->
|
||||||
when (which) {
|
items[which].second()
|
||||||
0 -> hideCatalogue(item.source)
|
|
||||||
1 -> pinCatalogue(item.source, isPinned)
|
|
||||||
}
|
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user