Java Code Examples for android.support.design.widget.CoordinatorLayout#doViewsOverlap()

The following examples show how to use android.support.design.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: SkittleContainer.java    From Skittles with MIT License 6 votes vote down vote up
private float getFabTranslationYForSnackbar(CoordinatorLayout parent,
    SkittleContainer container) {
  float minOffset = 0.0F;
  List dependencies = parent.getDependencies(container);
  int i = 0;

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

  return minOffset;
}
 
Example 2
Source File: FABSnackbarBehavior.java    From FABsMenu with Apache License 2.0 5 votes vote down vote up
/**
 * Find the {@code translation Y} value for any child Snackbar components.
 *
 * @return 0.0F if there are no Snackbar components found, otherwise returns the min offset that
 * the FAB component should be animated.
 */
private float getFabTranslationYForSnackbar(CoordinatorLayout parent, View fab) {
    float minOffset = 0.0F;
    final List<View> dependencies = parent.getDependencies(fab);

    for (View view : dependencies) {
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset, view.getTranslationY() - (float) view.getHeight());
        }
    }

    return minOffset;
}
 
Example 3
Source File: BottomNavBarFabBehaviour.java    From JD-Test 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,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 4
Source File: FooterBehavior.java    From Expert-Android-Programming with MIT License 5 votes vote down vote up
private float getTranslationYForSnackbar(CoordinatorLayout parent, FooterLayout footerLayout) {

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

        return minOffset;
    }
 
Example 5
Source File: ShrinkBehavior.java    From AndroidDesignWidgetsSample 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)) {
            Log.d("ddmeng", "getTranslationY " + ViewCompat.getTranslationY(view) + ", getHeight() " + view.getHeight());
            minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 6
Source File: FabSpeedDialBehaviour.java    From fab-speed-dial with Apache License 2.0 5 votes vote down vote up
private float getFabTranslationYForSnackbar(CoordinatorLayout parent,
                                            FabSpeedDial 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,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 7
Source File: BottomButton.java    From citrus with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param parent
 * @param bb
 * @return
 */
private float getFabTranslationYForSnackbar(CoordinatorLayout parent, BottomButton bb) {
    float minOffset = 0.0F;
    List dependencies = parent.getDependencies(bb);
    int i = 0;

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

    return minOffset;
}
 
Example 8
Source File: ShrinkBehavior.java    From CustomBehavior 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,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 9
Source File: RotateBehavior.java    From CustomBehavior 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,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
Example 10
Source File: FabSpeedDialBehaviour.java    From fab-speed-dial with Apache License 2.0 5 votes vote down vote up
private float getFabTranslationYForSnackbar(CoordinatorLayout parent,
                                            FabSpeedDial 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,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}