|
@@ -365,12 +365,7 @@ public class UploadsStorageManager extends Observable {
|
|
}
|
|
}
|
|
|
|
|
|
private OCUpload[] getUploads(@Nullable String selection, @Nullable String... selectionArgs) {
|
|
private OCUpload[] getUploads(@Nullable String selection, @Nullable String... selectionArgs) {
|
|
- return getUploads(0, selection, selectionArgs);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private OCUpload[] getUploads(final int limit, @Nullable String selection, @Nullable String... selectionArgs) {
|
|
|
|
- ArrayList<OCUpload> uploads = new ArrayList<>();
|
|
|
|
|
|
+ final List<OCUpload> uploads = new ArrayList<>();
|
|
long page = 0;
|
|
long page = 0;
|
|
long rowsRead;
|
|
long rowsRead;
|
|
long rowsTotal = 0;
|
|
long rowsTotal = 0;
|
|
@@ -392,11 +387,8 @@ public class UploadsStorageManager extends Observable {
|
|
));
|
|
));
|
|
uploads.addAll(uploadsPage);
|
|
uploads.addAll(uploadsPage);
|
|
page++;
|
|
page++;
|
|
- } while (rowsRead > 0 && (limit <= 0 || rowsRead < limit));
|
|
|
|
|
|
+ } while (rowsRead > 0);
|
|
|
|
|
|
- if (limit > 0 && uploads.size() > limit) {
|
|
|
|
- uploads = new ArrayList<>(uploads.subList(0, limit));
|
|
|
|
- }
|
|
|
|
|
|
|
|
Log_OC.v(TAG, String.format(Locale.ENGLISH,
|
|
Log_OC.v(TAG, String.format(Locale.ENGLISH,
|
|
"getUploads() returning %d (%d) rows after reading %d pages",
|
|
"getUploads() returning %d (%d) rows after reading %d pages",
|
|
@@ -507,11 +499,7 @@ public class UploadsStorageManager extends Observable {
|
|
}
|
|
}
|
|
|
|
|
|
public OCUpload[] getCurrentAndPendingUploadsForAccount(final @NonNull String accountName) {
|
|
public OCUpload[] getCurrentAndPendingUploadsForAccount(final @NonNull String accountName) {
|
|
- return getCurrentAndPendingUploadsForAccount(0, accountName);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public OCUpload[] getCurrentAndPendingUploadsForAccount(final int limit, final @NonNull String accountName) {
|
|
|
|
- return getUploads(limit, ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_IN_PROGRESS.value +
|
|
|
|
|
|
+ return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_IN_PROGRESS.value +
|
|
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
|
|
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
|
|
"==" + UploadResult.DELAYED_FOR_WIFI.getValue() +
|
|
"==" + UploadResult.DELAYED_FOR_WIFI.getValue() +
|
|
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
|
|
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
|