mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 08:43:52 +01:00 
			
		
		
		
	Complete initiateDirectUpload()
This commit is contained in:
		
							parent
							
								
									1a7ea256cc
								
							
						
					
					
						commit
						66d895f9b8
					
				
					 2 changed files with 9 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -49,8 +49,7 @@ class DirectUpload {
 | 
			
		|||
        Activity activity = (Activity) context;
 | 
			
		||||
 | 
			
		||||
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
 | 
			
		||||
            if (ContextCompat.checkSelfPermission(activity, READ_EXTERNAL_STORAGE)
 | 
			
		||||
                    != PERMISSION_GRANTED) {
 | 
			
		||||
            if (ContextCompat.checkSelfPermission(activity, READ_EXTERNAL_STORAGE) != PERMISSION_GRANTED) {
 | 
			
		||||
                if (activity.shouldShowRequestPermissionRationale(READ_EXTERNAL_STORAGE)) {
 | 
			
		||||
                    new AlertDialog.Builder(activity)
 | 
			
		||||
                            .setMessage(activity.getString(R.string.read_storage_permission_rationale))
 | 
			
		||||
| 
						 | 
				
			
			@ -64,15 +63,13 @@ class DirectUpload {
 | 
			
		|||
                } else {
 | 
			
		||||
                    activity.requestPermissions(new String[]{READ_EXTERNAL_STORAGE},
 | 
			
		||||
                            1);
 | 
			
		||||
 | 
			
		||||
                    // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
 | 
			
		||||
                    // app-defined int constant. The callback method gets the
 | 
			
		||||
                    // result of the request.
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                controller.startGalleryPick();
 | 
			
		||||
            }
 | 
			
		||||
                else {
 | 
			
		||||
                    controller.startGalleryPick();
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            controller.startGalleryPick();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -401,8 +401,9 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
 | 
			
		|||
            //TODO: Change this to activate camera upload (see ContributionsListFragment). Insert shared preference.
 | 
			
		||||
            Timber.d("Image title: " + place.getName() + "Image desc: " + place.getLongDescription());
 | 
			
		||||
 | 
			
		||||
            DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription());
 | 
			
		||||
            DirectUpload directUpload = new DirectUpload(place.getName(), place.getLongDescription(), this);
 | 
			
		||||
            directUpload.storeSharedPrefs(getActivity());
 | 
			
		||||
            directUpload.initiateUpload(getActivity());
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue