FABProgressCircle
FABProgressCircle copied to clipboard
FAB does not move up to make space for a snackbar
Hi, the fab does not move up in order to make space for a Snackbar, like intended by the CoordinatorLayout behaviour.
@AlexLardschneider You can create your own behavior (check this link https://github.com/ggajews/coordinatorlayoutwithfabdemo) and than assign it to your FabProgressCircleView like this
app:layout_behavior="your_behavior_path.FloatingActionBarBehavior"
use
public class FloatingActionButtonBehavior extends CoordinatorLayout.Behavior<FABProgressCircle>
instead of
public class FloatingActionButtonBehavior extends CoordinatorLayout.Behavior<FloatingActionButton>
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar.SnackbarLayout;
import android.util.AttributeSet;
import android.view.View;
import com.github.jorgecastilloprz.FABProgressCircle;
public class FloatingActionButtonBehaviour extends CoordinatorLayout.Behavior<FABProgressCircle> {
public FloatingActionButtonBehaviour(Context context, AttributeSet attrs) {
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FABProgressCircle child, View dependency) {
float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
child.setTranslationY(translationY);
return true;
}
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, FABProgressCircle child, View dependency) {
return dependency instanceof SnackbarLayout;
}
}
´´´
Thank you @barisemreefe and @7wonders. It works like a charm!