mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	* fix issue with nominating for deletion * Fix UI issue * minor improvements * fix App crash * Added Javadoc and other minor improvements * Updated string name Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									76b30678da
								
							
						
					
					
						commit
						ca18763e4f
					
				
					 11 changed files with 224 additions and 38 deletions
				
			
		|  | @ -565,6 +565,16 @@ public class ContributionsFragment | |||
|         contributionsPresenter.saveContribution(contribution); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Notify the viewpager that number of items have changed. | ||||
|      */ | ||||
|     @Override | ||||
|     public void viewPagerNotifyDataSetChanged() { | ||||
|         if (mediaDetailPagerFragment != null) { | ||||
|             mediaDetailPagerFragment.notifyDataSetChanged(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Replace whatever is in the current contributionsFragmentContainer view with | ||||
|      * mediaDetailPagerFragment, and preserve previous state in back stack. Called when user selects a | ||||
|  | @ -620,6 +630,21 @@ public class ContributionsFragment | |||
|         return mediaDetailPagerFragment; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Reload media detail fragment once media is nominated | ||||
|      * | ||||
|      * @param index item position that has been nominated | ||||
|      */ | ||||
|     @Override | ||||
|     public void refreshNominatedMedia(int index) { | ||||
|         if(mediaDetailPagerFragment != null && !contributionsListFragment.isVisible()) { | ||||
|             removeFragment(mediaDetailPagerFragment); | ||||
|             mediaDetailPagerFragment = new MediaDetailPagerFragment(false, true); | ||||
|             mediaDetailPagerFragment.showImage(index); | ||||
|             showMediaDetailPagerFragment(); | ||||
|         } | ||||
|     } | ||||
|        | ||||
|   // click listener to toggle description that means uses can press the limited connection | ||||
|   // banner and description will hide. Tap again to show description. | ||||
|   private View.OnClickListener toggleDescriptionListener = new View.OnClickListener() { | ||||
|  |  | |||
|  | @ -157,6 +157,16 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment impl | |||
|           } | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       /** | ||||
|        * Called whenever items in the list have changed | ||||
|        * Calls viewPagerNotifyDataSetChanged() that will notify the viewpager | ||||
|        */ | ||||
|       @Override | ||||
|       public void onItemRangeChanged(final int positionStart, final int itemCount) { | ||||
|         super.onItemRangeChanged(positionStart, itemCount); | ||||
|         callback.viewPagerNotifyDataSetChanged(); | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     //Fab close on touch outside (Scrolling or taping on item triggers this action). | ||||
|  | @ -370,11 +380,17 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment impl | |||
| 
 | ||||
| 
 | ||||
|   public Media getMediaAtPosition(final int i) { | ||||
|     return adapter.getContributionForPosition(i).getMedia(); | ||||
|     if(adapter.getContributionForPosition(i) != null) { | ||||
|       return adapter.getContributionForPosition(i).getMedia(); | ||||
|     } | ||||
|     return null; | ||||
|   } | ||||
| 
 | ||||
|   public int getTotalMediaCount() { | ||||
|     return adapter.getItemCount(); | ||||
|     if(adapter != null) { | ||||
|       return adapter.getItemCount(); | ||||
|     } | ||||
|     return 0; | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|  | @ -406,5 +422,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment impl | |||
|     void showDetail(int position, boolean isWikipediaButtonDisplayed); | ||||
| 
 | ||||
|     void pauseUpload(Contribution contribution); | ||||
| 
 | ||||
|     // Notify the viewpager that number of items have changed. | ||||
|     void viewPagerNotifyDataSetChanged(); | ||||
|   } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pratham Pahariya
						Pratham Pahariya