Last active
August 19, 2019 10:59
-
-
Save lodlock/e3cd12130bad70a098db to your computer and use it in GitHub Desktop.
Quick behavior that allows for https://github.com/Clans/FloatingActionButton to be compatible with CoordinatorLayout. Add app:layout_behavior="wherever.you.want.to.keep.your.behaviors.FloatingActionMenuBehavior" (of course modify it to match your code) to your FloatingActionMenu that resides within a CoordinatorLayout.
There's a problem when i try to dismiss a Snackbar. The FloatingActionMenu doesn't go back to the bottom. Can you please verify that?
I could make it working by adding the following lines to the FloatingActionMenuBehavior class:
@Override
public void onDependentViewRemoved(CoordinatorLayout parent, View child, View dependency) {
if (child instanceof FloatingActionMenu && dependency instanceof Snackbar.SnackbarLayout) {
this.updateTranslation(parent, child, dependency);
}
}
This is very helpful, thank you very much!
Thanks a lot
+1 for that onDependentViewRemoved(). Thanks a lot
+100 to karma. Thank you!
Modified to support FloatingActionButton
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
if ((child instanceof FloatingActionMenu || child instanceof FloatingActionButton)
&& dependency instanceof Snackbar.SnackbarLayout) {
this.updateTranslation(parent, child, dependency);
}
return false;
}
@Override
public void onDependentViewRemoved(CoordinatorLayout parent, View child, View dependency) {
if ((child instanceof FloatingActionMenu || child instanceof FloatingActionButton)
&& dependency instanceof Snackbar.SnackbarLayout) {
this.updateTranslation(parent, child, dependency);
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1 Thank you very much ;-)