Removed scrolling FAB.
This commit is contained in:
parent
81972c3e2c
commit
d263af94f2
2 changed files with 2 additions and 67 deletions
|
@ -48,7 +48,6 @@ import net.thauvin.erik.android.tesremoteprogrammer.models.Params
|
|||
import net.thauvin.erik.android.tesremoteprogrammer.util.Dtmf
|
||||
import net.thauvin.erik.android.tesremoteprogrammer.util.isDKS
|
||||
import net.thauvin.erik.android.tesremoteprogrammer.util.isLinear
|
||||
import net.thauvin.erik.android.tesremoteprogrammer.widget.ScrollAwareFABBehavior
|
||||
import net.thauvin.erik.android.tesremoteprogrammer.util.toDialPad
|
||||
import org.jetbrains.anko.AnkoLogger
|
||||
import org.jetbrains.anko.bottomPadding
|
||||
|
@ -101,8 +100,8 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
|||
}.lparams(width = matchParent, height = matchParent)
|
||||
|
||||
nestedScrollView {
|
||||
topPadding = dip(50)
|
||||
bottomPadding = dip(30)
|
||||
topPadding = dip(80)
|
||||
bottomPadding = dip(84)
|
||||
horizontalPadding = dip(20)
|
||||
|
||||
verticalLayout {
|
||||
|
@ -200,7 +199,6 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
|||
|
||||
bottomMargin = dip(16)
|
||||
elevation = dip(6).toFloat()
|
||||
behavior = ScrollAwareFABBehavior()
|
||||
}.setOnClickListener {
|
||||
if (validateFields(params.type, fields, option)) {
|
||||
val dtmf = Dtmf.build(params.type, params.master, params.ack, option, fields)
|
||||
|
@ -249,7 +247,6 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
|||
bottomMargin = dip(16)
|
||||
rightMargin = dip(16)
|
||||
elevation = dip(6).toFloat()
|
||||
behavior = ScrollAwareFABBehavior()
|
||||
}.setOnClickListener {
|
||||
if (validateFieldsForCall(params.type, fields)) {
|
||||
if (validateFields(params.type, fields, option)) {
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* ScrollAwareFABBehavior.kt
|
||||
*
|
||||
* Copyright 2016-2018 Erik C. Thauvin (erik@thauvin.net)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.thauvin.erik.android.tesremoteprogrammer.widget
|
||||
|
||||
import android.support.design.widget.CoordinatorLayout
|
||||
import android.support.design.widget.FloatingActionButton
|
||||
import android.support.v4.view.ViewCompat
|
||||
import android.view.View
|
||||
|
||||
class ScrollAwareFABBehavior : FloatingActionButton.Behavior() {
|
||||
override fun onStartNestedScroll(
|
||||
coordinatorLayout: CoordinatorLayout,
|
||||
child: FloatingActionButton,
|
||||
directTargetChild: View,
|
||||
target: View,
|
||||
nestedScrollAxes: Int,
|
||||
type: Int
|
||||
): Boolean =
|
||||
nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
|
||||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
|
||||
nestedScrollAxes, type)
|
||||
|
||||
override fun onNestedScroll(
|
||||
coordinatorLayout: CoordinatorLayout,
|
||||
child: FloatingActionButton,
|
||||
target: View,
|
||||
dxConsumed: Int,
|
||||
dyConsumed: Int,
|
||||
dxUnconsumed: Int,
|
||||
dyUnconsumed: Int,
|
||||
type: Int
|
||||
) {
|
||||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
|
||||
dxUnconsumed, dyUnconsumed, type)
|
||||
if (dyConsumed > 0 && child.visibility == View.VISIBLE) {
|
||||
// see: https://stackoverflow.com/a/42082313/5640587
|
||||
child.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||
override fun onHidden(fab: FloatingActionButton?) {
|
||||
super.onHidden(fab)
|
||||
fab!!.visibility = View.INVISIBLE
|
||||
}
|
||||
})
|
||||
} else if (dyConsumed < 0 && child.visibility != View.VISIBLE) {
|
||||
child.show()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue