mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Fix issue #1332 : Contribution Image auto/manual refresh if fetching fails
This commit is contained in:
		
							parent
							
								
									533297dce7
								
							
						
					
					
						commit
						5aba7459bd
					
				
					 3 changed files with 16 additions and 2 deletions
				
			
		|  | @ -144,7 +144,6 @@ public  class       ContributionsActivity | |||
|         if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){ | ||||
|             setUploadCount(); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ import android.os.Build; | |||
| import android.os.Bundle; | ||||
| import android.support.annotation.NonNull; | ||||
| import android.support.v4.content.ContextCompat; | ||||
| import android.support.v4.widget.SwipeRefreshLayout; | ||||
| import android.support.v7.app.AlertDialog; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.Menu; | ||||
|  | @ -47,6 +48,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment { | |||
|     TextView waitingMessage; | ||||
|     @BindView(R.id.loadingContributionsProgressBar) | ||||
|     ProgressBar progressBar; | ||||
|     @BindView(R.id.swipeRefreshLayout) | ||||
|     SwipeRefreshLayout swipeRefreshLayout; | ||||
| 
 | ||||
|     @Inject | ||||
|     @Named("prefs") | ||||
|  | @ -64,6 +67,13 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment { | |||
|         ButterKnife.bind(this, v); | ||||
| 
 | ||||
|         contributionsList.setOnItemClickListener((AdapterView.OnItemClickListener) getActivity()); | ||||
|         swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { | ||||
|             @Override | ||||
|             public void onRefresh() { | ||||
|                 ((ContributionsListAdapter)contributionsList.getAdapter()).notifyDataSetChanged(); | ||||
|                 swipeRefreshLayout.setRefreshing(false); | ||||
|             } | ||||
|         }); | ||||
|         if (savedInstanceState != null) { | ||||
|             Timber.d("Scrolling to %d", savedInstanceState.getInt("grid-position")); | ||||
|             contributionsList.setSelection(savedInstanceState.getInt("grid-position")); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aarnav Jindal
						Aarnav Jindal