mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 18:28:59 +03:00
use upload_and_delete for direct camera upload to allow for multiple image uploads
...without having to wait for a successful upload before taking the next photo. Resolves #4609 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
9a80066f9f
commit
6e3a13ada4
3 changed files with 4 additions and 18 deletions
|
@ -853,7 +853,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
requestUploadOfFilesFromFileSystem(data, resultCode);
|
||||
|
||||
} else if (requestCode == REQUEST_CODE__UPLOAD_FROM_CAMERA &&
|
||||
(resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
|
||||
(resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_DELETE)) {
|
||||
|
||||
new CheckAvailableSpaceTask(new CheckAvailableSpaceTask.CheckAvailableSpaceListener() {
|
||||
@Override
|
||||
|
@ -875,7 +875,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
}
|
||||
|
||||
requestUploadOfFilesFromFileSystem(new String[]{renamedFile.getAbsolutePath()},
|
||||
FileUploader.LOCAL_BEHAVIOUR_MOVE);
|
||||
FileUploader.LOCAL_BEHAVIOUR_DELETE);
|
||||
}
|
||||
}
|
||||
}, new String[]{FileOperationsHelper.createImageFile(getActivity()).getAbsolutePath()}).execute();
|
||||
|
|
|
@ -444,9 +444,9 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
|
|||
|
||||
if (requestCode == FileDisplayActivity.REQUEST_CODE__UPLOAD_FROM_CAMERA) {
|
||||
data.putExtra(EXTRA_CHOSEN_FILES, new String[]{filesToUpload[0]});
|
||||
setResult(RESULT_OK_AND_MOVE, data);
|
||||
setResult(RESULT_OK_AND_DELETE, data);
|
||||
|
||||
preferences.setUploaderBehaviour(FileUploader.LOCAL_BEHAVIOUR_MOVE);
|
||||
preferences.setUploaderBehaviour(FileUploader.LOCAL_BEHAVIOUR_DELETE);
|
||||
} else {
|
||||
data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths());
|
||||
|
||||
|
|
|
@ -971,8 +971,6 @@ public class FileOperationsHelper {
|
|||
public void uploadFromCamera(Activity activity, int requestCode) {
|
||||
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
|
||||
deleteOldFiles(activity);
|
||||
|
||||
File photoFile = createImageFile(activity);
|
||||
|
||||
Uri photoUri = FileProvider.getUriForFile(activity.getApplicationContext(),
|
||||
|
@ -990,18 +988,6 @@ public class FileOperationsHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void deleteOldFiles(Activity activity) {
|
||||
File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
|
||||
if (storageDir != null) {
|
||||
for (File file : storageDir.listFiles()) {
|
||||
if (!file.delete()) {
|
||||
Log_OC.d(this, "Failed to delete: " + file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static File createImageFile(Activity activity) {
|
||||
File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
|
||||
|
|
Loading…
Reference in a new issue