minor enhancements

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2019-01-18 07:07:31 +01:00
parent 3439981292
commit 940a6b8cb6
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
4 changed files with 11 additions and 10 deletions

View file

@ -483,7 +483,7 @@ public class UploadFilesActivity extends FileActivity implements
R.string.upload_query_move_foreign_files, args, 0, R.string.common_yes, -1,
R.string.common_no
);
dialog.setOnConfirmationListener(UploadFilesActivity.this);
dialog.setOnConfirmationListener(this);
dialog.show(getSupportFragmentManager(), QUERY_TO_MOVE_DIALOG_TAG);
}
}

View file

@ -36,7 +36,7 @@ public class CheckAvailableSpaceTask extends AsyncTask<Boolean, Void, Boolean> {
private String[] paths;
private CheckAvailableSpaceListener callback;
public CheckAvailableSpaceTask(CheckAvailableSpaceListener callback, String[] paths) {
public CheckAvailableSpaceTask(CheckAvailableSpaceListener callback, String... paths) {
this.paths = paths;
this.callback = callback;
}
@ -57,10 +57,11 @@ public class CheckAvailableSpaceTask extends AsyncTask<Boolean, Void, Boolean> {
*/
@Override
protected Boolean doInBackground(Boolean... params) {
File localFile;
long total = 0;
for (int i = 0; paths != null && i < paths.length; i++) {
String localPath = paths[i];
File localFile = new File(localPath);
localFile = new File(localPath);
total += localFile.length();
}
return FileStorageUtils.getUsableSpace() >= total;

View file

@ -96,6 +96,12 @@ public class ConfirmationDialogFragment extends DialogFragment {
throw new IllegalArgumentException("Arguments may not be null");
}
Activity activity = getActivity();
if (activity == null) {
throw new IllegalArgumentException("Activity may not be null");
}
Object[] messageArguments = arguments.getStringArray(ARG_MESSAGE_ARGUMENTS);
int messageId = arguments.getInt(ARG_MESSAGE_RESOURCE_ID, -1);
int titleId = arguments.getInt(ARG_TITLE_ID, -1);
@ -107,12 +113,6 @@ public class ConfirmationDialogFragment extends DialogFragment {
messageArguments = new String[]{};
}
Activity activity = getActivity();
if (activity == null) {
throw new IllegalArgumentException("Activity may not be null");
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.Theme_ownCloud_Dialog)
.setIcon(R.drawable.ic_warning)
.setIconAttribute(android.R.attr.alertDialogIcon)

View file

@ -419,7 +419,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
@Override
public void directCameraUpload() {
FileDisplayActivity fileDisplayActivity = ((FileDisplayActivity) getActivity());
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) getActivity();
if (fileDisplayActivity != null) {
fileDisplayActivity.getFileOperationsHelper()