mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Don't store Activity instance in adapter.
This commit is contained in:
		
							parent
							
								
									40c1ea375a
								
							
						
					
					
						commit
						8255bac32e
					
				
					 2 changed files with 5 additions and 7 deletions
				
			
		|  | @ -227,7 +227,7 @@ public  class       ContributionsActivity | |||
|     @Override | ||||
|     public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { | ||||
|         if(contributionsList.getAdapter() == null) { | ||||
|             contributionsList.setAdapter(new ContributionsListAdapter(this, cursor, 0)); | ||||
|             contributionsList.setAdapter(new ContributionsListAdapter(getApplicationContext(), cursor, 0)); | ||||
|         } else { | ||||
|             ((CursorAdapter)contributionsList.getAdapter()).swapCursor(cursor); | ||||
|         } | ||||
|  |  | |||
|  | @ -1,25 +1,23 @@ | |||
| package fr.free.nrw.commons.contributions; | ||||
| 
 | ||||
| import android.app.Activity; | ||||
| import android.content.Context; | ||||
| import android.database.Cursor; | ||||
| import android.support.v4.widget.CursorAdapter; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| 
 | ||||
| import fr.free.nrw.commons.R; | ||||
| 
 | ||||
| class ContributionsListAdapter extends CursorAdapter { | ||||
|     private Activity activity; | ||||
| 
 | ||||
|     public ContributionsListAdapter(Activity activity, Cursor c, int flags) { | ||||
|         super(activity, c, flags); | ||||
|         this.activity = activity; | ||||
|     public ContributionsListAdapter(Context context, Cursor c, int flags) { | ||||
|         super(context, c, flags); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public View newView(Context context, Cursor cursor, ViewGroup viewGroup) { | ||||
|         View parent = activity.getLayoutInflater().inflate(R.layout.layout_contribution, viewGroup, false); | ||||
|         View parent = LayoutInflater.from(context).inflate(R.layout.layout_contribution, viewGroup, false); | ||||
|         parent.setTag(new ContributionViewHolder(parent)); | ||||
|         return parent; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dmitry Brant
						Dmitry Brant