@@ -79,12 +79,12 @@ public class ExtendedFloatingActionButton extends MaterialButton implements Atta
7979 private int animState = ANIM_STATE_NONE ;
8080
8181 private final AnimatorTracker changeVisibilityTracker = new AnimatorTracker ();
82- private final MotionStrategy shrinkStrategy ;
83- private final MotionStrategy extendStrategy ;
82+ @ NonNull private final MotionStrategy shrinkStrategy ;
83+ @ NonNull private final MotionStrategy extendStrategy ;
8484 private final MotionStrategy showStrategy = new ShowStrategy (changeVisibilityTracker );
8585 private final MotionStrategy hideStrategy = new HideStrategy (changeVisibilityTracker );
8686
87- private final Behavior <ExtendedFloatingActionButton > behavior ;
87+ @ NonNull private final Behavior <ExtendedFloatingActionButton > behavior ;
8888
8989 private boolean isExtended = true ;
9090 private boolean isUsingPillCorner = true ;
@@ -137,17 +137,17 @@ public void onExtended(ExtendedFloatingActionButton extendedFab) {}
137137 public void onShrunken (ExtendedFloatingActionButton extendedFab ) {}
138138 }
139139
140- public ExtendedFloatingActionButton (Context context ) {
140+ public ExtendedFloatingActionButton (@ NonNull Context context ) {
141141 this (context , null );
142142 }
143143
144- public ExtendedFloatingActionButton (Context context , @ Nullable AttributeSet attrs ) {
144+ public ExtendedFloatingActionButton (@ NonNull Context context , @ Nullable AttributeSet attrs ) {
145145 this (context , attrs , R .attr .extendedFloatingActionButtonStyle );
146146 }
147147
148148 @ SuppressWarnings ("initialization" )
149149 public ExtendedFloatingActionButton (
150- Context context , @ Nullable AttributeSet attrs , int defStyleAttr ) {
150+ @ NonNull Context context , @ Nullable AttributeSet attrs , int defStyleAttr ) {
151151 super (context , attrs , defStyleAttr );
152152 behavior = new ExtendedFloatingActionButtonBehavior <>(context , attrs );
153153 TypedArray a =
@@ -565,7 +565,7 @@ boolean isUsingPillCorner() {
565565 }
566566
567567 private void performMotion (
568- final MotionStrategy strategy , @ Nullable final OnChangedCallback callback ) {
568+ @ NonNull final MotionStrategy strategy , @ Nullable final OnChangedCallback callback ) {
569569 if (strategy .shouldCancel ()) {
570570 return ;
571571 }
@@ -639,16 +639,17 @@ private boolean shouldAnimateVisibilityChange() {
639639 * A Property wrapper around the <code>width</code> functionality handled by the {@link
640640 * LayoutParams#width} value.
641641 */
642- static final Property <View , Float > WIDTH =
642+ static final Property <View , Float > WIDTH =
643643 new Property <View , Float >(Float .class , "width" ) {
644644 @ Override
645- public void set (View object , Float value ) {
645+ public void set (@ NonNull View object , @ NonNull Float value ) {
646646 object .getLayoutParams ().width = value .intValue ();
647647 object .requestLayout ();
648648 }
649649
650+ @ NonNull
650651 @ Override
651- public Float get (View object ) {
652+ public Float get (@ NonNull View object ) {
652653 return (float ) object .getLayoutParams ().width ;
653654 }
654655 };
@@ -657,16 +658,17 @@ public Float get(View object) {
657658 * A Property wrapper around the <code>height</code> functionality handled by the {@link
658659 * LayoutParams#height} value.
659660 */
660- static final Property <View , Float > HEIGHT =
661+ static final Property <View , Float > HEIGHT =
661662 new Property <View , Float >(Float .class , "height" ) {
662663 @ Override
663- public void set (View object , Float value ) {
664+ public void set (@ NonNull View object , @ NonNull Float value ) {
664665 object .getLayoutParams ().height = value .intValue ();
665666 object .requestLayout ();
666667 }
667668
669+ @ NonNull
668670 @ Override
669- public Float get (View object ) {
671+ public Float get (@ NonNull View object ) {
670672 return (float ) object .getLayoutParams ().height ;
671673 }
672674 };
@@ -679,14 +681,14 @@ public Float get(View object) {
679681 static final Property <View , Float > CORNER_RADIUS =
680682 new Property <View , Float >(Float .class , "cornerRadius" ) {
681683 @ Override
682- public void set (View object , Float value ) {
684+ public void set (@ NonNull View object , @ NonNull Float value ) {
683685 ExtendedFloatingActionButton efab = ((ExtendedFloatingActionButton ) object );
684686 efab .setShapeAppearanceModel (
685687 efab .getShapeAppearanceModel ().withCornerRadius (value .intValue ()));
686688 }
687689
688690 @ Override
689- public Float get (View object ) {
691+ public Float get (@ NonNull View object ) {
690692 return ((ExtendedFloatingActionButton ) object )
691693 .getShapeAppearanceModel ()
692694 .getTopRightCorner ()
@@ -738,7 +740,8 @@ public ExtendedFloatingActionButtonBehavior() {
738740
739741 // Behavior attrs should be nullable in the framework
740742 @ SuppressWarnings ("argument.type.incompatible" )
741- public ExtendedFloatingActionButtonBehavior (Context context , @ Nullable AttributeSet attrs ) {
743+ public ExtendedFloatingActionButtonBehavior (
744+ @ NonNull Context context , @ Nullable AttributeSet attrs ) {
742745 super (context , attrs );
743746 TypedArray a =
744747 context .obtainStyledAttributes (
@@ -817,7 +820,7 @@ public void onAttachedToLayoutParams(@NonNull CoordinatorLayout.LayoutParams lp)
817820
818821 @ Override
819822 public boolean onDependentViewChanged (
820- CoordinatorLayout parent , ExtendedFloatingActionButton child , View dependency ) {
823+ CoordinatorLayout parent , @ NonNull ExtendedFloatingActionButton child , View dependency ) {
821824 if (dependency instanceof AppBarLayout ) {
822825 // If we're depending on an AppBarLayout we will show/hide it automatically
823826 // if the FAB is anchored to the AppBarLayout
@@ -846,7 +849,8 @@ void setInternalAutoShrinkCallback(@Nullable OnChangedCallback callback) {
846849 internalAutoShrinkCallback = callback ;
847850 }
848851
849- private boolean shouldUpdateVisibility (View dependency , ExtendedFloatingActionButton child ) {
852+ private boolean shouldUpdateVisibility (
853+ @ NonNull View dependency , @ NonNull ExtendedFloatingActionButton child ) {
850854 final CoordinatorLayout .LayoutParams lp =
851855 (CoordinatorLayout .LayoutParams ) child .getLayoutParams ();
852856 if (!autoHideEnabled && !autoShrinkEnabled ) {
@@ -863,7 +867,9 @@ private boolean shouldUpdateVisibility(View dependency, ExtendedFloatingActionBu
863867 }
864868
865869 private boolean updateFabVisibilityForAppBarLayout (
866- CoordinatorLayout parent , AppBarLayout appBarLayout , ExtendedFloatingActionButton child ) {
870+ CoordinatorLayout parent ,
871+ @ NonNull AppBarLayout appBarLayout ,
872+ @ NonNull ExtendedFloatingActionButton child ) {
867873 if (!shouldUpdateVisibility (appBarLayout , child )) {
868874 return false ;
869875 }
@@ -887,7 +893,7 @@ private boolean updateFabVisibilityForAppBarLayout(
887893 }
888894
889895 private boolean updateFabVisibilityForBottomSheet (
890- View bottomSheet , ExtendedFloatingActionButton child ) {
896+ @ NonNull View bottomSheet , @ NonNull ExtendedFloatingActionButton child ) {
891897 if (!shouldUpdateVisibility (bottomSheet , child )) {
892898 return false ;
893899 }
@@ -948,7 +954,9 @@ protected void extendOrShow(@NonNull ExtendedFloatingActionButton fab) {
948954
949955 @ Override
950956 public boolean onLayoutChild (
951- CoordinatorLayout parent , ExtendedFloatingActionButton child , int layoutDirection ) {
957+ @ NonNull CoordinatorLayout parent ,
958+ @ NonNull ExtendedFloatingActionButton child ,
959+ int layoutDirection ) {
952960 // First, let's make sure that the visibility of the FAB is consistent
953961 final List <View > dependencies = parent .getDependencies (child );
954962 for (int i = 0 , count = dependencies .size (); i < count ; i ++) {
@@ -991,7 +999,8 @@ public boolean getInsetDodgeRect(
991999 * offsets our layout position so that we're positioned correctly if we're on one of our
9921000 * parent's edges.
9931001 */
994- private void offsetIfNeeded (CoordinatorLayout parent , ExtendedFloatingActionButton fab ) {
1002+ private void offsetIfNeeded (
1003+ @ NonNull CoordinatorLayout parent , @ NonNull ExtendedFloatingActionButton fab ) {
9951004 final Rect padding = fab .shadowPadding ;
9961005
9971006 if (padding != null && padding .centerX () > 0 && padding .centerY () > 0 ) {
@@ -1077,6 +1086,7 @@ public int getDefaultMotionSpecResource() {
10771086 return R .animator .mtrl_extended_fab_change_size_motion_spec ;
10781087 }
10791088
1089+ @ NonNull
10801090 @ Override
10811091 public AnimatorSet createAnimator () {
10821092 MotionSpec spec = getCurrentMotionSpec ();
0 commit comments