Simplify formatting

This commit is contained in:
misaochan 2018-05-25 20:26:07 +10:00
parent 56eed67ac4
commit 3e3956936b

View file

@ -460,7 +460,7 @@ public class ShareActivity
},mwApi); },mwApi);
fileAsyncTask.execute(); fileAsyncTask.execute();
} catch (IOException e) { } catch (IOException e) {
Timber.d(e, "IO Exception: "); Timber.e(e, "IO Exception: ");
} }
} }
} else { } else {
@ -479,8 +479,8 @@ public class ShareActivity
detectUnwantedPicturesAsync.execute(); detectUnwantedPicturesAsync.execute();
} }
/* /**
* to display permission snackbar in share activity * Displays Snackbar to ask for location permissions
*/ */
private Snackbar requestPermissionUsingSnackBar(String rationale, private Snackbar requestPermissionUsingSnackBar(String rationale,
final String[] perms, final String[] perms,
@ -502,23 +502,18 @@ public class ShareActivity
// TODO: there might be a more proper solution than this // TODO: there might be a more proper solution than this
String copyPath = null; String copyPath = null;
try { try {
ParcelFileDescriptor descriptor ParcelFileDescriptor descriptor = getContentResolver().openFileDescriptor(mediaUri, "r");
= getContentResolver().openFileDescriptor(mediaUri, "r");
if (descriptor != null) { if (descriptor != null) {
boolean useExtStorage = prefs.getBoolean("useExternalStorage", true); boolean useExtStorage = prefs.getBoolean("useExternalStorage", true);
if (useExtStorage) { if (useExtStorage) {
copyPath = Environment.getExternalStorageDirectory().toString() copyPath = Environment.getExternalStorageDirectory().toString() + "/CommonsApp/" + new Date().getTime() + ".jpg";
+ "/CommonsApp/" + new Date().getTime() + ".jpg";
File newFile = new File(Environment.getExternalStorageDirectory().toString() + "/CommonsApp"); File newFile = new File(Environment.getExternalStorageDirectory().toString() + "/CommonsApp");
newFile.mkdir(); newFile.mkdir();
FileUtils.copy( FileUtils.copy(descriptor.getFileDescriptor(), copyPath);
descriptor.getFileDescriptor(),
copyPath);
Timber.d("Filepath (copied): %s", copyPath); Timber.d("Filepath (copied): %s", copyPath);
return copyPath; return copyPath;
} }
copyPath = getApplicationContext().getCacheDir().getAbsolutePath() copyPath = getApplicationContext().getCacheDir().getAbsolutePath() + "/" + new Date().getTime() + ".jpg";
+ "/" + new Date().getTime() + ".jpg";
FileUtils.copy( FileUtils.copy(
descriptor.getFileDescriptor(), descriptor.getFileDescriptor(),
copyPath); copyPath);
@ -622,9 +617,7 @@ public class ShareActivity
newFragment.show(fragmentManager, "dialog"); newFragment.show(fragmentManager, "dialog");
break; break;
} }
} }
} }
} }
haveCheckedForOtherImages = true; //Finished checking for other images haveCheckedForOtherImages = true; //Finished checking for other images