Java Code Examples for androidx.coordinatorlayout.widget.CoordinatorLayout#doViewsOverlap()

The following examples show how to use androidx.coordinatorlayout.widget.CoordinatorLayout#doViewsOverlap() . 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: FABMenu.java    From Jockey with Apache License 2.0 6 votes vote down vote up
private float getFabTranslationYForSnackbar(CoordinatorLayout parent,
                                            FloatingActionButton fab) {
    float minOffset = 0.0F;
    List dependencies = parent.getDependencies(fab);
    int i = 0;

    for (int z = dependencies.size(); i < z; ++i) {
        View view = (View) dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(
                    minOffset, view.getTranslationY() - (float) view.getHeight());
        }
    }

    return minOffset;
}
 
Example 2
Source File: EhDrawerLayout.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
private float getChildTranslationYForSnackbar(CoordinatorLayout parent,
        EhDrawerLayout child) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(child);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) {
            minOffset = Math.min(minOffset,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 3
Source File: AppBarBoundFabBehavior.java    From appbarsyncedfab with Apache License 2.0 5 votes vote down vote up
/**
 * returns visible height of snackbar, if snackbar is overlapping fab
 * 0 otherwise
 */
private float getVisibleHeightOfOverlappingSnackbar(CoordinatorLayout parent,
                                                    FloatingActionButton fab) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(fab);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset, view.getTranslationY() - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 4
Source File: BottomNavBarFabBehaviour.java    From BottomNavigation with Apache License 2.0 5 votes vote down vote up
private float getFabTranslationYForSnackBar(CoordinatorLayout parent,
                                            FloatingActionButton fab) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(fab);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset,
                    view.getTranslationY() - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 5
Source File: EhDrawerLayout.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private float getChildTranslationYForSnackbar(CoordinatorLayout parent,
        EhDrawerLayout child) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(child);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) {
            minOffset = Math.min(minOffset,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 6
Source File: SnackbarBehavior.java    From CircleIndicator with Apache License 2.0 5 votes vote down vote up
private float getTranslationYForSnackbar(CoordinatorLayout parent, BaseCircleIndicator ci) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(ci);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(ci, view)) {
            minOffset = Math.min(minOffset, view.getTranslationY() - view.getHeight());
        }
    }

    return minOffset;
}