mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 18:38:23 +01:00
Reduce height of sheet when on color filter tab
This commit is contained in:
parent
bff73b1b40
commit
e7a8107279
@ -397,6 +397,10 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
* [animate] the views.
|
* [animate] the views.
|
||||||
*/
|
*/
|
||||||
fun setMenuVisibility(visible: Boolean, animate: Boolean = true) {
|
fun setMenuVisibility(visible: Boolean, animate: Boolean = true) {
|
||||||
|
if (visible == menuVisible) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
menuVisible = visible
|
menuVisible = visible
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (preferences.fullscreen().get()) {
|
if (preferences.fullscreen().get()) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.setting
|
package eu.kanade.tachiyomi.ui.reader.setting
|
||||||
|
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
@ -15,6 +17,10 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : TabbedBottomSh
|
|||||||
private val sheetBackgroundDim = window?.attributes?.dimAmount ?: 0.25f
|
private val sheetBackgroundDim = window?.attributes?.dimAmount ?: 0.25f
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
val sheetBehavior = BottomSheetBehavior.from(binding.root.parent as ViewGroup)
|
||||||
|
sheetBehavior.isFitToContents = false
|
||||||
|
sheetBehavior.halfExpandedRatio = 0.5f
|
||||||
|
|
||||||
val filterTabIndex = getTabViews().indexOf(colorFilterSettings)
|
val filterTabIndex = getTabViews().indexOf(colorFilterSettings)
|
||||||
binding.tabs.addOnTabSelectedListener(object : SimpleTabSelectedListener() {
|
binding.tabs.addOnTabSelectedListener(object : SimpleTabSelectedListener() {
|
||||||
// Remove dimmed backdrop so color filter changes can be previewed
|
// Remove dimmed backdrop so color filter changes can be previewed
|
||||||
@ -22,6 +28,9 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : TabbedBottomSh
|
|||||||
val isFilterTab = tab?.position == filterTabIndex
|
val isFilterTab = tab?.position == filterTabIndex
|
||||||
window?.setDimAmount(if (isFilterTab) 0f else sheetBackgroundDim)
|
window?.setDimAmount(if (isFilterTab) 0f else sheetBackgroundDim)
|
||||||
activity.setMenuVisibility(!isFilterTab)
|
activity.setMenuVisibility(!isFilterTab)
|
||||||
|
if (isFilterTab) {
|
||||||
|
sheetBehavior?.state = BottomSheetBehavior.STATE_HALF_EXPANDED
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user