mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:55:11 +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.ReaderPage
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
import eu.kanade.tachiyomi.ui.reader.model.ViewerChapters
|
||||||
import eu.kanade.tachiyomi.ui.reader.settings.ReadingModeType
|
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.BaseViewer
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.L2RPagerViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.L2RPagerViewer
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PageLayout
|
||||||
@ -610,6 +611,20 @@ class ReaderActivity :
|
|||||||
) preferences.cropBorders() else preferences.cropBordersWebtoon()
|
) preferences.cropBorders() else preferences.cropBordersWebtoon()
|
||||||
pref.toggle()
|
pref.toggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webviewButton.setOnClickListener {
|
||||||
|
openMangaInBrowser()
|
||||||
|
}
|
||||||
|
|
||||||
|
displayOptions.setOnClickListener {
|
||||||
|
TabbedReaderSettingsSheet(this@ReaderActivity).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
displayOptions.setOnLongClickListener {
|
||||||
|
TabbedReaderSettingsSheet(this@ReaderActivity, true).show()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
readingMode.setOnClickListener {
|
readingMode.setOnClickListener {
|
||||||
val popup = PopupMenu(this@ReaderActivity, readingMode, Gravity.END)
|
val popup = PopupMenu(this@ReaderActivity, readingMode, Gravity.END)
|
||||||
val enumConstants = ReadingModeType::class.java.enumConstants
|
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.databinding.ReaderChaptersSheetBinding
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderPresenter
|
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.dpToPx
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.system.launchUI
|
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 {
|
post {
|
||||||
binding.chapterRecycler.alpha = if (sheetBehavior.isExpanded()) 1f else 0f
|
binding.chapterRecycler.alpha = if (sheetBehavior.isExpanded()) 1f else 0f
|
||||||
binding.chapterRecycler.isClickable = sheetBehavior.isExpanded()
|
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.util.view.visible
|
||||||
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
|
import eu.kanade.tachiyomi.widget.TabbedBottomSheetDialog
|
||||||
|
|
||||||
class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
class TabbedReaderSettingsSheet(
|
||||||
TabbedBottomSheetDialog(readerActivity) {
|
val readerActivity: ReaderActivity,
|
||||||
|
showColorFilterSettings: Boolean = false
|
||||||
|
) : TabbedBottomSheetDialog(readerActivity) {
|
||||||
private val generalView: ReaderGeneralView = View.inflate(
|
private val generalView: ReaderGeneralView = View.inflate(
|
||||||
readerActivity,
|
readerActivity,
|
||||||
R.layout.reader_general_layout,
|
R.layout.reader_general_layout,
|
||||||
@ -92,11 +94,12 @@ class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
|||||||
|
|
||||||
val attrs = window?.attributes
|
val attrs = window?.attributes
|
||||||
val ogDim = attrs?.dimAmount ?: 0.25f
|
val ogDim = attrs?.dimAmount ?: 0.25f
|
||||||
|
val filterTabIndex = getTabViews().indexOf(filterView)
|
||||||
binding.pager.adapter?.notifyDataSetChanged()
|
binding.pager.adapter?.notifyDataSetChanged()
|
||||||
binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||||
window?.setDimAmount(if (tab?.position == 2) 0f else ogDim)
|
window?.setDimAmount(if (tab?.position == filterTabIndex) 0f else ogDim)
|
||||||
readerActivity.binding.appBar.visInvisIf(tab?.position != 2)
|
readerActivity.binding.appBar.visInvisIf(tab?.position != filterTabIndex)
|
||||||
if (tab?.position == 2) {
|
if (tab?.position == 2) {
|
||||||
sheetBehavior.skipCollapsed = false
|
sheetBehavior.skipCollapsed = false
|
||||||
sheetBehavior.peekHeight = 110.dpToPx
|
sheetBehavior.peekHeight = 110.dpToPx
|
||||||
@ -114,6 +117,16 @@ class TabbedReaderSettingsSheet(val readerActivity: ReaderActivity) :
|
|||||||
override fun onTabReselected(tab: TabLayout.Tab?) {
|
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() {
|
override fun dismiss() {
|
||||||
|
Loading…
Reference in New Issue
Block a user