[Libreoffice-commits] online.git: android/app
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 10 16:09:25 UTC 2019
android/app/build.gradle | 6 +-
android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudFile.java | 29 +++++-----
android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudProvider.java | 8 +-
android/app/src/main/res/values/strings.xml | 2
4 files changed, 23 insertions(+), 22 deletions(-)
New commits:
commit 9a6c6f767dc1fdbb2a00f37288a1a1bc5b6d7997
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Dec 9 19:32:07 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Dec 10 17:08:56 2019 +0100
android: Update the library for remote files to nextcloud/android-library.
The library bundled in the LibreOffice sources didn't work for me
neither with ownCloud nor with Nextcloud.
Change-Id: I88ee06bdffeed3229643575ffb274432582eaab8
Reviewed-on: https://gerrit.libreoffice.org/84869
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 98ace7fb8..84f5ef91c 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -43,8 +43,8 @@ android {
}
repositories {
- flatDir {
- dirs "${liboWorkdir}/UnpackedTarball/owncloud_android_lib/build/outputs/aar"
+ maven {
+ url "https://jitpack.io"
}
}
@@ -54,7 +54,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
- implementation(name: 'owncloud_android_lib', ext: 'aar')
+ implementation 'com.github.nextcloud:android-library:-SNAPSHOT'
//before changing the version please see https://issuetracker.google.com/issues/111662669
implementation 'androidx.preference:preference:1.1.0-alpha01'
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudFile.java b/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudFile.java
index 21d800234..cc7589fae 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudFile.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudFile.java
@@ -14,11 +14,12 @@ import java.util.List;
import org.libreoffice.androidapp.storage.IFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.files.ChunkedUploadRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
-import com.owncloud.android.lib.resources.files.RemoteFile;
-import com.owncloud.android.lib.resources.files.UploadRemoteFileOperation;
+import com.owncloud.android.lib.resources.files.ChunkedFileUploadRemoteOperation;
+import com.owncloud.android.lib.resources.files.DownloadFileRemoteOperation;
+import com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation;
+import com.owncloud.android.lib.resources.files.model.RemoteFile;
+import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
+import com.owncloud.android.lib.resources.files.model.RemoteFile;
/**
* Implementation of IFile for ownCloud servers.
@@ -77,7 +78,7 @@ public class OwnCloudFile implements IFile {
public List<IFile> listFiles() {
List<IFile> children = new ArrayList<IFile>();
if (isDirectory()) {
- ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(
+ ReadFolderRemoteOperation refreshOperation = new ReadFolderRemoteOperation(
file.getRemotePath());
RemoteOperationResult result = refreshOperation.execute(provider
.getClient());
@@ -97,7 +98,7 @@ public class OwnCloudFile implements IFile {
public List<IFile> listFiles(FileFilter filter) {
List<IFile> children = new ArrayList<IFile>();
if (isDirectory()) {
- ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(
+ ReadFolderRemoteOperation refreshOperation = new ReadFolderRemoteOperation(
file.getRemotePath());
RemoteOperationResult result = refreshOperation.execute(provider
.getClient());
@@ -139,7 +140,7 @@ public class OwnCloudFile implements IFile {
return null;
}
File downFolder = provider.getCacheDir();
- DownloadRemoteFileOperation operation = new DownloadRemoteFileOperation(
+ DownloadFileRemoteOperation operation = new DownloadFileRemoteOperation(
file.getRemotePath(), downFolder.getAbsolutePath());
RemoteOperationResult result = operation.execute(provider.getClient());
if (!result.isSuccess()) {
@@ -160,13 +161,13 @@ public class OwnCloudFile implements IFile {
@Override
public void saveDocument(File newFile) {
- UploadRemoteFileOperation uploadOperation;
- if (newFile.length() > ChunkedUploadRemoteFileOperation.CHUNK_SIZE) {
- uploadOperation = new ChunkedUploadRemoteFileOperation(
- newFile.getPath(), file.getRemotePath(), file.getMimeType());
+ UploadFileRemoteOperation uploadOperation;
+ if (newFile.length() > ChunkedFileUploadRemoteOperation.CHUNK_SIZE_MOBILE) {
+ uploadOperation = new ChunkedFileUploadRemoteOperation(
+ newFile.getPath(), file.getRemotePath(), file.getMimeType(), file.getEtag(), String.valueOf(file.getModifiedTimestamp()), false /* TODO actually check if on Wifi */);
} else {
- uploadOperation = new UploadRemoteFileOperation(newFile.getPath(),
- file.getRemotePath(), file.getMimeType());
+ uploadOperation = new UploadFileRemoteOperation(newFile.getPath(),
+ file.getRemotePath(), file.getMimeType(), String.valueOf(file.getModifiedTimestamp()));
}
RemoteOperationResult result = uploadOperation.execute(provider
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudProvider.java b/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudProvider.java
index e270c728c..d02b52d6f 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudProvider.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/storage/owncloud/OwnCloudProvider.java
@@ -20,8 +20,8 @@ import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.resources.files.FileUtils;
-import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
-import com.owncloud.android.lib.resources.files.RemoteFile;
+import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
+import com.owncloud.android.lib.resources.files.model.RemoteFile;
/**
@@ -81,7 +81,7 @@ public class OwnCloudProvider implements IDocumentProvider,
@Override
public IFile createFromUri(Context context, URI uri) {
if(serverUrl != "" || userName != "" || password != ""){
- ReadRemoteFileOperation refreshOperation = new ReadRemoteFileOperation(
+ ReadFileRemoteOperation refreshOperation = new ReadFileRemoteOperation(
uri.getPath());
this.result = refreshOperation.execute(client);
if (!result.isSuccess()) {
@@ -99,7 +99,7 @@ public class OwnCloudProvider implements IDocumentProvider,
@Override
public int getNameResource() {
- return R.string.owncloud;
+ return R.string.remote_server;
}
/**
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index f93c59b61..786b3b59a 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -73,7 +73,7 @@
<string name="local_file_system">Local file system</string>
<string name="external_sd_file_system">External SD</string>
<string name="otg_file_system">OTG device (experimental)</string>
- <string name="owncloud">Remote server</string>
+ <string name="remote_server">Remote server</string>
<string name="usb_connected_configure">USB connected, configure your device.</string>
<string name="owncloud_wrong_connection">Cannot connect to ownCloud server. Check your configuration.</string>
More information about the Libreoffice-commits
mailing list