Java Code Examples for android.support.design.widget.FloatingActionButton#Behavior

The following examples show how to use android.support.design.widget.FloatingActionButton#Behavior . 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: MainNavigationActivity.java    From beaconloc with Apache License 2.0 6 votes vote down vote up
public void hideFab() {
    fab.clearAnimation();
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.hide_fab);
    fab.startAnimation(animation);

    CoordinatorLayout.LayoutParams params =
            (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
    FloatingActionButton.Behavior behavior =
            (FloatingActionButton.Behavior) params.getBehavior();

    if (behavior != null) {
        behavior.setAutoHideEnabled(false);
    }

    fab.hide();
}
 
Example 2
Source File: MainActivity.java    From v9porn with MIT License 5 votes vote down vote up
private void hideFloatingActionButton(FloatingActionButton fabSearch) {
    ViewGroup.LayoutParams layoutParams = fabSearch.getLayoutParams();
    if (layoutParams instanceof CoordinatorLayout.LayoutParams) {
        CoordinatorLayout.LayoutParams coLayoutParams = (CoordinatorLayout.LayoutParams) layoutParams;
        FloatingActionButton.Behavior behavior = new FloatingActionButton.Behavior();
        coLayoutParams.setBehavior(behavior);
    }
    fabSearch.hide();
}
 
Example 3
Source File: MainActivity.java    From v9porn with MIT License 5 votes vote down vote up
private void hideFloatingActionButton(FloatingActionButton fabSearch) {
    ViewGroup.LayoutParams layoutParams = fabSearch.getLayoutParams();
    if (layoutParams instanceof CoordinatorLayout.LayoutParams) {
        CoordinatorLayout.LayoutParams coLayoutParams = (CoordinatorLayout.LayoutParams) layoutParams;
        FloatingActionButton.Behavior behavior = new FloatingActionButton.Behavior();
        coLayoutParams.setBehavior(behavior);
    }
    fabSearch.hide();
}
 
Example 4
Source File: MainNavigationActivity.java    From beaconloc with Apache License 2.0 5 votes vote down vote up
public void swappingFabUp() {
    fab.clearAnimation();
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.pop_up);
    fab.startAnimation(animation);
    fab.show();
    CoordinatorLayout.LayoutParams params =
            (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
    FloatingActionButton.Behavior behavior =
            (FloatingActionButton.Behavior) params.getBehavior();

    if (behavior != null) {
        behavior.setAutoHideEnabled(true);
    }
}