Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
  2.  
  3.     public ScrollAwareFABBehavior() {
  4.         super();
  5.     }
  6.  
  7.     public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
  8.         super(context, attrs);
  9.     }
  10.  
  11.     @Override
  12.     public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent,
  13.                                      @NonNull FloatingActionButton child,
  14.                                      @NonNull Rect rect) {
  15.         super.getInsetDodgeRect(parent, child, rect);
  16.         if (!rect.intersect(child.getLeft(), child.getTop(),
  17.                 child.getRight(), child.getBottom())) {
  18.             if (!BuildConfig.DEBUG) {
  19.                 Exception e = new IllegalArgumentException("Rect should intersect with child's bounds.");
  20.                 Crashlytics.logException(e);
  21.             }
  22.         }
  23.         return false;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement