mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Add different anchor gravity for small FABs fixes gravity issue
This commit is contained in:
		
							parent
							
								
									2afc14eb20
								
							
						
					
					
						commit
						ac50886ae0
					
				
					 1 changed files with 17 additions and 4 deletions
				
			
		|  | @ -546,19 +546,20 @@ public class NearbyMapFragment extends DaggerFragment { | |||
| 
 | ||||
|     private void showFAB() { | ||||
| 
 | ||||
|         addAnchorToFABs(fabPlus, getActivity().findViewById(R.id.bottom_sheet_details).getId()); | ||||
|         addAnchorToBigFABs(fabPlus, getActivity().findViewById(R.id.bottom_sheet_details).getId()); | ||||
|         fabPlus.show(); | ||||
| 
 | ||||
|         addAnchorToFABs(fabGallery, getActivity().findViewById(R.id.empty_view).getId()); | ||||
|         addAnchorToSmallFABs(fabGallery, getActivity().findViewById(R.id.empty_view).getId()); | ||||
| 
 | ||||
|         addAnchorToFABs(fabCamera, getActivity().findViewById(R.id.empty_view1).getId()); | ||||
|         addAnchorToSmallFABs(fabCamera, getActivity().findViewById(R.id.empty_view1).getId()); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /* | ||||
|     * Add amnchors back before making them visible again. | ||||
|     * */ | ||||
|     private void addAnchorToFABs(FloatingActionButton floatingActionButton, int anchorID) { | ||||
|     private void addAnchorToBigFABs(FloatingActionButton floatingActionButton, int anchorID) { | ||||
|         CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams | ||||
|                 (ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT); | ||||
|         params.setAnchorId(anchorID); | ||||
|  | @ -566,6 +567,18 @@ public class NearbyMapFragment extends DaggerFragment { | |||
|         floatingActionButton.setLayoutParams(params); | ||||
|     } | ||||
| 
 | ||||
|     /* | ||||
|     * Add amnchors back before making them visible again. Big and small fabs have different anchor | ||||
|     * gravities, therefore the are two methods. | ||||
|     * */ | ||||
|     private void addAnchorToSmallFABs(FloatingActionButton floatingActionButton, int anchorID) { | ||||
|         CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams | ||||
|                 (ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT); | ||||
|         params.setAnchorId(anchorID); | ||||
|         params.anchorGravity = Gravity.CENTER_HORIZONTAL; | ||||
|         floatingActionButton.setLayoutParams(params); | ||||
|     } | ||||
| 
 | ||||
|     private void passInfoToSheet(Place place) { | ||||
|         this.place = place; | ||||
|         wikipediaButton.setEnabled(place.hasWikipediaLink()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan