Refactor BaseBottomSheetDialog to set maxWidth with newer API
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.reader
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.ReaderPageSheetBinding
|
||||
@@ -15,14 +17,16 @@ class ReaderPageSheet(
|
||||
private val page: ReaderPage
|
||||
) : BaseBottomSheetDialog(activity) {
|
||||
|
||||
private val binding = ReaderPageSheetBinding.inflate(activity.layoutInflater, null, false)
|
||||
private lateinit var binding: ReaderPageSheetBinding
|
||||
|
||||
init {
|
||||
setContentView(binding.root)
|
||||
override fun createView(inflater: LayoutInflater): View {
|
||||
binding = ReaderPageSheetBinding.inflate(activity.layoutInflater, null, false)
|
||||
|
||||
binding.setAsCoverLayout.setOnClickListener { setAsCover() }
|
||||
binding.shareLayout.setOnClickListener { share() }
|
||||
binding.saveLayout.setOnClickListener { save() }
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package eu.kanade.tachiyomi.ui.reader.setting
|
||||
|
||||
import android.view.ViewGroup
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import android.os.Bundle
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||
@@ -10,20 +9,21 @@ import eu.kanade.tachiyomi.widget.sheet.TabbedBottomSheetDialog
|
||||
|
||||
class ReaderSettingsSheet(
|
||||
private val activity: ReaderActivity,
|
||||
showColorFilterSettings: Boolean = false,
|
||||
private val showColorFilterSettings: Boolean = false,
|
||||
) : TabbedBottomSheetDialog(activity) {
|
||||
|
||||
private val readingModeSettings = ReaderReadingModeSettings(activity)
|
||||
private val generalSettings = ReaderGeneralSettings(activity)
|
||||
private val colorFilterSettings = ReaderColorFilterSettings(activity)
|
||||
|
||||
private val sheetBackgroundDim = window?.attributes?.dimAmount ?: 0.25f
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
init {
|
||||
val sheetBehavior = BottomSheetBehavior.from(binding.root.parent as ViewGroup)
|
||||
sheetBehavior.isFitToContents = false
|
||||
sheetBehavior.halfExpandedRatio = 0.25f
|
||||
|
||||
val sheetBackgroundDim = window?.attributes?.dimAmount ?: 0.25f
|
||||
|
||||
val filterTabIndex = getTabViews().indexOf(colorFilterSettings)
|
||||
binding.tabs.addOnTabSelectedListener(object : SimpleTabSelectedListener() {
|
||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||
|
||||
Reference in New Issue
Block a user