Java Code Examples for android.support.design.widget.FloatingActionButton#setClickable()

The following examples show how to use android.support.design.widget.FloatingActionButton#setClickable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FabOnScroll.java    From ForPDA with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dx, int dy, int[] consumed) {
    super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed);
    //Log.d("SUKA", "FabOnScroll onNestedPreScroll" + consumed[1] + " : " + dy);
    if (child.getAlpha() == 0.0f && Math.abs(dy) > App.px24) {
        child.setImageDrawable(App.getVecDrawable(child.getContext(), dy > 0 ? R.drawable.ic_arrow_down : R.drawable.ic_arrow_up));
        child.clearAnimation();
        child.animate()
                .scaleX(1.0f)
                .scaleY(1.0f)
                .alpha(1.0f)
                .setInterpolator(interpolator)
                .start();
        child.setClickable(true);
    }
}
 
Example 2
Source File: FabOnScroll.java    From ForPDA with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, @NonNull View target) {
    super.onStopNestedScroll(coordinatorLayout, child, target);
    if (currentRunnable != null) {
        handler.removeCallbacks(currentRunnable);
    }
    currentRunnable = () -> {
        child.clearAnimation();
        child.animate()
                .scaleX(0.0f)
                .scaleY(0.0f)
                .alpha(0.0f)
                .setInterpolator(interpolator)
                .start();
        child.setClickable(false);
    };
    handler.postDelayed(currentRunnable, 1000);
}
 
Example 3
Source File: FabOnScroll.java    From ForPDA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    //Log.d("SUKA", "FabOnScroll onNestedScroll " + dyConsumed + " : " + dyUnconsumed + " : " + App.px24);
    if (child.getAlpha() == 0.0f && Math.abs(dyUnconsumed) > App.px24) {
        child.clearAnimation();
        child.animate()
                .scaleX(1.0f)
                .scaleY(1.0f)
                .alpha(1.0f)
                .setInterpolator(interpolator)
                .start();
        child.setClickable(true);
    }
}