mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Use switch case instead of if-else
This commit is contained in:
		
							parent
							
								
									d993ee8110
								
							
						
					
					
						commit
						693ddef897
					
				
					 1 changed files with 21 additions and 20 deletions
				
			
		|  | @ -297,27 +297,28 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment { | |||
|     } | ||||
| 
 | ||||
|     public void prepareViewsForSheetPosition(int bottomSheetState) { | ||||
|         if (bottomSheetState == BottomSheetBehavior.STATE_COLLAPSED) { | ||||
|             if (!fabList.isShown()) fabList.show(); | ||||
|             closeFabs(isFabOpen); | ||||
|             if (!fabPlus.isShown()) showFAB(); | ||||
|             this.getView().requestFocus(); | ||||
|             moreInfo.setVisibility(View.VISIBLE); | ||||
|             //NearbyActivity.bottomSheetStatus = NearbyActivity.BottomSheetStatus.DISPLAY_DETAILS_SHEET_COLLAPSED; | ||||
| 
 | ||||
|         switch (bottomSheetState) { | ||||
|             case (BottomSheetBehavior.STATE_COLLAPSED): | ||||
|                 if (!fabList.isShown()) fabList.show(); | ||||
|                 closeFabs(isFabOpen); | ||||
|                 if (!fabPlus.isShown()) showFAB(); | ||||
|                 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() { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan