mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:01:52 +01:00
Long press reader display options now opens color filters
This commit is contained in:
parent
10a701c211
commit
5b40f10c89
@ -56,6 +56,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
|
||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||
import eu.kanade.tachiyomi.ui.reader.settings.ReadingModeType
|
||||
import eu.kanade.tachiyomi.ui.reader.settings.TabbedReaderSettingsSheet
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.BaseViewer
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.L2RPagerViewer
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
|
||||
@ -610,6 +611,20 @@ class ReaderActivity :
|
||||
) preferences.cropBorders() else preferences.cropBordersWebtoon()
|
||||
pref.toggle()
|
||||
}
|
||||
|
||||
webviewButton.setOnClickListener {
|
||||
openMangaInBrowser()
|
||||
}
|
||||
|
||||
displayOptions.setOnClickListener {
|
||||
TabbedReaderSettingsSheet(this@ReaderActivity).show()
|
||||
}
|
||||
|
||||
displayOptions.setOnLongClickListener {
|
||||
TabbedReaderSettingsSheet(this@ReaderActivity, true).show()
|
||||
true
|
||||
}
|
||||
|
||||
readingMode.setOnClickListener {
|
||||
val popup = PopupMenu(this@ReaderActivity, readingMode, Gravity.END)
|
||||
val enumConstants = ReadingModeType::class.java.enumConstants
|
||||
|
@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.ReaderChaptersSheetBinding
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderPresenter
|
||||
import eu.kanade.tachiyomi.ui.reader.settings.TabbedReaderSettingsSheet
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.system.launchUI
|
||||
@ -66,14 +65,6 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
}
|
||||
}
|
||||
|
||||
binding.webviewButton.setOnClickListener {
|
||||
activity.openMangaInBrowser()
|
||||
}
|
||||
|
||||
binding.displayOptions.setOnClickListener {
|
||||
TabbedReaderSettingsSheet(activity).show()
|
||||
}
|
||||
|
||||
post {
|
||||
binding.chapterRecycler.alpha = if (sheetBehavior.isExpanded()) 1f else 0f
|
||||
binding.chapterRecycler.isClickable = sheetBehavior.isExpanded()
|
||||
|
@ -18,8 +18,10 @@ import eu.kanade.tachiyomi.util.view.visInvisIf
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
|
||||
|
||||
class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
||||
TabbedBottomSheetDialog(readerActivity) {
|
||||
class TabbedReaderSettingsSheet(
|
||||
val readerActivity: ReaderActivity,
|
||||
showColorFilterSettings: Boolean = false
|
||||
) : TabbedBottomSheetDialog(readerActivity) {
|
||||
private val generalView: ReaderGeneralView = View.inflate(
|
||||
readerActivity,
|
||||
R.layout.reader_general_layout,
|
||||
@ -92,11 +94,12 @@ class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
||||
|
||||
val attrs = window?.attributes
|
||||
val ogDim = attrs?.dimAmount ?: 0.25f
|
||||
val filterTabIndex = getTabViews().indexOf(filterView)
|
||||
binding.pager.adapter?.notifyDataSetChanged()
|
||||
binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||
window?.setDimAmount(if (tab?.position == 2) 0f else ogDim)
|
||||
readerActivity.binding.appBar.visInvisIf(tab?.position != 2)
|
||||
window?.setDimAmount(if (tab?.position == filterTabIndex) 0f else ogDim)
|
||||
readerActivity.binding.appBar.visInvisIf(tab?.position != filterTabIndex)
|
||||
if (tab?.position == 2) {
|
||||
sheetBehavior.skipCollapsed = false
|
||||
sheetBehavior.peekHeight = 110.dpToPx
|
||||
@ -114,6 +117,16 @@ class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
||||
override fun onTabReselected(tab: TabLayout.Tab?) {
|
||||
}
|
||||
})
|
||||
|
||||
if (showColorFilterSettings) {
|
||||
binding.tabs.getTabAt(filterTabIndex)?.select()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
val filterTabIndex = getTabViews().indexOf(filterView)
|
||||
sheetBehavior.skipCollapsed = binding.tabs.selectedTabPosition != filterTabIndex
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
|
Loading…
Reference in New Issue
Block a user