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) {
switch (bottomSheetState) {
case (BottomSheetBehavior.STATE_COLLAPSED):
if (!fabList.isShown()) fabList.show(); if (!fabList.isShown()) fabList.show();
closeFabs(isFabOpen); closeFabs(isFabOpen);
if (!fabPlus.isShown()) showFAB(); if (!fabPlus.isShown()) showFAB();
this.getView().requestFocus(); this.getView().requestFocus();
moreInfo.setVisibility(View.VISIBLE); moreInfo.setVisibility(View.VISIBLE);
//NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_COLLAPSED; break;
} case (BottomSheetBehavior.STATE_EXPANDED):
else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
if (fabList.isShown()) fabList.hide(); if (fabList.isShown()) fabList.hide();
this.getView().requestFocus(); this.getView().requestFocus();
moreInfo.setVisibility(View.VISIBLE); moreInfo.setVisibility(View.VISIBLE);
//NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_EXPANDED; break;
} case (BottomSheetBehavior.STATE_HIDDEN):
else if (bottomSheetState == BottomSheetBehavior.STATE_HIDDEN) {
closeFabs(isFabOpen); closeFabs(isFabOpen);
hideFAB(); hideFAB();
moreInfo.setVisibility(View.GONE); moreInfo.setVisibility(View.GONE);
this.getView().clearFocus(); this.getView().clearFocus();
break;
} }
//currBottomSheetState = bottomSheetState;
} }
private void hideFAB() { private void hideFAB() {