diff options
author | Mert Tumer <merttumer@outlook.com> | 2016-08-03 16:46:00 +0300 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-09-19 06:14:52 +0000 |
commit | 7d794b193ef517de979bc1e481f655eb1124103c (patch) | |
tree | b88336954eb92e41d3e6c004cd19fad841966e37 /android | |
parent | c57e7685f22c4b010a7ddb25fa896f8405e95818 (diff) |
tdf#96797 - Android: Viewer file filter is not working on ownCloud
Change-Id: I6ffb450d935ae1f7b4900243b9ff2f8df408628f
Reviewed-on: https://gerrit.libreoffice.org/27829
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java index 73b3b2c6205d..c218961a2266 100644 --- a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java +++ b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java @@ -93,8 +93,33 @@ public class OwnCloudFile implements IFile { @Override public List<IFile> listFiles(FileFilter filter) { - // TODO no filtering yet - return listFiles(); + List<IFile> children = new ArrayList<IFile>(); + if (isDirectory()) { + ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation( + file.getRemotePath()); + RemoteOperationResult result = refreshOperation.execute(provider + .getClient()); + if (!result.isSuccess()) { + throw provider.buildRuntimeExceptionForResultCode(result.getCode()); + } + + for (Object obj : result.getData()) { + RemoteFile child = (RemoteFile) obj; + if (!child.getRemotePath().equals(file.getRemotePath())){ + OwnCloudFile ownCloudFile = new OwnCloudFile(provider, child); + if(!ownCloudFile.isDirectory()){ + File f = new File(provider.getCacheDir().getAbsolutePath(), + ownCloudFile.getName()); + if(filter.accept(f)) + children.add(ownCloudFile); + f.delete(); + }else{ + children.add(ownCloudFile); + } + } + } + } + return children; } @Override |