mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Move SharedPreferences injection into NearbyMapFragment
This commit is contained in:
		
							parent
							
								
									fd14a3e82c
								
							
						
					
					
						commit
						287a20d945
					
				
					 2 changed files with 12 additions and 5 deletions
				
			
		|  | @ -23,15 +23,16 @@ class DirectUpload { | |||
|     private String desc; | ||||
|     private ContributionController controller; | ||||
|     private Fragment fragment; | ||||
|     private SharedPreferences prefs; | ||||
| 
 | ||||
|     @Inject @Named("prefs") SharedPreferences prefs; | ||||
|     @Inject @Named("default_preferences") SharedPreferences defaultPrefs; | ||||
| 
 | ||||
|     DirectUpload(String title, String desc, Fragment fragment, ContributionController controller) { | ||||
| 
 | ||||
|     DirectUpload(String title, String desc, Fragment fragment, ContributionController controller, SharedPreferences prefs) { | ||||
|         this.title = title; | ||||
|         this.desc = desc; | ||||
|         this.fragment = fragment; | ||||
|         this.controller = controller; | ||||
|         this.prefs = prefs; | ||||
|     } | ||||
| 
 | ||||
|     void storeSharedPrefs() { | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| package fr.free.nrw.commons.nearby; | ||||
| 
 | ||||
| import android.content.Intent; | ||||
| import android.content.SharedPreferences; | ||||
| import android.content.pm.PackageManager; | ||||
| import android.graphics.Color; | ||||
| import android.net.Uri; | ||||
|  | @ -39,6 +40,9 @@ import java.lang.reflect.Type; | |||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import javax.inject.Inject; | ||||
| import javax.inject.Named; | ||||
| 
 | ||||
| import dagger.android.support.DaggerFragment; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.contributions.ContributionController; | ||||
|  | @ -86,6 +90,8 @@ public class NearbyMapFragment extends DaggerFragment { | |||
|     private Place place; | ||||
|     private Marker selected; | ||||
| 
 | ||||
|     @Inject @Named("prefs") SharedPreferences prefs; | ||||
| 
 | ||||
|     public NearbyMapFragment() { | ||||
|     } | ||||
| 
 | ||||
|  | @ -400,7 +406,7 @@ public class NearbyMapFragment extends DaggerFragment { | |||
|         fabCamera.setOnClickListener(view -> { | ||||
|             Timber.d("Camera button tapped. Image title: " + place.getName() + "Image desc: " + place.getLongDescription()); | ||||
|             controller = new ContributionController(this); | ||||
|             DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription(), this, controller); | ||||
|             DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription(), this, controller, prefs); | ||||
|             directUpload.storeSharedPrefs(); | ||||
|             directUpload.initiateCameraUpload(); | ||||
|         }); | ||||
|  | @ -408,7 +414,7 @@ public class NearbyMapFragment extends DaggerFragment { | |||
|         fabGallery.setOnClickListener(view -> { | ||||
|             Timber.d("Gallery button tapped. Image title: " + place.getName() + "Image desc: " + place.getLongDescription()); | ||||
|             controller = new ContributionController(this); | ||||
|             DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription(), this, controller); | ||||
|             DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription(), this, controller, prefs); | ||||
|             directUpload.storeSharedPrefs(); | ||||
|             directUpload.initiateGalleryUpload(); | ||||
|         }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 misaochan
						misaochan