@@ -482,9 +482,8 @@ public void resumeFragment() {
482482 */
483483 @ Override
484484 public void animateFABs () {
485- this .isFabOpen = !isFabOpen ;
486485 if (fabPlus .isShown ()){
487- if (isFabOpen ) {
486+ /* if (isFabOpen) {
488487 fabPlus.startAnimation(rotate_backward);
489488 fabCamera.startAnimation(fab_close);
490489 fabGallery.startAnimation(fab_close);
@@ -497,16 +496,36 @@ public void animateFABs() {
497496 fabCamera.show();
498497 fabGallery.show();
499498 }
500- this .isFabOpen =!isFabOpen ;
499+ this.isFabOpen=!isFabOpen;*/
500+ if (isFabOpen ) {
501+ closeFABs (isFabOpen );
502+ } else {
503+ openFABs (isFabOpen );
504+ }
501505 }
502506 }
503507
504508 private void showFABs () {
509+ NearbyFABUtils .addAnchorToBigFABs (fabPlus , bottomSheetDetails .getId ());
510+ fabPlus .show ();
511+ NearbyFABUtils .addAnchorToSmallFABs (fabGallery , getView ().findViewById (R .id .empty_view ).getId ());
512+ NearbyFABUtils .addAnchorToSmallFABs (fabCamera , getView ().findViewById (R .id .empty_view1 ).getId ());
513+ }
505514
506- NearbyFABUtils .addAnchorToBigFABs (fabPlus , bottomSheetDetails .getId ());
507- fabPlus .show ();
508- NearbyFABUtils .addAnchorToSmallFABs (fabGallery , getView ().findViewById (R .id .empty_view ).getId ());
509- NearbyFABUtils .addAnchorToSmallFABs (fabCamera , getView ().findViewById (R .id .empty_view1 ).getId ());
515+ /**
516+ * Hides camera and gallery FABs, turn back plus FAB
517+ * @param isFabOpen
518+ */
519+ private void openFABs ( boolean isFabOpen ){
520+ if (!isFabOpen ) {
521+ showFABs ();
522+ fabPlus .startAnimation (rotate_forward );
523+ fabCamera .startAnimation (fab_open );
524+ fabGallery .startAnimation (fab_open );
525+ fabCamera .show ();
526+ fabGallery .show ();
527+ this .isFabOpen = true ;
528+ }
510529 }
511530
512531 /**
@@ -532,7 +551,7 @@ private void closeFABs( boolean isFabOpen){
532551 fabGallery .startAnimation (fab_close );
533552 fabCamera .hide ();
534553 fabGallery .hide ();
535- this .isFabOpen = ! isFabOpen ;
554+ this .isFabOpen = false ;
536555 }
537556 }
538557
0 commit comments