mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 08:43:52 +01:00 
			
		
		
		
	Move detectUnwantedPictures() to FileProcessor
This commit is contained in:
		
							parent
							
								
									11c35b55fc
								
							
						
					
					
						commit
						db6ade0d1e
					
				
					 2 changed files with 14 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
package fr.free.nrw.commons.upload;
 | 
			
		||||
 | 
			
		||||
import android.app.Activity;
 | 
			
		||||
import android.content.ContentResolver;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.SharedPreferences;
 | 
			
		||||
| 
						 | 
				
			
			@ -13,6 +14,7 @@ import android.support.v7.app.AppCompatActivity;
 | 
			
		|||
import java.io.File;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.lang.ref.WeakReference;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +198,7 @@ public class FileProcessor {
 | 
			
		|||
                Timber.d("Cache found, setting categoryList in MwVolleyApi to %s", displayCatList);
 | 
			
		||||
                MwVolleyApi.setGpsCat(displayCatList);
 | 
			
		||||
            }
 | 
			
		||||
        }else{
 | 
			
		||||
        } else {
 | 
			
		||||
            Timber.d("EXIF: no coords");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -205,4 +207,14 @@ public class FileProcessor {
 | 
			
		|||
        return cacheFound;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Calls the async task that detects if image is fuzzy, too dark, etc
 | 
			
		||||
     */
 | 
			
		||||
    void detectUnwantedPictures() {
 | 
			
		||||
        String imageMediaFilePath = FileUtils.getPath(context, mediaUri);
 | 
			
		||||
        DetectUnwantedPicturesAsync detectUnwantedPicturesAsync
 | 
			
		||||
                = new DetectUnwantedPicturesAsync(new WeakReference<Activity>((Activity) context), imageMediaFilePath);
 | 
			
		||||
        detectUnwantedPicturesAsync.execute();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -447,7 +447,7 @@ public class ShareActivity
 | 
			
		|||
                                duplicateCheckPassed = (result == DUPLICATE_PROCEED || result == NO_DUPLICATE);
 | 
			
		||||
                                if (duplicateCheckPassed) {
 | 
			
		||||
                                    //image is not a duplicate, so now check if its a unwanted picture or not
 | 
			
		||||
                                    detectUnwantedPictures();
 | 
			
		||||
                                    fileObj.detectUnwantedPictures();
 | 
			
		||||
                                }
 | 
			
		||||
                            },mwApi);
 | 
			
		||||
                    fileAsyncTask.execute();
 | 
			
		||||
| 
						 | 
				
			
			@ -475,17 +475,6 @@ public class ShareActivity
 | 
			
		|||
    public void onNegativeResponse() {
 | 
			
		||||
        Timber.d("EXIF from imageObj");
 | 
			
		||||
        fileObj.useImageCoords();
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Calls the async task that detects if image is fuzzy, too dark, etc
 | 
			
		||||
     */
 | 
			
		||||
    private void detectUnwantedPictures() {
 | 
			
		||||
        String imageMediaFilePath = FileUtils.getPath(this, mediaUri);
 | 
			
		||||
        DetectUnwantedPicturesAsync detectUnwantedPicturesAsync
 | 
			
		||||
                = new DetectUnwantedPicturesAsync(new WeakReference<Activity>(this), imageMediaFilePath);
 | 
			
		||||
        detectUnwantedPicturesAsync.execute();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue