Fix Continue button behavior
parent
2b9307aa17
commit
452c0edfc7
@ -0,0 +1,39 @@
|
|||||||
|
package org.koitharu.kotatsu.main.ui
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.View
|
||||||
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
|
import org.koitharu.kotatsu.base.ui.util.ShrinkOnScrollBehavior
|
||||||
|
import org.koitharu.kotatsu.base.ui.widgets.SlidingBottomNavigationView
|
||||||
|
|
||||||
|
class MainActionButtonBehavior : ShrinkOnScrollBehavior {
|
||||||
|
|
||||||
|
constructor() : super()
|
||||||
|
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
|
||||||
|
override fun layoutDependsOn(
|
||||||
|
parent: CoordinatorLayout,
|
||||||
|
child: ExtendedFloatingActionButton,
|
||||||
|
dependency: View
|
||||||
|
): Boolean {
|
||||||
|
return dependency is SlidingBottomNavigationView || super.layoutDependsOn(parent, child, dependency)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDependentViewChanged(
|
||||||
|
parent: CoordinatorLayout,
|
||||||
|
child: ExtendedFloatingActionButton,
|
||||||
|
dependency: View
|
||||||
|
): Boolean {
|
||||||
|
val bottom = child.bottom
|
||||||
|
val bottomLine = parent.height
|
||||||
|
return if (bottom > bottomLine) {
|
||||||
|
ViewCompat.offsetTopAndBottom(child, bottomLine - bottom)
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue