Use switch case instead of if-else

This commit is contained in:
neslihanturan 2017-12-22 15:08:28 +03:00 committed by maskara
parent d993ee8110
commit 693ddef897

View file

@ -297,27 +297,28 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
} }
public void prepareViewsForSheetPosition(int bottomSheetState) { public void prepareViewsForSheetPosition(int bottomSheetState) {
if (bottomSheetState == BottomSheetBehavior.STATE_COLLAPSED) {
if (!fabList.isShown()) fabList.show(); switch (bottomSheetState) {
closeFabs(isFabOpen); case (BottomSheetBehavior.STATE_COLLAPSED):
if (!fabPlus.isShown()) showFAB(); if (!fabList.isShown()) fabList.show();
this.getView().requestFocus(); closeFabs(isFabOpen);
moreInfo.setVisibility(View.VISIBLE); if (!fabPlus.isShown()) showFAB();
//NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_COLLAPSED; this.getView().requestFocus();
moreInfo.setVisibility(View.VISIBLE);
break;
case (BottomSheetBehavior.STATE_EXPANDED):
if (fabList.isShown()) fabList.hide();
this.getView().requestFocus();
moreInfo.setVisibility(View.VISIBLE);
break;
case (BottomSheetBehavior.STATE_HIDDEN):
closeFabs(isFabOpen);
hideFAB();
moreInfo.setVisibility(View.GONE);
this.getView().clearFocus();
break;
} }
else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
if (fabList.isShown()) fabList.hide();
this.getView().requestFocus();
moreInfo.setVisibility(View.VISIBLE);
//NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_EXPANDED;
}
else if (bottomSheetState == BottomSheetBehavior.STATE_HIDDEN) {
closeFabs(isFabOpen);
hideFAB();
moreInfo.setVisibility(View.GONE);
this.getView().clearFocus();
}
//currBottomSheetState = bottomSheetState;
} }
private void hideFAB() { private void hideFAB() {