mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Remove prefs var in GPSExtractor
This commit is contained in:
parent
fe3dda18ce
commit
be5c05435e
3 changed files with 9 additions and 12 deletions
|
|
@ -106,12 +106,12 @@ public class FileProcessor implements SimilarImageDialogFragment.onResponse {
|
|||
ParcelFileDescriptor descriptor = contentResolver.openFileDescriptor(mediaUri, "r");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
if (descriptor != null) {
|
||||
imageObj = new GPSExtractor(descriptor.getFileDescriptor(), prefs);
|
||||
imageObj = new GPSExtractor(descriptor.getFileDescriptor());
|
||||
}
|
||||
} else {
|
||||
String filePath = getPathOfMediaOrCopy();
|
||||
if (filePath != null) {
|
||||
imageObj = new GPSExtractor(filePath, prefs);
|
||||
imageObj = new GPSExtractor(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,11 +161,11 @@ public class FileProcessor implements SimilarImageDialogFragment.onResponse {
|
|||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
if (descriptor != null) {
|
||||
tempImageObj = new GPSExtractor(descriptor.getFileDescriptor(), prefs);
|
||||
tempImageObj = new GPSExtractor(descriptor.getFileDescriptor());
|
||||
}
|
||||
} else {
|
||||
if (filePath != null) {
|
||||
tempImageObj = new GPSExtractor(file.getAbsolutePath(), prefs);
|
||||
tempImageObj = new GPSExtractor(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ import timber.log.Timber;
|
|||
* is uploaded, extract latitude and longitude from EXIF data of image.
|
||||
*/
|
||||
public class GPSExtractor {
|
||||
|
||||
private SharedPreferences prefs;
|
||||
|
||||
private ExifInterface exif;
|
||||
private double decLatitude;
|
||||
private double decLongitude;
|
||||
|
|
@ -28,8 +27,7 @@ public class GPSExtractor {
|
|||
* @param fileDescriptor the file descriptor of the image
|
||||
*/
|
||||
@RequiresApi(24)
|
||||
public GPSExtractor(@NonNull FileDescriptor fileDescriptor, SharedPreferences prefs) {
|
||||
this.prefs = prefs;
|
||||
public GPSExtractor(@NonNull FileDescriptor fileDescriptor) {
|
||||
try {
|
||||
exif = new ExifInterface(fileDescriptor);
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
|
|
@ -42,8 +40,7 @@ public class GPSExtractor {
|
|||
* @param path file path of the image
|
||||
*
|
||||
*/
|
||||
public GPSExtractor(@NonNull String path, SharedPreferences prefs) {
|
||||
this.prefs = prefs;
|
||||
public GPSExtractor(@NonNull String path) {
|
||||
try {
|
||||
exif = new ExifInterface(path);
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
|
|
|
|||
|
|
@ -329,12 +329,12 @@ public class MultipleShareActivity extends AuthenticatedActivity
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
ParcelFileDescriptor fd = getContentResolver().openFileDescriptor(imageUri,"r");
|
||||
if (fd != null) {
|
||||
gpsExtractor = new GPSExtractor(fd.getFileDescriptor(), prefs);
|
||||
gpsExtractor = new GPSExtractor(fd.getFileDescriptor());
|
||||
}
|
||||
} else {
|
||||
String filePath = FileUtils.getPath(this,imageUri);
|
||||
if (filePath != null) {
|
||||
gpsExtractor = new GPSExtractor(filePath, prefs);
|
||||
gpsExtractor = new GPSExtractor(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue