[Libreoffice-commits] core.git: android/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 22 06:56:24 UTC 2021


 android/source/build.gradle                                                           |    4 
 android/source/res/drawable/ic_cloud_black_24dp.xml                                   |    9 
 android/source/res/menu/navigation_menu.xml                                           |    6 
 android/source/res/values-de/strings.xml                                              |    9 
 android/source/res/values-tr/strings.xml                                              |    9 
 android/source/res/values/strings.xml                                                 |    9 
 android/source/res/xml/documentprovider_preferences.xml                               |   16 
 android/source/src/java/org/libreoffice/storage/DocumentProviderFactory.java          |    5 
 android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java |    3 
 android/source/src/java/org/libreoffice/storage/IDocumentProvider.java                |    3 
 android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java            |  178 ---------
 android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java        |  192 ----------
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java                 |    5 
 13 files changed, 2 insertions(+), 446 deletions(-)

New commits:
commit 6012599e17206ee7be9a83477654e7bd194079c3
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Wed Mar 17 12:02:17 2021 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Mar 22 07:55:32 2021 +0100

    tdf#129833 android: Drop non-working ownCloud/nextCloud support
    
    As mentioned in tdf#129833 comment 3, the idea is to
    use Android's "system file dialog" to select files rather
    than maintain a separate ownCloud/nextCloud connector in the
    Android Viewer app.
    This way, everything for which a DocumentsProvider [1] is
    available will be available from within the app, once
    Android Viewer has been adapted to support those, which is
    planned for a subsequent step.
    
    Corresponding DocumentsProviders for ownCloud [2] and nextCloud [3]
    exist.
    
    [1] https://developer.android.com/reference/android/provider/DocumentsProvider
    [2] https://github.com/owncloud/android
    [3] https://github.com/nextcloud/android
    
    Change-Id: I6581ce36672f582f91d47598afdfd32c3a4a58da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112765
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/android/source/build.gradle b/android/source/build.gradle
index add78236cb22..10ed31b3f341 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -7,9 +7,6 @@ allprojects {
     repositories {
         jcenter()
         google()
-        flatDir {
-            dirs "${liboWorkdir}/UnpackedTarball/owncloud_android_lib/build/outputs/aar"
-        }
     }
 }
 //build-time dependencies - android plugin for gradle
@@ -30,7 +27,6 @@ dependencies {
             "libreoffice.jar",
             "unoloader.jar"
     ])
-    implementation(name:'owncloud_android_lib', ext:'aar')
     implementation 'com.android.support:design:27.1.1' // also pulls-in corresponding support libraries
     implementation 'com.android.support.constraint:constraint-layout:1.1.2'
 }
diff --git a/android/source/res/drawable/ic_cloud_black_24dp.xml b/android/source/res/drawable/ic_cloud_black_24dp.xml
deleted file mode 100644
index e0940ca0e7b0..000000000000
--- a/android/source/res/drawable/ic_cloud_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="#FF000000"
-        android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96z"/>
-</vector>
diff --git a/android/source/res/menu/navigation_menu.xml b/android/source/res/menu/navigation_menu.xml
index db680a9a1b8c..4098b27b8cac 100644
--- a/android/source/res/menu/navigation_menu.xml
+++ b/android/source/res/menu/navigation_menu.xml
@@ -19,12 +19,6 @@
         <item android:id="@+id/menu_provider_otg"
             android:title="@string/otg_file_system"
             android:icon="@drawable/ic_usb_black_24dp"/>
-
-        <item android:id="@+id/menu_provider_owncloud"
-            android:title="@string/owncloud"
-            android:icon="@drawable/ic_cloud_black_24dp"/>
-
-
     </group>
 
     <group android:orderInCategory="100">
diff --git a/android/source/res/values-de/strings.xml b/android/source/res/values-de/strings.xml
index a4f88b2742c4..ff58b14babc5 100644
--- a/android/source/res/values-de/strings.xml
+++ b/android/source/res/values-de/strings.xml
@@ -75,13 +75,8 @@
     <string name="local_file_system">Lokales Dateisystem</string>
     <string name="external_sd_file_system">Externe SD</string>
     <string name="otg_file_system">OTG-Gerät (experimentell)</string>
-    <string name="owncloud">Entfernter Server</string>
     <string name="usb_connected_configure">USB verbunden, richten Sie Ihr Gerät ein.</string>
 
-    <string name="owncloud_wrong_connection">Verbindung mit dem ownCloud-Server nicht möglich. Prüfen Sie die Einstellungen.</string>
-    <string name="owncloud_unauthorized">Anmeldung am ownCloud-Server nicht möglich. Prüfen Sie die Einstellungen.</string>
-    <string name="owncloud_unspecified_error">Nicht näher spezifizierter Fehler beim Verbindungsaufbau zum ownCloud-Server. Prüfen Sie die Einstellungen und/oder versuchen Sie es später.</string>
-
     <string name="ext_document_provider_error">Ungültige Wurzel-Datei. Prüfen Sie die SD-Karten-Einstellungen.</string>
     <string name="legacy_extsd_missing_error">Ungültige Wurzel-Datei. Prüfen Sie die externe SD-Karte und/oder die Einstellungen</string>
     <string name="otg_missing_error">Ungültige Wurzel-Datei. Prüfen Sie Ihr OTG-Gerät und/oder die Einstellungen.</string>
@@ -106,14 +101,10 @@
 
     <!-- Document provider settings -->
     <string name="storage_provider_settings">Speicheranbieter-Einstellungen</string>
-    <string name="owncloud_settings">ownCloud-Einstellungen</string>
     <string name="physical_storage_settings">Einstellungen für physikalischen Speicher</string>
     <string name="external_sd_path">Pfad zur externen SD-Karte</string>
     <string name="otg_device_path">Pfad zum OTG-Gerät</string>
     <string name="otg_warning">Experimentelles Feature: Nur verwenden, wenn OTG-Gerät beschreibbar ist.</string>
-    <string name="server_url">Server-URL</string>
-    <string name="server_url_and_port">URL und Port des ownCloud-Servers.</string>
-    <string name="user_name">Benutzername</string>
     <string name="password">Passwort</string>
     <string name="action_undo">Rückgängig</string>
     <string name="action_redo">Wiederherstellen</string>
diff --git a/android/source/res/values-tr/strings.xml b/android/source/res/values-tr/strings.xml
index 3bada4ded6be..4ce70e91607d 100644
--- a/android/source/res/values-tr/strings.xml
+++ b/android/source/res/values-tr/strings.xml
@@ -75,13 +75,8 @@
     <string name="local_file_system">Yerel dosya sistemi</string>
     <string name="external_sd_file_system">Harici SD</string>
     <string name="otg_file_system">OTG cihazı (deneysel)</string>
-    <string name="owncloud">Uzak sunucu</string>
     <string name="usb_connected_configure">USB bağlantısı yapıldı, cihazınızın ayarlarını yapınız.</string>
 
-    <string name="owncloud_wrong_connection">ownCloud sunucusuna bağlanılamadı. Ayarlarınızı kontrol ediniz.</string>
-    <string name="owncloud_unauthorized">ownCloud sunucusuna giriş yapılamadı. Ayarlarınızı kontrol ediniz.</string>
-    <string name="owncloud_unspecified_error">ownCloud sunucusuna bağlanırken belirtilmemiş bir hata oluştu. Lütfen daha sonra tekrar deneyiniz veya ayarlarınızı kontrol ediniz.</string>
-
     <string name="ext_document_provider_error">Geçersiz dizin. SD kart ayarlarınızı kontrol ediniz.</string>
     <string name="legacy_extsd_missing_error">Geçersiz dizin. SD kartınızı veya SD kart ayarlarınızı kontrol ediniz.</string>
     <string name="otg_missing_error">Geçersiz dizin. OTG cihazınızı veya OTG cihazı ayarlarınızı kontrol ediniz.</string>
@@ -106,14 +101,10 @@
 
     <!-- Document provider settings -->
     <string name="storage_provider_settings">Depolama sağlayıcısı ayarları</string>
-    <string name="owncloud_settings">ownCloud ayarları</string>
     <string name="physical_storage_settings">Fiziksel depolama ayarları</string>
     <string name="external_sd_path">Harici SD yolu</string>
     <string name="otg_device_path">OTG cihazı yolu</string>
     <string name="otg_warning">Deneysel özellik: OTG cihazı yazılabilir ise kullanın</string>
-    <string name="server_url">Sunucu URL</string>
-    <string name="server_url_and_port">ownCloud sunucusu URL ve port</string>
-    <string name="user_name">Kullanıcı Adı</string>
     <string name="password">Parola</string>
     <string name="action_undo">Geri Al</string>
     <string name="action_redo">Yinele</string>
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 3669d0a2ed90..aa32497862f6 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -75,13 +75,8 @@
     <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="usb_connected_configure">USB connected, configure your device.</string>
 
-    <string name="owncloud_wrong_connection">Cannot connect to ownCloud server. Check your configuration.</string>
-    <string name="owncloud_unauthorized">Cannot log into ownCloud server. Check your configuration.</string>
-    <string name="owncloud_unspecified_error">Unspecified error connecting to ownCloud server. Check your configuration and/or try later.</string>
-
     <string name="ext_document_provider_error">Invalid root file. Check your sd card configuration.</string>
     <string name="legacy_extsd_missing_error">Invalid root file. Check your external sd card and/or configuration.</string>
     <string name="otg_missing_error">Invalid root file. Check your OTG device and/or configuration.</string>
@@ -106,14 +101,10 @@
 
     <!-- Document provider settings -->
     <string name="storage_provider_settings">Storage provider settings</string>
-    <string name="owncloud_settings">ownCloud settings</string>
     <string name="physical_storage_settings">Physical storage settings</string>
     <string name="external_sd_path">External SD path</string>
     <string name="otg_device_path">OTG device path</string>
     <string name="otg_warning">Experimental Feature: Use only if OTG device is writable.</string>
-    <string name="server_url">Server URL</string>
-    <string name="server_url_and_port">URL and port of the ownCloud server.</string>
-    <string name="user_name">User name</string>
     <string name="password">Password</string>
     <string name="action_undo">Undo</string>
     <string name="action_redo">Redo</string>
diff --git a/android/source/res/xml/documentprovider_preferences.xml b/android/source/res/xml/documentprovider_preferences.xml
index bb5f087ddf71..1f4acc7b2f01 100644
--- a/android/source/res/xml/documentprovider_preferences.xml
+++ b/android/source/res/xml/documentprovider_preferences.xml
@@ -6,22 +6,6 @@
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
  -->
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-    <PreferenceCategory
-        android:title="@string/owncloud_settings"
-        android:key="pref_key_owncloud_settings">
-        <EditTextPreference
-            android:key="pref_server_url"
-            android:title="@string/server_url"
-            android:summary="@string/server_url_and_port"
-            android:hint="https://server:port/" />
-        <EditTextPreference
-            android:key="pref_user_name"
-            android:title="@string/user_name" />
-        <EditTextPreference
-            android:key="pref_password"
-            android:title="@string/password"
-            android:password="true" />
-    </PreferenceCategory>
     <PreferenceCategory
         android:title="@string/physical_storage_settings">
         <PreferenceScreen
diff --git a/android/source/src/java/org/libreoffice/storage/DocumentProviderFactory.java b/android/source/src/java/org/libreoffice/storage/DocumentProviderFactory.java
index acf5aebcd6c6..07387f1e5511 100644
--- a/android/source/src/java/org/libreoffice/storage/DocumentProviderFactory.java
+++ b/android/source/src/java/org/libreoffice/storage/DocumentProviderFactory.java
@@ -16,7 +16,6 @@ import org.libreoffice.storage.external.ExtsdDocumentsProvider;
 import org.libreoffice.storage.external.OTGDocumentsProvider;
 import org.libreoffice.storage.local.LocalDocumentsDirectoryProvider;
 import org.libreoffice.storage.local.LocalDocumentsProvider;
-import org.libreoffice.storage.owncloud.OwnCloudProvider;
 
 import android.content.Context;
 import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@@ -60,12 +59,10 @@ public final class DocumentProviderFactory {
             instance = new DocumentProviderFactory();
 
             // initialize document providers list
-            instance.providers = new IDocumentProvider[5];
+            instance.providers = new IDocumentProvider[4];
             instance.providers[0] = new LocalDocumentsDirectoryProvider(0);
             instance.providers[1] = new LocalDocumentsProvider(1);
             instance.providers[OTG_PROVIDER_INDEX] = new OTGDocumentsProvider(OTG_PROVIDER_INDEX, context);
-            instance.providers[4] = new OwnCloudProvider(4, context);
-
             instance.providers[EXTSD_PROVIDER_INDEX] = new ExtsdDocumentsProvider(EXTSD_PROVIDER_INDEX, context);
 
             // initialize document provider names list
diff --git a/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java b/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
index b842e79fafd6..55656f9d6c55 100644
--- a/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
+++ b/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
@@ -25,9 +25,6 @@ import android.support.v7.app.AppCompatActivity;
 
 public class DocumentProviderSettingsActivity extends AppCompatActivity {
 
-    public static final String KEY_PREF_OWNCLOUD_SERVER = "pref_server_url";
-    public static final String KEY_PREF_OWNCLOUD_USER_NAME = "pref_user_name";
-    public static final String KEY_PREF_OWNCLOUD_PASSWORD = "pref_password";
     public static final String KEY_PREF_EXTERNAL_SD_PATH_URI = "pref_extsd_path_uri";
     public static final String KEY_PREF_OTG_PATH_URI = "pref_otg_path_uri";
 
diff --git a/android/source/src/java/org/libreoffice/storage/IDocumentProvider.java b/android/source/src/java/org/libreoffice/storage/IDocumentProvider.java
index 044d7ddb422b..4e82e250de55 100644
--- a/android/source/src/java/org/libreoffice/storage/IDocumentProvider.java
+++ b/android/source/src/java/org/libreoffice/storage/IDocumentProvider.java
@@ -53,8 +53,7 @@ public interface IDocumentProvider {
      * Provides the unique ID for a document provider instance in a program.
      *
      * This ID should be set when the instance is built. It could be used to
-     * tell two instances of the same document provider apart, e. g. two
-     * instances of OwnCloudProvider pointing to different servers.
+     * tell two instances of the same document provider apart.
      *
      * @return Unique ID for a document provider instance.
      */
diff --git a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
deleted file mode 100644
index fa74a54b08e2..000000000000
--- a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudFile.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.libreoffice.storage.owncloud;
-
-import android.content.Context;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.libreoffice.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;
-
-/**
- * Implementation of IFile for ownCloud servers.
- */
-public class OwnCloudFile implements IFile {
-
-    private OwnCloudProvider provider;
-    private RemoteFile file;
-
-    private String name;
-    private String parentPath;
-
-    protected OwnCloudFile(OwnCloudProvider provider, RemoteFile file) {
-        this.provider = provider;
-        this.file = file;
-
-        // get name and parent from path
-        File localFile = new File(file.getRemotePath());
-        this.name = localFile.getName();
-        this.parentPath = localFile.getParent();
-    }
-
-    @Override
-    public URI getUri(){
-
-        try{
-            return URI.create(URLEncoder.encode(file.getRemotePath(),"UTF-8"));
-        }catch(UnsupportedEncodingException e){
-            e.printStackTrace();
-        }
-
-        return null;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean isDirectory() {
-        return file.getMimeType().equals("DIR");
-    }
-
-    @Override
-    public long getSize() {
-        return file.getLength();
-    }
-
-    @Override
-    public Date getLastModified() {
-        return new Date(file.getModifiedTimestamp());
-    }
-
-    @Override
-    public List<IFile> 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()))
-                    children.add(new OwnCloudFile(provider, child));
-            }
-        }
-        return children;
-    }
-
-    @Override
-    public List<IFile> listFiles(FileFilter filter) {
-        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
-    public IFile getParent(Context context) {
-        if (parentPath == null)
-            // this is the root node
-            return null;
-
-        return provider.createFromUri(context, URI.create(parentPath));
-    }
-
-    @Override
-    public File getDocument() {
-        if (isDirectory()) {
-            return null;
-        }
-        File downFolder = provider.getCacheDir();
-        DownloadRemoteFileOperation operation = new DownloadRemoteFileOperation(
-                file.getRemotePath(), downFolder.getAbsolutePath());
-        RemoteOperationResult result = operation.execute(provider.getClient());
-        if (!result.isSuccess()) {
-            throw provider.buildRuntimeExceptionForResultCode(result.getCode());
-        }
-        return new File(downFolder.getAbsolutePath() + file.getRemotePath());
-    }
-
-    @Override
-    public boolean equals(Object object) {
-        if (this == object)
-            return true;
-        if (!(object instanceof OwnCloudFile))
-            return false;
-        OwnCloudFile file = (OwnCloudFile) object;
-        return file.getUri().equals(getUri());
-    }
-
-    @Override
-    public void saveDocument(File newFile) {
-        UploadRemoteFileOperation uploadOperation;
-        if (newFile.length() > ChunkedUploadRemoteFileOperation.CHUNK_SIZE) {
-            uploadOperation = new ChunkedUploadRemoteFileOperation(
-                    newFile.getPath(), file.getRemotePath(), file.getMimeType());
-        } else {
-            uploadOperation = new UploadRemoteFileOperation(newFile.getPath(),
-                    file.getRemotePath(), file.getMimeType());
-        }
-
-        RemoteOperationResult result = uploadOperation.execute(provider
-                .getClient());
-        if (!result.isSuccess()) {
-            throw provider.buildRuntimeExceptionForResultCode(result.getCode());
-        }
-    }
-}
diff --git a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java b/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
deleted file mode 100644
index 0852ab617660..000000000000
--- a/android/source/src/java/org/libreoffice/storage/owncloud/OwnCloudProvider.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.libreoffice.storage.owncloud;
-
-import java.io.File;
-import java.net.URI;
-
-import org.libreoffice.R;
-import org.libreoffice.storage.DocumentProviderSettingsActivity;
-import org.libreoffice.storage.IDocumentProvider;
-import org.libreoffice.storage.IFile;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
-import android.net.Uri;
-import android.preference.PreferenceManager;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.OwnCloudClientFactory;
-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;
-
-
-/**
- * Implementation of IDocumentProvider for ownCloud servers.
- */
-public class OwnCloudProvider implements IDocumentProvider,
-        OnSharedPreferenceChangeListener {
-
-    private int id;
-
-    private Context context;
-    private OwnCloudClient client;
-    private File cacheDir;
-
-    private String serverUrl;
-    private String userName;
-    private String password;
-    private RemoteOperationResult result;
-
-    public OwnCloudProvider(int id, Context context) {
-        this.id = id;
-        this.context = context;
-
-        // read preferences
-        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
-        serverUrl = preferences.getString(
-                DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_SERVER, "");
-        userName = preferences.getString(
-                DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_USER_NAME, "");
-        password = preferences.getString(
-                DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_PASSWORD, "");
-
-        setupClient();
-
-        // make sure cache directory exists, and clear it
-        // TODO: probably we should do smarter cache management
-        cacheDir = new File(context.getCacheDir(), "ownCloud");
-        if (cacheDir.exists()) {
-            deleteRecursive(cacheDir);
-        }
-        cacheDir.mkdirs();
-    }
-
-    private void setupClient() {
-        Uri serverUri = Uri.parse(serverUrl);
-        client = OwnCloudClientFactory.createOwnCloudClient(serverUri, context,
-                true);
-        client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(
-                userName, password));
-    }
-
-    @Override
-    public IFile getRootDirectory(Context context) {
-        return createFromUri(context, URI.create(FileUtils.PATH_SEPARATOR));
-    }
-
-    @Override
-    public IFile createFromUri(Context context, URI uri) {
-        if(serverUrl != "" || userName != "" || password != ""){
-            ReadRemoteFileOperation refreshOperation = new ReadRemoteFileOperation(
-                    uri.getPath());
-            this.result = refreshOperation.execute(client);
-            if (!result.isSuccess()) {
-                throw buildRuntimeExceptionForResultCode(result.getCode());
-            }
-            if (result.getData().size() > 0) {
-                return new OwnCloudFile(this, (RemoteFile) result.getData().get(0));
-            }
-        } else {
-            throw buildRuntimeExceptionForResultCode(ResultCode.WRONG_CONNECTION);
-        }
-
-        return null;
-    }
-
-    @Override
-    public int getNameResource() {
-        return R.string.owncloud;
-    }
-
-    /**
-     * Used by OwnCloudFiles to get a configured client to run their own
-     * operations.
-     *
-     * @return configured OwnCloudClient.
-     */
-    protected OwnCloudClient getClient() {
-        return client;
-    }
-
-    /**
-     * Used by OwnCloudFiles to get the cache directory they should download
-     * files to.
-     *
-     * @return cache directory.
-     */
-    protected File getCacheDir() {
-        return cacheDir;
-    }
-
-    /**
-     * Build the proper RuntimeException for some error result.
-     *
-     * @param code Result code got from some RemoteOperationResult.
-     * @return exception with the proper internationalized error message.
-     */
-    protected RuntimeException buildRuntimeExceptionForResultCode(ResultCode code) {
-        int errorMessage;
-        switch (code) {
-            case WRONG_CONNECTION:  // SocketException
-            case FILE_NOT_FOUND:    // HTTP 404
-                errorMessage = R.string.owncloud_wrong_connection;
-                break;
-            case UNAUTHORIZED:      // wrong user/pass
-                errorMessage = R.string.owncloud_unauthorized;
-                break;
-            default:
-                errorMessage = R.string.owncloud_unspecified_error;
-                break;
-        }
-        return new RuntimeException(context.getString(errorMessage));
-    }
-
-    /**
-     * Deletes files and recursively deletes directories.
-     *
-     * @param file
-     *            File or directory to be deleted.
-     */
-    private static void deleteRecursive(File file) {
-        if (file.isDirectory()) {
-            for (File child : file.listFiles())
-                deleteRecursive(child);
-        }
-        file.delete();
-    }
-
-    @Override
-    public void onSharedPreferenceChanged(SharedPreferences preferences,
-            String key) {
-        boolean changed = false;
-        if (key.equals(DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_SERVER)) {
-            serverUrl = preferences.getString(key, "");
-            changed = true;
-        }
-        else if (key.equals(DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_USER_NAME)) {
-            userName = preferences.getString(key, "");
-            changed = true;
-        }
-        else if (key.equals(DocumentProviderSettingsActivity.KEY_PREF_OWNCLOUD_PASSWORD)) {
-            password = preferences.getString(key, "");
-            changed = true;
-        }
-
-        if (changed)
-            setupClient();
-    }
-
-    @Override
-    public int getId() {
-        return id;
-    }
-
-    @Override
-    public boolean checkProviderAvailability(Context context) {
-        return client != null;
-    }
-}
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index a9d797c4bf28..f52972b86f26 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -277,11 +277,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
                         return true;
                     }
 
-                    case R.id.menu_provider_owncloud: {
-                        switchToDocumentProvider(documentProviderFactory.getProvider(4));
-                        return true;
-                    }
-
                     default:
                         return false;
                 }


More information about the Libreoffice-commits mailing list