mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	* closing the list on tap ouside * minor improvement * minor changes * javadoc * official javadoc * javadoc error
This commit is contained in:
		
							parent
							
								
									88be88f25c
								
							
						
					
					
						commit
						f7d1fab566
					
				
					 2 changed files with 76 additions and 1 deletions
				
			
		|  | @ -10,6 +10,7 @@ import android.net.Uri; | |||
| import android.os.Bundle; | ||||
| import android.os.Parcelable; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.MotionEvent; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.animation.Animation; | ||||
|  | @ -24,6 +25,7 @@ import androidx.recyclerview.widget.GridLayoutManager; | |||
| import androidx.recyclerview.widget.RecyclerView; | ||||
| import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver; | ||||
| import androidx.recyclerview.widget.RecyclerView.ItemAnimator; | ||||
| import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener; | ||||
| import androidx.recyclerview.widget.SimpleItemAnimator; | ||||
| import butterknife.BindView; | ||||
| import butterknife.ButterKnife; | ||||
|  | @ -156,6 +158,50 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment impl | |||
|         } | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     //Fab close on touch outside (Scrolling or taping on item triggers this action). | ||||
|     rvContributionsList.addOnItemTouchListener(new OnItemTouchListener() { | ||||
| 
 | ||||
|       /** | ||||
|        * Silently observe and/or take over touch events sent to the RecyclerView before | ||||
|        * they are handled by either the RecyclerView itself or its child views. | ||||
|        */ | ||||
|       @Override | ||||
|       public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { | ||||
|         if (e.getAction() == MotionEvent.ACTION_DOWN) { | ||||
|           if (isFabOpen) { | ||||
|             animateFAB(isFabOpen); | ||||
|           } | ||||
|         } | ||||
|         return false; | ||||
|       } | ||||
| 
 | ||||
|       /** | ||||
|        * Process a touch event as part of a gesture that was claimed by returning true | ||||
|        * from a previous call to {@link #onInterceptTouchEvent}. | ||||
|        * | ||||
|        * @param rv | ||||
|        * @param e  MotionEvent describing the touch event. All coordinates are in the | ||||
|        *           RecyclerView's coordinate system. | ||||
|        */ | ||||
|       @Override | ||||
|       public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { | ||||
|         //required abstract method DO NOT DELETE | ||||
|       } | ||||
| 
 | ||||
|       /** | ||||
|        * Called when a child of RecyclerView does not want RecyclerView and its ancestors | ||||
|        * to intercept touch events with {@link ViewGroup#onInterceptTouchEvent(MotionEvent)}. | ||||
|        * | ||||
|        * @param disallowIntercept True if the child does not want the parent to intercept | ||||
|        *                          touch events. | ||||
|        */ | ||||
|       @Override | ||||
|       public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { | ||||
|         //required abstract method DO NOT DELETE | ||||
|       } | ||||
| 
 | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   private int getSpanCount(final int orientation) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aditya-Srivastav
						Aditya-Srivastav