public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton child, View dependency) { if (dependency instanceof SnackbarLayout) { updateFabTranslationForSnackbar(parent, child, dependency); } else if (dependency instanceof AppBarLayout) { updateFabVisibility(parent, (AppBarLayout) dependency, child); } return false; }
private float getFabTranslationYForSnackbar(CoordinatorLayout parent, FloatingActionButton fab) { float minOffset = 0.0f; List<View> dependencies = parent.getDependencies(fab); int z = dependencies.size(); for (int i = 0; i < z; i++) { View view = (View) dependencies.get(i); if ((view instanceof SnackbarLayout) && parent.doViewsOverlap(fab, view)) { minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - ((float) view.getHeight())); } } return minOffset; }
@Override public boolean onDependentViewChanged(final CoordinatorLayout parent, final BottomNavigation child, View dependency) { if (isSnackbar(dependency)) { if (null == snackbarDependentView) { snackbarDependentView = new SnackBarDependentView((SnackbarLayout) dependency, height, bottomInset); } return snackbarDependentView.onDependentViewChanged(parent, child); } return super.onDependentViewChanged(parent, child, dependency); }
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionButton child, View dependency) { return SNACKBAR_BEHAVIOR_ENABLED && (dependency instanceof SnackbarLayout); }
private boolean isSnackbar(@NonNull final View view) { return SnackbarLayout.class.isInstance(view); }
SnackBarDependentView(final SnackbarLayout child, final int height, final int bottomInset) { super(child, height, bottomInset); }