From 2d9c4176a0539d0af1241b6e88cb83176e5b9b0b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 29 Jun 2021 08:36:43 +0200 Subject: [PATCH] Add new ShareType: GUEST, FEDERATED_GROUP, DECK Moved SearchRemoteOperation and GetSharesRemoteOperation to use typed response Signed-off-by: tobiasKaminsky --- .../android/datamodel/FileDataStorageManager.java | 15 ++++----------- .../android/providers/FileContentProvider.java | 3 +++ .../android/ui/adapter/OCFileListAdapter.java | 2 +- .../android/ui/fragment/OCFileListFragment.java | 15 ++++++--------- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index 33ef7e2a0e..a4c4d19cf8 100644 --- a/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -1373,19 +1373,12 @@ public class FileDataStorageManager { } // TODO shares null? - public void saveShares(ArrayList shares) { - cleanShares(); // 190 - - ArrayList temp = new ArrayList<>(); - - for (int i = 188; i <= 189; i++) { - temp.add(shares.get(i)); - } - - ArrayList operations = new ArrayList<>(temp.size()); + public void saveShares(List shares) { + cleanShares(); + ArrayList operations = new ArrayList<>(shares.size()); // prepare operations to insert or update files to save in the given folder - for (OCShare share : temp) { + for (OCShare share : shares) { ContentValues contentValues = createContentValueForShare(share); if (shareExistsForRemoteId(share.getRemoteId())) { diff --git a/src/main/java/com/owncloud/android/providers/FileContentProvider.java b/src/main/java/com/owncloud/android/providers/FileContentProvider.java index 7664ffb8c9..9365c189c0 100644 --- a/src/main/java/com/owncloud/android/providers/FileContentProvider.java +++ b/src/main/java/com/owncloud/android/providers/FileContentProvider.java @@ -403,8 +403,11 @@ public class FileContentProvider extends ContentProvider { case GROUP: case EMAIL: case FEDERATED: + case FEDERATED_GROUP: case ROOM: case CIRCLE: + case DECK: + case GUEST: fileValues.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, 1); break; diff --git a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index 8758e2d198..45c757e3f4 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -895,7 +895,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter objects) { - ArrayList shares = new ArrayList<>(); + List shares = new ArrayList<>(); for (Object shareObject : objects) { // check type before cast as of long running data fetch it is possible that old result is filled diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 00d6897f4c..eb59934e03 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -1555,12 +1555,12 @@ public class OCFileListFragment extends ExtendedListFragment implements storageManager = mContainerActivity.getStorageManager(); } - if (remoteOperationResult.isSuccess() && remoteOperationResult.getData() != null + if (remoteOperationResult.isSuccess() && remoteOperationResult.getResultData() != null && !isCancelled() && searchFragment) { - if (remoteOperationResult.getData() == null || remoteOperationResult.getData().size() == 0) { + if (remoteOperationResult.getResultData() == null || ((List) remoteOperationResult.getResultData()).isEmpty()) { setEmptyView(event); } else { - mAdapter.setData(remoteOperationResult.getData(), + mAdapter.setData(((RemoteOperationResult) remoteOperationResult).getResultData(), currentSearchType, storageManager, mFile, @@ -1570,12 +1570,9 @@ public class OCFileListFragment extends ExtendedListFragment implements final ToolbarActivity fileDisplayActivity = (ToolbarActivity) getActivity(); if (fileDisplayActivity != null) { - fileDisplayActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - if (fileDisplayActivity != null) { - setLoading(false); - } + fileDisplayActivity.runOnUiThread(() -> { + if (fileDisplayActivity != null) { + setLoading(false); } }); }