mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Hide sorting options on EH manga when 'force ascending sort on gallery versions' is enabled
This commit is contained in:
		@@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.R
 | 
			
		||||
import eu.kanade.tachiyomi.data.database.models.Chapter
 | 
			
		||||
import eu.kanade.tachiyomi.data.database.models.Manga
 | 
			
		||||
import eu.kanade.tachiyomi.data.download.model.Download
 | 
			
		||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
 | 
			
		||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
 | 
			
		||||
import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag
 | 
			
		||||
import eu.kanade.tachiyomi.ui.manga.MangaController
 | 
			
		||||
@@ -30,6 +31,7 @@ import eu.kanade.tachiyomi.util.snack
 | 
			
		||||
import eu.kanade.tachiyomi.util.toast
 | 
			
		||||
import exh.EH_SOURCE_ID
 | 
			
		||||
import exh.EXH_SOURCE_ID
 | 
			
		||||
import exh.isEhBasedSource
 | 
			
		||||
import kotlinx.android.synthetic.main.chapters_controller.*
 | 
			
		||||
import rx.android.schedulers.AndroidSchedulers
 | 
			
		||||
import timber.log.Timber
 | 
			
		||||
@@ -146,6 +148,8 @@ class ChaptersController : NucleusController<ChaptersPresenter>(),
 | 
			
		||||
        val menuFilterUnread = menu.findItem(R.id.action_filter_unread)
 | 
			
		||||
        val menuFilterDownloaded = menu.findItem(R.id.action_filter_downloaded)
 | 
			
		||||
        val menuFilterBookmarked = menu.findItem(R.id.action_filter_bookmarked)
 | 
			
		||||
        val menuSort = menu.findItem(R.id.action_sort)
 | 
			
		||||
        val menuSortingMode = menu.findItem(R.id.action_sorting_mode)
 | 
			
		||||
 | 
			
		||||
        // Set correct checkbox values.
 | 
			
		||||
        menuFilterRead.isChecked = presenter.onlyRead()
 | 
			
		||||
@@ -153,6 +157,11 @@ class ChaptersController : NucleusController<ChaptersPresenter>(),
 | 
			
		||||
        menuFilterDownloaded.isChecked = presenter.onlyDownloaded()
 | 
			
		||||
        menuFilterBookmarked.isChecked = presenter.onlyBookmarked()
 | 
			
		||||
 | 
			
		||||
        val showSortOptions = !(presenter.preferences.eh_forceSortEhVersionsAsc().getOrDefault()
 | 
			
		||||
                && presenter.source.isEhBasedSource())
 | 
			
		||||
        menuSort.isVisible = showSortOptions
 | 
			
		||||
        menuSortingMode.isVisible = showSortOptions
 | 
			
		||||
 | 
			
		||||
        if (presenter.onlyRead())
 | 
			
		||||
            //Disable unread filter option if read filter is enabled.
 | 
			
		||||
            menuFilterUnread.isEnabled = false
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package exh
 | 
			
		||||
 | 
			
		||||
import eu.kanade.tachiyomi.source.Source
 | 
			
		||||
import eu.kanade.tachiyomi.source.SourceManager
 | 
			
		||||
import eu.kanade.tachiyomi.source.online.english.HentaiCafe
 | 
			
		||||
 | 
			
		||||
@@ -36,3 +37,5 @@ private val lewdDelegatedSourceIds = SourceManager.DELEGATED_SOURCES.filter {
 | 
			
		||||
// This method MUST be fast!
 | 
			
		||||
fun isLewdSource(source: Long) = source in 6900..6999
 | 
			
		||||
        || lewdDelegatedSourceIds.binarySearch(source) >= 0
 | 
			
		||||
 | 
			
		||||
fun Source.isEhBasedSource() = id == EH_SOURCE_ID || id == EXH_SOURCE_ID
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user