From: tobiasKaminsky Date: Fri, 13 Nov 2015 16:52:18 +0000 (+0100) Subject: Merge branch 'beta' of github.com:owncloud/android into beta X-Git-Tag: beta-20151122~19 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/420051123c0d61b987f9427c2531b544dd2f68c0?hp=7a3caaff9e7327edcb1f4298747c70f367dfcd9d Merge branch 'beta' of github.com:owncloud/android into beta --- diff --git a/README.md b/README.md index d8808f1b..a2391447 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ The BETA app is only intended to be used by experienced users that want to use and test the latest features. All pull requests labeled "3 - to review" or higher will be included into the branch. -If you find a bug please comment in the corresponding pull request or create a new issue with the label "Beta". + +If you find a bug please verify first if it is *really* a bug in beta, then comment in the corresponding pull request or create a new issue with the prefix "Beta YYYY-MM-DD:". The compiled APKs can be found [here][2] diff --git a/owncloud-android-library b/owncloud-android-library index fff67c91..2e0f2a79 160000 --- a/owncloud-android-library +++ b/owncloud-android-library @@ -1 +1 @@ -Subproject commit fff67c91f73532229cd678cbbee19b52b0852db5 +Subproject commit 2e0f2a79224383145d61cc15ca42c6bcc59902d5 diff --git a/res/drawable-hdpi/ic_play_arrow.png b/res/drawable-hdpi/ic_play_arrow.png new file mode 100644 index 00000000..57c9fa54 Binary files /dev/null and b/res/drawable-hdpi/ic_play_arrow.png differ diff --git a/res/drawable-mdpi/ic_play_arrow.png b/res/drawable-mdpi/ic_play_arrow.png new file mode 100644 index 00000000..c61e948b Binary files /dev/null and b/res/drawable-mdpi/ic_play_arrow.png differ diff --git a/res/drawable-xhdpi/ic_play_arrow.png b/res/drawable-xhdpi/ic_play_arrow.png new file mode 100644 index 00000000..a3c80e73 Binary files /dev/null and b/res/drawable-xhdpi/ic_play_arrow.png differ diff --git a/res/drawable-xxhdpi/ic_play_arrow.png b/res/drawable-xxhdpi/ic_play_arrow.png new file mode 100644 index 00000000..547ef30a Binary files /dev/null and b/res/drawable-xxhdpi/ic_play_arrow.png differ diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 6aec3ba5..c856bf33 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -329,5 +329,8 @@ 파일 %1$d개, 폴더 1개 파일 %1$d개, 폴더 %2$d개 공유 + Share with Users and Groups + No data shared with users yet + Add User or Group 검색 diff --git a/res/values-pt-rBR/strings.xml b/res/values-pt-rBR/strings.xml index 93ce1a12..7b494cdd 100644 --- a/res/values-pt-rBR/strings.xml +++ b/res/values-pt-rBR/strings.xml @@ -245,6 +245,9 @@ Para: Assinatura: Algoritmo: + Este algoritmo de resumo não está disponível no seu telefone. + Impressão digital: + Existe um problema ao carregar o certificado. O certificado não pode ser mostrado. - Nenhuma informação sobre o erro Este é um espaço reservado diff --git a/res/values-sk-rSK/strings.xml b/res/values-sk-rSK/strings.xml index deb4af0c..b48dc6e0 100644 --- a/res/values-sk-rSK/strings.xml +++ b/res/values-sk-rSK/strings.xml @@ -71,6 +71,7 @@ pred sekundami Žiadny súbor. Nahrajte niečo! Načítavam... + Nenašla sa aplikácia pre tento typ súboru! V tomto priečinku nie sú žiadne súbory. Viac informácií získate kliknutím na súbor. Veľkosť: @@ -78,13 +79,16 @@ Vytvorený: Zmenený: Stiahnuť + Synchronizovať Súbor bol premenovaný na %1$s počas nahrávania Rozvrhnutie zoznamu Zdieľať linku Zrušiť zdieľanie odkazu + Zdieľať s používateľmi Áno Nie OK + Zrušiť synchronizáciu Zrušiť Uložiť a ukončiť Chyba @@ -241,6 +245,9 @@ Do: Podpis: Algoritmus: + Algoritmus digest nie je na vašom telefóne dostupný. + Odtlačok: + Nastal problém s načítaním certifikátu. Certifikát nemohol byť zobrazený. - Žiadne informácie o tejto chybe Toto je \"placeholder\" @@ -312,6 +319,7 @@ Okamžité nahratie Zabezpečenie Cesta pre nahrávanie videí + Synchronizáciu priečinka %1$s nebolo možné dokončiť zdieľané s vami %1$s vám zdieľal \"%2$s\" @@ -329,5 +337,12 @@ %1$d súb., 1 priečinok %1$d súb., %2$d prieč. Zdieľanie + Zdieľať s používateľmi alebo skupinami + Zatiaľ s používateľmi nezdieľate žiadne dáta. + Pridať používateľa alebo skupinu Hľadať + Vyhľadať používateľov alebo skupiny + %1$s (skupina) + Je nám ľúto, vaša verzia servera neumožňuje zdieľanie s používateľmi alebo skupinami. +\nProsím, obráťte sa na svojho správcu diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index f3dd3e55..1ba669ee 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -50,6 +50,8 @@ import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.lib.resources.shares.ShareType; +import com.owncloud.android.lib.resources.status.CapabilityBooleanType; +import com.owncloud.android.lib.resources.status.OCCapability; import com.owncloud.android.utils.FileStorageUtils; import java.io.FileInputStream; @@ -1732,4 +1734,183 @@ public class FileDataStorageManager { } } + + public OCCapability saveCapabilities(OCCapability capability){ + + // Prepare capabilities data + ContentValues cv = new ContentValues(); + cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, mAccount.name); + cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MAYOR, capability.getVersionMayor()); + cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MINOR, capability.getVersionMinor()); + cv.put(ProviderTableMeta.CAPABILITIES_VERSION_MICRO, capability.getVersionMicro()); + cv.put(ProviderTableMeta.CAPABILITIES_VERSION_STRING, capability.getVersionString()); + cv.put(ProviderTableMeta.CAPABILITIES_VERSION_EDITION, capability.getVersionEdition()); + cv.put(ProviderTableMeta.CAPABILITIES_CORE_POLLINTERVAL, capability.getCorePollinterval()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_API_ENABLED, capability.getFilesSharingApiEnabled().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ENABLED, + capability.getFilesSharingPublicEnabled().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED, + capability.getFilesSharingPublicPasswordEnforced().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED, + capability.getFilesSharingPublicExpireDateEnabled().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS, + capability.getFilesSharingPublicExpireDateDays()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENFORCED, + capability.getFilesSharingPublicExpireDateEnforced().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_SEND_MAIL, + capability.getFilesSharingPublicSendMail().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_UPLOAD, + capability.getFilesSharingPublicUpload().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_USER_SEND_MAIL, + capability.getFilesSharingUserSendMail().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_RESHARING, capability.getFilesSharingResharing().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_OUTGOING, + capability.getFilesSharingFederationOutgoing().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_INCOMING, + capability.getFilesSharingFederationIncoming().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_FILES_BIGFILECHUNKING, capability.getFilesBigFileChuncking().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_FILES_UNDELETE, capability.getFilesUndelete().getValue()); + cv.put(ProviderTableMeta.CAPABILITIES_FILES_VERSIONING, capability.getFilesVersioning().getValue()); + + if (capabilityExists(mAccount.name)) { + if (getContentResolver() != null) { + getContentResolver().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv, + ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?", + new String[]{mAccount.name}); + } else { + try { + getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, + cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?", + new String[]{mAccount.name}); + } catch (RemoteException e) { + Log_OC.e(TAG, + "Fail to insert insert file to database " + + e.getMessage()); + } + } + } else { + Uri result_uri = null; + if (getContentResolver() != null) { + result_uri = getContentResolver().insert( + ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv); + } else { + try { + result_uri = getContentProviderClient().insert( + ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv); + } catch (RemoteException e) { + Log_OC.e(TAG, + "Fail to insert insert capability to database " + + e.getMessage()); + } + } + if (result_uri != null) { + long new_id = Long.parseLong(result_uri.getPathSegments() + .get(1)); + capability.setId(new_id); + capability.setAccountName(mAccount.name); + } + } + + return capability; + } + + private boolean capabilityExists(String accountName) { + Cursor c = getCapabilityCursorForAccount(accountName); + boolean exists = false; + if (c != null) { + exists = c.moveToFirst(); + c.close(); + } + return exists; + } + + private Cursor getCapabilityCursorForAccount(String accountName){ + Cursor c = null; + if (getContentResolver() != null) { + c = getContentResolver() + .query(ProviderTableMeta.CONTENT_URI_CAPABILITIES, + null, + ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=? ", + new String[]{accountName}, null); + } else { + try { + c = getContentProviderClient().query( + ProviderTableMeta.CONTENT_URI_CAPABILITIES, + null, + ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=? ", + new String[]{accountName}, null); + } catch (RemoteException e) { + Log_OC.e(TAG, + "Couldn't determine capability existance, assuming non existance: " + + e.getMessage()); + } + } + + return c; + + } + public OCCapability getCapability(String accountName){ + OCCapability capability = null; + Cursor c = getCapabilityCursorForAccount(accountName); + + if (c.moveToFirst()) { + capability = createCapabilityInstance(c); + } + c.close(); + return capability; + } + + private OCCapability createCapabilityInstance(Cursor c) { + OCCapability capability = null; + if (c != null) { + capability = new OCCapability(); + capability.setId(c.getLong(c.getColumnIndex(ProviderTableMeta._ID))); + capability.setAccountName(c.getString(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME))); + capability.setVersionMayor(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_MAYOR))); + capability.setVersionMinor(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_MINOR))); + capability.setVersionMicro(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_MICRO))); + capability.setVersionString(c.getString(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_STRING))); + capability.setVersionEdition(c.getString(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_VERSION_EDITION))); + capability.setCorePollinterval(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_CORE_POLLINTERVAL))); + capability.setFilesSharingApiEnabled(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_API_ENABLED)))); + capability.setFilesSharingPublicEnabled(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ENABLED)))); + capability.setFilesSharingPublicPasswordEnforced(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED)))); + capability.setFilesSharingPublicExpireDateEnabled(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED)))); + capability.setFilesSharingPublicExpireDateDays(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS))); + capability.setFilesSharingPublicExpireDateEnforced(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENFORCED)))); + capability.setFilesSharingPublicSendMail(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_SEND_MAIL)))); + capability.setFilesSharingPublicUpload(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_UPLOAD)))); + capability.setFilesSharingUserSendMail(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_USER_SEND_MAIL)))); + capability.setFilesSharingResharing(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_RESHARING)))); + capability.setFilesSharingFederationOutgoing(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_OUTGOING)))); + capability.setFilesSharingFederationIncoming(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_INCOMING)))); + capability.setFilesBigFileChuncking(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_FILES_BIGFILECHUNKING)))); + capability.setFilesUndelete(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_FILES_UNDELETE)))); + capability.setFilesVersioning(CapabilityBooleanType.fromValue(c.getInt(c + .getColumnIndex(ProviderTableMeta.CAPABILITIES_FILES_VERSIONING)))); + + } + return capability; + } } diff --git a/src/com/owncloud/android/datamodel/OCFile.java b/src/com/owncloud/android/datamodel/OCFile.java index 4fcd4394..8cbb95e2 100644 --- a/src/com/owncloud/android/datamodel/OCFile.java +++ b/src/com/owncloud/android/datamodel/OCFile.java @@ -1,6 +1,8 @@ /** * ownCloud Android client application * + * @author Bartek Przybylski + * @author David A. Velasco * Copyright (C) 2012 Bartek Przybylski * Copyright (C) 2015 ownCloud Inc. * @@ -20,6 +22,8 @@ package com.owncloud.android.datamodel; +import android.content.ContentResolver; +import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.webkit.MimeTypeMap; @@ -80,6 +84,12 @@ public class OCFile implements Parcelable, Comparable { private boolean mShareWithSharee; + /** + * URI to the local path of the file contents, if stored in the device; cached after first call + * to {@link #getStorageUri()} + */ + private Uri mLocalUri; + /** * Create new {@link OCFile} with given path. @@ -214,12 +224,31 @@ public class OCFile implements Parcelable, Comparable { } /** + * The URI to the file contents, if stored locally + * + * @return A URI to the local copy of the file, or NULL if not stored in the device + */ + public Uri getStorageUri() { + if (mLocalPath == null || mLocalPath.length() == 0) { + return null; + } + if (mLocalUri == null) { + Uri.Builder builder = new Uri.Builder(); + builder.scheme(ContentResolver.SCHEME_FILE); + builder.path(mLocalPath); + mLocalUri = builder.build(); + } + return mLocalUri; + } + + /** * Can be used to set the path where the file is stored * * @param storage_path to set */ public void setStoragePath(String storage_path) { mLocalPath = storage_path; + mLocalUri = null; } /** diff --git a/src/com/owncloud/android/db/ProviderMeta.java b/src/com/owncloud/android/db/ProviderMeta.java index 82ad94e9..1c674339 100644 --- a/src/com/owncloud/android/db/ProviderMeta.java +++ b/src/com/owncloud/android/db/ProviderMeta.java @@ -31,7 +31,7 @@ import com.owncloud.android.MainApp; public class ProviderMeta { public static final String DB_NAME = "filelist"; - public static final int DB_VERSION = 12; + public static final int DB_VERSION = 13; private ProviderMeta() { } @@ -39,6 +39,7 @@ public class ProviderMeta { static public class ProviderTableMeta implements BaseColumns { public static final String FILE_TABLE_NAME = "filelist"; public static final String OCSHARES_TABLE_NAME = "ocshares"; + public static final String CAPABILITIES_TABLE_NAME = "capabilities"; public static final Uri CONTENT_URI = Uri.parse("content://" + MainApp.getAuthority() + "/"); public static final Uri CONTENT_URI_FILE = Uri.parse("content://" @@ -47,6 +48,8 @@ public class ProviderMeta { + MainApp.getAuthority() + "/dir"); public static final Uri CONTENT_URI_SHARE = Uri.parse("content://" + MainApp.getAuthority() + "/shares"); + public static final Uri CONTENT_URI_CAPABILITIES = Uri.parse("content://" + + MainApp.getAuthority() + "/capabilities"); public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.owncloud.file"; public static final String CONTENT_TYPE_ITEM = "vnd.android.cursor.item/vnd.owncloud.file"; @@ -62,7 +65,7 @@ public class ProviderMeta { public static final String FILE_STORAGE_PATH = "media_path"; public static final String FILE_PATH = "path"; public static final String FILE_ACCOUNT_OWNER = "file_owner"; - public static final String FILE_LAST_SYNC_DATE = "last_sync_date"; // _for_properties, but let's keep it as it is + public static final String FILE_LAST_SYNC_DATE = "last_sync_date";// _for_properties, but let's keep it as it is public static final String FILE_LAST_SYNC_DATE_FOR_DATA = "last_sync_date_for_data"; public static final String FILE_KEEP_IN_SYNC = "keep_in_sync"; public static final String FILE_ETAG = "etag"; @@ -97,5 +100,34 @@ public class ProviderMeta { public static final String OCSHARES_DEFAULT_SORT_ORDER = OCSHARES_FILE_SOURCE + " collate nocase asc"; + // Columns of capabilities table + public static final String CAPABILITIES_ACCOUNT_NAME = "account"; + public static final String CAPABILITIES_VERSION_MAYOR = "version_mayor"; + public static final String CAPABILITIES_VERSION_MINOR = "version_minor"; + public static final String CAPABILITIES_VERSION_MICRO = "version_micro"; + public static final String CAPABILITIES_VERSION_STRING = "version_string"; + public static final String CAPABILITIES_VERSION_EDITION = "version_edition"; + public static final String CAPABILITIES_CORE_POLLINTERVAL = "core_pollinterval"; + public static final String CAPABILITIES_SHARING_API_ENABLED = "sharing_api_enabled"; + public static final String CAPABILITIES_SHARING_PUBLIC_ENABLED = "sharing_public_enabled"; + public static final String CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED = "sharing_public_password_enforced"; + public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED = + "sharing_public_expire_date_enabled"; + public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS = + "sharing_public_expire_date_days"; + public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENFORCED = + "sharing_public_expire_date_enforced"; + public static final String CAPABILITIES_SHARING_PUBLIC_SEND_MAIL = "sharing_public_send_mail"; + public static final String CAPABILITIES_SHARING_PUBLIC_UPLOAD = "sharing_public_upload"; + public static final String CAPABILITIES_SHARING_USER_SEND_MAIL = "sharing_user_send_mail"; + public static final String CAPABILITIES_SHARING_RESHARING = "sharing_resharing"; + public static final String CAPABILITIES_SHARING_FEDERATION_OUTGOING = "sharing_federation_outgoing"; + public static final String CAPABILITIES_SHARING_FEDERATION_INCOMING = "sharing_federation_incoming"; + public static final String CAPABILITIES_FILES_BIGFILECHUNKING = "files_bigfilechunking"; + public static final String CAPABILITIES_FILES_UNDELETE = "files_undelete"; + public static final String CAPABILITIES_FILES_VERSIONING = "files_versioning"; + + public static final String CAPABILITIES_DEFAULT_SORT_ORDER = CAPABILITIES_ACCOUNT_NAME + + " collate nocase asc"; } } diff --git a/src/com/owncloud/android/files/FileMenuFilter.java b/src/com/owncloud/android/files/FileMenuFilter.java index e6638ba0..0b7eb811 100644 --- a/src/com/owncloud/android/files/FileMenuFilter.java +++ b/src/com/owncloud/android/files/FileMenuFilter.java @@ -35,6 +35,8 @@ import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; +import com.owncloud.android.lib.resources.status.CapabilityBooleanType; +import com.owncloud.android.lib.resources.status.OCCapability; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; import com.owncloud.android.ui.activity.ComponentsGetter; @@ -200,7 +202,10 @@ public class FileMenuFilter { } // SHARE FILE, with Users - if (!shareAllowed || mFile == null) { + OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name); + boolean shareApiEnabled = capability != null && + (capability.getFilesSharingApiEnabled().isTrue() || capability.getFilesSharingApiEnabled().isUnknown()); + if (!shareAllowed || mFile == null || !shareApiEnabled ) { toHide.add(R.id.action_share_with_users); } else { toShow.add(R.id.action_share_with_users); diff --git a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java index 676a12c6..e152dafe 100644 --- a/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java +++ b/src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java @@ -227,6 +227,19 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { return; } + if (instantPictureUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context)){ + Account account = AccountUtils.getCurrentOwnCloudAccount(context); + if (account == null) { + Log_OC.w(TAG, "No owncloud account found for instant upload, aborting"); + return; + } + + Intent i = new Intent(context, FileUploader.class); + i.putExtra(FileUploader.KEY_ACCOUNT, account); + i.putExtra(FileUploader.KEY_CANCEL_ALL, true); + context.startService(i); + } + if (!intent.hasExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY) && isOnline(context) && (!instantUploadWhenChargingOnly(context) || (instantUploadWhenChargingOnly(context) && isCharging(context))) @@ -238,6 +251,11 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver { Cursor c = db.getAwaitingFiles(); if (c.moveToFirst()) { do { + if (instantPictureUploadViaWiFiOnly(context) && + !isConnectedViaWiFi(context)){ + break; + } + String account_name = c.getString(c.getColumnIndex("account")); String file_path = c.getString(c.getColumnIndex("path")); File f = new File(file_path); diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index df4dccda..84c6adb5 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -98,6 +98,8 @@ public class FileUploader extends Service public static final String KEY_INSTANT_UPLOAD = "INSTANT_UPLOAD"; public static final String KEY_LOCAL_BEHAVIOUR = "BEHAVIOUR"; + public static final String KEY_CANCEL_ALL = "CANCEL_ALL"; + public static final int LOCAL_BEHAVIOUR_COPY = 0; public static final int LOCAL_BEHAVIOUR_MOVE = 1; public static final int LOCAL_BEHAVIOUR_FORGET = 2; @@ -195,6 +197,21 @@ public class FileUploader extends Service public int onStartCommand(Intent intent, int flags, int startId) { Log_OC.d(TAG, "Starting command with id " + startId); + if (intent.hasExtra(KEY_CANCEL_ALL) && intent.hasExtra(KEY_ACCOUNT)){ + Account account = intent.getParcelableExtra(KEY_ACCOUNT); + + Log_OC.d(TAG, "Account= " + account.name); + + if (mCurrentUpload != null) { + Log_OC.d(TAG, "Current Upload Account= " + mCurrentUpload.getAccount().name); + if (mCurrentUpload.getAccount().name.equals(account.name)) { + mCurrentUpload.cancel(); + } + } + // Cancel pending uploads + cancelUploadForAccount(account.name); + } + if (!intent.hasExtra(KEY_ACCOUNT) || !intent.hasExtra(KEY_UPLOAD_TYPE) || !(intent.hasExtra(KEY_LOCAL_FILE) || intent.hasExtra(KEY_FILE))) { Log_OC.e(TAG, "Not enough information provided in intent"); diff --git a/src/com/owncloud/android/media/MediaService.java b/src/com/owncloud/android/media/MediaService.java index 7bd9c0c6..d6fbfcc2 100644 --- a/src/com/owncloud/android/media/MediaService.java +++ b/src/com/owncloud/android/media/MediaService.java @@ -40,6 +40,7 @@ import android.net.wifi.WifiManager.WifiLock; import android.os.IBinder; import android.os.PowerManager; import android.support.v7.app.AlertDialog; +import android.support.v7.app.NotificationCompat; import android.widget.Toast; import java.io.IOException; @@ -128,7 +129,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre /** Notification to keep in the notification bar while a song is playing */ private NotificationManager mNotificationManager; - private Notification mNotification = null; /** File being played */ private OCFile mFile; @@ -147,8 +147,9 @@ public class MediaService extends Service implements OnCompletionListener, OnPre /** Control panel shown to the user to control the playback, to register through binding */ private MediaControlView mMediaController; - + /** Notification builder to create notifications, new reuse way since Android 6 */ + private NotificationCompat.Builder mNotificationBuilder; /** * Helper method to get an error message suitable to show to users for errors occurred in media playback, @@ -250,6 +251,8 @@ public class MediaService extends Service implements OnCompletionListener, OnPre createWifiLock(WifiManager.WIFI_MODE_FULL, MEDIA_WIFI_LOCK_TAG); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + mNotificationBuilder = new NotificationCompat.Builder(this); + mNotificationBuilder.setColor(this.getResources().getColor(R.color.primary)); mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); mBinder = new MediaServiceBinder(this); } @@ -310,7 +313,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre mState = State.PLAYING; setUpAsForeground(String.format(getString(R.string.media_state_playing), mFile.getFileName())); configAndStartMediaPlayer(); - } } @@ -553,22 +555,25 @@ public class MediaService extends Service implements OnCompletionListener, OnPre /** * Updates the status notification */ - @SuppressWarnings("deprecation") private void updateNotification(String content) { + String ticker = String.format(getString(R.string.media_notif_ticker), getString(R.string.app_name)); + // TODO check if updating the Intent is really necessary Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class); showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, mFile); showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount); showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), - (int)System.currentTimeMillis(), - showDetailsIntent, - PendingIntent.FLAG_UPDATE_CURRENT); - mNotification.when = System.currentTimeMillis(); - //mNotification.contentView.setTextViewText(R.id.status_text, content); - String ticker = String.format(getString(R.string.media_notif_ticker), getString(R.string.app_name)); - mNotification.setLatestEventInfo(getApplicationContext(), ticker, content, mNotification.contentIntent); - mNotificationManager.notify(R.string.media_notif_ticker, mNotification); + + mNotificationBuilder.setContentIntent(PendingIntent.getActivity(getApplicationContext(), + (int) System.currentTimeMillis(), + showDetailsIntent, + PendingIntent.FLAG_UPDATE_CURRENT)); + mNotificationBuilder.setWhen(System.currentTimeMillis()); + mNotificationBuilder.setTicker(ticker); + mNotificationBuilder.setContentTitle(ticker); + mNotificationBuilder.setContentText(content); + + mNotificationManager.notify(R.string.media_notif_ticker, mNotificationBuilder.build()); } @@ -579,35 +584,29 @@ public class MediaService extends Service implements OnCompletionListener, OnPre * * A notification must be created to keep the user aware of the existance of the service. */ - @SuppressWarnings("deprecation") private void setUpAsForeground(String content) { + String ticker = String.format(getString(R.string.media_notif_ticker), getString(R.string.app_name)); + /// creates status notification // TODO put a progress bar to follow the playback progress - mNotification = new Notification(); - mNotification.icon = android.R.drawable.ic_media_play; + mNotificationBuilder.setSmallIcon(R.drawable.ic_play_arrow); //mNotification.tickerText = text; - mNotification.when = System.currentTimeMillis(); - mNotification.flags |= Notification.FLAG_ONGOING_EVENT; - //mNotification.contentView.setTextViewText(R.id.status_text, "ownCloud Music Player"); // NULL POINTER - //mNotification.contentView.setTextViewText(R.id.status_text, getString(R.string.downloader_download_in_progress_content)); - + mNotificationBuilder.setWhen(System.currentTimeMillis()); + mNotificationBuilder.setOngoing(true); /// includes a pending intent in the notification showing the details view of the file Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class); showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, mFile); showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount); showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), - (int)System.currentTimeMillis(), - showDetailsIntent, - PendingIntent.FLAG_UPDATE_CURRENT); - - - //mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification); - String ticker = String.format(getString(R.string.media_notif_ticker), getString(R.string.app_name)); - mNotification.setLatestEventInfo(getApplicationContext(), ticker, content, mNotification.contentIntent); - startForeground(R.string.media_notif_ticker, mNotification); - + mNotificationBuilder.setContentIntent(PendingIntent.getActivity(getApplicationContext(), + (int) System.currentTimeMillis(), + showDetailsIntent, + PendingIntent.FLAG_UPDATE_CURRENT)); + mNotificationBuilder.setContentTitle(ticker); + mNotificationBuilder.setContentText(content); + + startForeground(R.string.media_notif_ticker, mNotificationBuilder.build()); } /** @@ -660,6 +659,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre mState = State.STOPPED; releaseResources(true); giveUpAudioFocus(); + stopForeground(true); super.onDestroy(); } diff --git a/src/com/owncloud/android/operations/CreateFolderOperation.java b/src/com/owncloud/android/operations/CreateFolderOperation.java index b020b92c..0b3343c6 100644 --- a/src/com/owncloud/android/operations/CreateFolderOperation.java +++ b/src/com/owncloud/android/operations/CreateFolderOperation.java @@ -121,4 +121,8 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper Log_OC.d(TAG, "Create directory " + mRemotePath + " in Database"); } } + + public String getRemotePath() { + return mRemotePath; + } } diff --git a/src/com/owncloud/android/operations/GetCapabilitiesOperarion.java b/src/com/owncloud/android/operations/GetCapabilitiesOperarion.java new file mode 100644 index 00000000..0a63449d --- /dev/null +++ b/src/com/owncloud/android/operations/GetCapabilitiesOperarion.java @@ -0,0 +1,51 @@ +/** + * ownCloud Android client application + * + * @author masensio + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +package com.owncloud.android.operations; + +import com.owncloud.android.lib.common.OwnCloudClient; +import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.resources.status.GetRemoteCapabilitiesOperation; +import com.owncloud.android.lib.resources.status.OCCapability; +import com.owncloud.android.operations.common.SyncOperation; + +/** + * Get and save capabilities from the server + */ +public class GetCapabilitiesOperarion extends SyncOperation { + + @Override + protected RemoteOperationResult run(OwnCloudClient client) { + GetRemoteCapabilitiesOperation getCapabilities = new GetRemoteCapabilitiesOperation(); + RemoteOperationResult result = getCapabilities.execute(client); + + if (result.isSuccess()){ + // Read data from the result + if( result.getData()!= null && result.getData().size() > 0) { + OCCapability capability = (OCCapability) result.getData().get(0); + + // Save the capabilities into database + getStorageManager().saveCapabilities(capability); + } + } + + return result; + } + +} diff --git a/src/com/owncloud/android/operations/RefreshFolderOperation.java b/src/com/owncloud/android/operations/RefreshFolderOperation.java index c61446e0..87dde21d 100644 --- a/src/com/owncloud/android/operations/RefreshFolderOperation.java +++ b/src/com/owncloud/android/operations/RefreshFolderOperation.java @@ -187,6 +187,7 @@ public class RefreshFolderOperation extends RemoteOperation { if (OCFile.ROOT_PATH.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) { updateOCVersion(client); + } result = checkForChanges(client); @@ -231,10 +232,24 @@ public class RefreshFolderOperation extends RemoteOperation { RemoteOperationResult result = update.execute(client); if (result.isSuccess()) { mIsShareSupported = update.getOCVersion().isSharedSupported(); + + // Update Capabilities for this account + if (update.getOCVersion().isVersionWithCapabilitiesAPI()) { + updateCapabilities(client); + } else { + Log_OC.d(TAG, "Capabilities API disabled"); + } + } + } + + private void updateCapabilities(OwnCloudClient client){ + GetCapabilitiesOperarion getCapabilities = new GetCapabilitiesOperarion(); + RemoteOperationResult result = getCapabilities.execute(mStorageManager,mContext); + if (!result.isSuccess()){ + Log_OC.d(TAG, "Update Capabilities unsuccessfully"); } } - private RemoteOperationResult checkForChanges(OwnCloudClient client) { mRemoteFolderChanged = true; RemoteOperationResult result = null; diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java index e7b5ba3d..a347192b 100644 --- a/src/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/com/owncloud/android/operations/UploadFileOperation.java @@ -374,6 +374,9 @@ public class UploadFileOperation extends RemoteOperation { if (temporalFile != null && !originalFile.equals(temporalFile)) { temporalFile.delete(); } + if (result == null){ + return new RemoteOperationResult(false, 404, null); + } if (result.isSuccess()) { Log_OC.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage()); diff --git a/src/com/owncloud/android/operations/common/SyncOperation.java b/src/com/owncloud/android/operations/common/SyncOperation.java index 5fb5c8cf..3d917d2a 100644 --- a/src/com/owncloud/android/operations/common/SyncOperation.java +++ b/src/com/owncloud/android/operations/common/SyncOperation.java @@ -20,16 +20,15 @@ package com.owncloud.android.operations.common; -import com.owncloud.android.MainApp; +import android.content.Context; +import android.os.Handler; + import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import android.content.Context; -import android.os.Handler; - /** * Operation which execution involves both interactions with an ownCloud server and diff --git a/src/com/owncloud/android/providers/FileContentProvider.java b/src/com/owncloud/android/providers/FileContentProvider.java index d94d5b5a..e652bade 100644 --- a/src/com/owncloud/android/providers/FileContentProvider.java +++ b/src/com/owncloud/android/providers/FileContentProvider.java @@ -22,20 +22,6 @@ package com.owncloud.android.providers; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; - -import com.owncloud.android.MainApp; -import com.owncloud.android.R; -import com.owncloud.android.datamodel.OCFile; -import com.owncloud.android.db.ProviderMeta; -import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; -import com.owncloud.android.lib.common.accounts.AccountUtils; -import com.owncloud.android.lib.common.utils.Log_OC; -import com.owncloud.android.lib.resources.shares.ShareType; -import com.owncloud.android.utils.FileStorageUtils; - import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentProvider; @@ -54,6 +40,19 @@ import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.text.TextUtils; +import com.owncloud.android.MainApp; +import com.owncloud.android.R; +import com.owncloud.android.datamodel.OCFile; +import com.owncloud.android.db.ProviderMeta; +import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; +import com.owncloud.android.lib.common.accounts.AccountUtils; +import com.owncloud.android.lib.common.utils.Log_OC; +import com.owncloud.android.lib.resources.shares.ShareType; +import com.owncloud.android.utils.FileStorageUtils; + +import java.io.File; +import java.util.ArrayList; + /** * The ContentProvider for the ownCloud App. */ @@ -61,99 +60,14 @@ public class FileContentProvider extends ContentProvider { private DataBaseHelper mDbHelper; - // Projection for filelist table - private static HashMap mFileProjectionMap; - static { - mFileProjectionMap = new HashMap(); - mFileProjectionMap.put(ProviderTableMeta._ID, ProviderTableMeta._ID); - mFileProjectionMap.put(ProviderTableMeta.FILE_PARENT, - ProviderTableMeta.FILE_PARENT); - mFileProjectionMap.put(ProviderTableMeta.FILE_PATH, - ProviderTableMeta.FILE_PATH); - mFileProjectionMap.put(ProviderTableMeta.FILE_NAME, - ProviderTableMeta.FILE_NAME); - mFileProjectionMap.put(ProviderTableMeta.FILE_CREATION, - ProviderTableMeta.FILE_CREATION); - mFileProjectionMap.put(ProviderTableMeta.FILE_MODIFIED, - ProviderTableMeta.FILE_MODIFIED); - mFileProjectionMap.put(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA, - ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA); - mFileProjectionMap.put(ProviderTableMeta.FILE_CONTENT_LENGTH, - ProviderTableMeta.FILE_CONTENT_LENGTH); - mFileProjectionMap.put(ProviderTableMeta.FILE_CONTENT_TYPE, - ProviderTableMeta.FILE_CONTENT_TYPE); - mFileProjectionMap.put(ProviderTableMeta.FILE_STORAGE_PATH, - ProviderTableMeta.FILE_STORAGE_PATH); - mFileProjectionMap.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, - ProviderTableMeta.FILE_LAST_SYNC_DATE); - mFileProjectionMap.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, - ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA); - mFileProjectionMap.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, - ProviderTableMeta.FILE_KEEP_IN_SYNC); - mFileProjectionMap.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, - ProviderTableMeta.FILE_ACCOUNT_OWNER); - mFileProjectionMap.put(ProviderTableMeta.FILE_ETAG, - ProviderTableMeta.FILE_ETAG); - mFileProjectionMap.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, - ProviderTableMeta.FILE_SHARED_VIA_LINK); - mFileProjectionMap.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, - ProviderTableMeta.FILE_SHARED_WITH_SHAREE); - mFileProjectionMap.put(ProviderTableMeta.FILE_PUBLIC_LINK, - ProviderTableMeta.FILE_PUBLIC_LINK); - mFileProjectionMap.put(ProviderTableMeta.FILE_PERMISSIONS, - ProviderTableMeta.FILE_PERMISSIONS); - mFileProjectionMap.put(ProviderTableMeta.FILE_REMOTE_ID, - ProviderTableMeta.FILE_REMOTE_ID); - mFileProjectionMap.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, - ProviderTableMeta.FILE_UPDATE_THUMBNAIL); - mFileProjectionMap.put(ProviderTableMeta.FILE_IS_DOWNLOADING, - ProviderTableMeta.FILE_IS_DOWNLOADING); - mFileProjectionMap.put(ProviderTableMeta.FILE_ETAG_IN_CONFLICT, - ProviderTableMeta.FILE_ETAG_IN_CONFLICT); - } - private static final int SINGLE_FILE = 1; private static final int DIRECTORY = 2; private static final int ROOT_DIRECTORY = 3; private static final int SHARES = 4; + private static final int CAPABILITIES = 5; private static final String TAG = FileContentProvider.class.getSimpleName(); - // Projection for ocshares table - private static HashMap mOCSharesProjectionMap; - static { - mOCSharesProjectionMap = new HashMap(); - mOCSharesProjectionMap.put(ProviderTableMeta._ID, ProviderTableMeta._ID); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_FILE_SOURCE, - ProviderTableMeta.OCSHARES_FILE_SOURCE); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_ITEM_SOURCE, - ProviderTableMeta.OCSHARES_ITEM_SOURCE); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_SHARE_TYPE, - ProviderTableMeta.OCSHARES_SHARE_TYPE); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_SHARE_WITH, - ProviderTableMeta.OCSHARES_SHARE_WITH); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_PATH, - ProviderTableMeta.OCSHARES_PATH); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_PERMISSIONS, - ProviderTableMeta.OCSHARES_PERMISSIONS); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_SHARED_DATE, - ProviderTableMeta.OCSHARES_SHARED_DATE); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_EXPIRATION_DATE, - ProviderTableMeta.OCSHARES_EXPIRATION_DATE); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_TOKEN, - ProviderTableMeta.OCSHARES_TOKEN); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME, - ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, - ProviderTableMeta.OCSHARES_IS_DIRECTORY); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_USER_ID, - ProviderTableMeta.OCSHARES_USER_ID); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, - ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED); - mOCSharesProjectionMap.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, - ProviderTableMeta.OCSHARES_ACCOUNT_OWNER); - } - private UriMatcher mUriMatcher; @Override @@ -253,6 +167,9 @@ public class FileContentProvider extends ContentProvider { case SHARES: count = db.delete(ProviderTableMeta.OCSHARES_TABLE_NAME, where, whereArgs); break; + case CAPABILITIES: + count = db.delete(ProviderTableMeta.CAPABILITIES_TABLE_NAME, where, whereArgs); + break; default: //Log_OC.e(TAG, "Unknown uri " + uri); throw new IllegalArgumentException("Unknown uri: " + uri.toString()); @@ -338,6 +255,17 @@ public class FileContentProvider extends ContentProvider { updateFilesTableAccordingToShareInsertion(db, values); return insertedShareUri; + case CAPABILITIES: + Uri insertedCapUri = null; + long id = db.insert(ProviderTableMeta.CAPABILITIES_TABLE_NAME, null, values); + if (id >0) { + insertedCapUri = + ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_CAPABILITIES, id); + } else { + throw new SQLException("ERROR " + uri); + + } + return insertedCapUri; default: throw new IllegalArgumentException("Unknown uri id: " + uri); @@ -379,6 +307,8 @@ public class FileContentProvider extends ContentProvider { mUriMatcher.addURI(authority, "dir/#", DIRECTORY); mUriMatcher.addURI(authority, "shares/", SHARES); mUriMatcher.addURI(authority, "shares/#", SHARES); + mUriMatcher.addURI(authority, "capabilities/", CAPABILITIES); + mUriMatcher.addURI(authority, "capabilities/#", CAPABILITIES); return true; } @@ -417,7 +347,6 @@ public class FileContentProvider extends ContentProvider { SQLiteQueryBuilder sqlQuery = new SQLiteQueryBuilder(); sqlQuery.setTables(ProviderTableMeta.FILE_TABLE_NAME); - sqlQuery.setProjectionMap(mFileProjectionMap); switch (mUriMatcher.match(uri)) { case ROOT_DIRECTORY: @@ -435,7 +364,13 @@ public class FileContentProvider extends ContentProvider { break; case SHARES: sqlQuery.setTables(ProviderTableMeta.OCSHARES_TABLE_NAME); - sqlQuery.setProjectionMap(mOCSharesProjectionMap); + if (uri.getPathSegments().size() > 1) { + sqlQuery.appendWhere(ProviderTableMeta._ID + "=" + + uri.getPathSegments().get(1)); + } + break; + case CAPABILITIES: + sqlQuery.setTables(ProviderTableMeta.CAPABILITIES_TABLE_NAME); if (uri.getPathSegments().size() > 1) { sqlQuery.appendWhere(ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1)); @@ -447,11 +382,16 @@ public class FileContentProvider extends ContentProvider { String order; if (TextUtils.isEmpty(sortOrder)) { - if (mUriMatcher.match(uri) == SHARES) { - order = ProviderTableMeta.OCSHARES_DEFAULT_SORT_ORDER; - } else { - - order = ProviderTableMeta.FILE_DEFAULT_SORT_ORDER; + switch (mUriMatcher.match(uri)) { + case SHARES: + order = ProviderTableMeta.OCSHARES_DEFAULT_SORT_ORDER; + break; + case CAPABILITIES: + order = ProviderTableMeta.CAPABILITIES_DEFAULT_SORT_ORDER; + break; + default: // Files + order = ProviderTableMeta.FILE_DEFAULT_SORT_ORDER; + break; } } else { order = sortOrder; @@ -496,6 +436,10 @@ public class FileContentProvider extends ContentProvider { return db.update( ProviderTableMeta.OCSHARES_TABLE_NAME, values, selection, selectionArgs ); + case CAPABILITIES: + return db.update( + ProviderTableMeta.CAPABILITIES_TABLE_NAME, values, selection, selectionArgs + ); default: return db.update( ProviderTableMeta.FILE_TABLE_NAME, values, selection, selectionArgs @@ -539,30 +483,30 @@ public class FileContentProvider extends ContentProvider { // files table Log_OC.i("SQL", "Entering in onCreate"); db.execSQL("CREATE TABLE " + ProviderTableMeta.FILE_TABLE_NAME + "(" - + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " - + ProviderTableMeta.FILE_NAME + " TEXT, " - + ProviderTableMeta.FILE_PATH + " TEXT, " - + ProviderTableMeta.FILE_PARENT + " INTEGER, " - + ProviderTableMeta.FILE_CREATION + " INTEGER, " - + ProviderTableMeta.FILE_MODIFIED + " INTEGER, " - + ProviderTableMeta.FILE_CONTENT_TYPE + " TEXT, " - + ProviderTableMeta.FILE_CONTENT_LENGTH + " INTEGER, " - + ProviderTableMeta.FILE_STORAGE_PATH + " TEXT, " - + ProviderTableMeta.FILE_ACCOUNT_OWNER + " TEXT, " - + ProviderTableMeta.FILE_LAST_SYNC_DATE + " INTEGER, " - + ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER, " - + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA + " INTEGER, " - + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " INTEGER, " - + ProviderTableMeta.FILE_ETAG + " TEXT, " - + ProviderTableMeta.FILE_SHARED_VIA_LINK + " INTEGER, " - + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT, " - + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null," - + ProviderTableMeta.FILE_REMOTE_ID + " TEXT null," - + ProviderTableMeta.FILE_UPDATE_THUMBNAIL + " INTEGER," //boolean - + ProviderTableMeta.FILE_IS_DOWNLOADING + " INTEGER," //boolean - + ProviderTableMeta.FILE_ETAG_IN_CONFLICT + " TEXT," - + ProviderTableMeta.FILE_SHARED_WITH_SHAREE + " INTEGER);" - ); + + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " + + ProviderTableMeta.FILE_NAME + " TEXT, " + + ProviderTableMeta.FILE_PATH + " TEXT, " + + ProviderTableMeta.FILE_PARENT + " INTEGER, " + + ProviderTableMeta.FILE_CREATION + " INTEGER, " + + ProviderTableMeta.FILE_MODIFIED + " INTEGER, " + + ProviderTableMeta.FILE_CONTENT_TYPE + " TEXT, " + + ProviderTableMeta.FILE_CONTENT_LENGTH + " INTEGER, " + + ProviderTableMeta.FILE_STORAGE_PATH + " TEXT, " + + ProviderTableMeta.FILE_ACCOUNT_OWNER + " TEXT, " + + ProviderTableMeta.FILE_LAST_SYNC_DATE + " INTEGER, " + + ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER, " + + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA + " INTEGER, " + + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " INTEGER, " + + ProviderTableMeta.FILE_ETAG + " TEXT, " + + ProviderTableMeta.FILE_SHARED_VIA_LINK + " INTEGER, " + + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT, " + + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null," + + ProviderTableMeta.FILE_REMOTE_ID + " TEXT null," + + ProviderTableMeta.FILE_UPDATE_THUMBNAIL + " INTEGER," //boolean + + ProviderTableMeta.FILE_IS_DOWNLOADING + " INTEGER," //boolean + + ProviderTableMeta.FILE_ETAG_IN_CONFLICT + " TEXT," + + ProviderTableMeta.FILE_SHARED_WITH_SHAREE + " INTEGER);" + ); // Create table ocshares db.execSQL("CREATE TABLE " + ProviderTableMeta.OCSHARES_TABLE_NAME + "(" @@ -581,6 +525,10 @@ public class FileContentProvider extends ContentProvider { + ProviderTableMeta.OCSHARES_USER_ID + " INTEGER, " + ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + " INTEGER," + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " TEXT );" ); + + // Create table capabilities + createCapabilitiesTable(db); + } @Override @@ -797,9 +745,52 @@ public class FileContentProvider extends ContentProvider { Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion); + if (oldVersion < 13 && newVersion >= 13) { + Log_OC.i("SQL", "Entering in the #13 ADD in onUpgrade"); + db.beginTransaction(); + try { + // Create capabilities table + createCapabilitiesTable(db); + upgraded = true; + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + if (!upgraded) + Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + + ", newVersion == " + newVersion); + } } + private void createCapabilitiesTable(SQLiteDatabase db){ + // Create table capabilities + db.execSQL("CREATE TABLE " + ProviderTableMeta.CAPABILITIES_TABLE_NAME + "(" + + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " + + ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + " TEXT, " + + ProviderTableMeta.CAPABILITIES_VERSION_MAYOR + " INTEGER, " + + ProviderTableMeta.CAPABILITIES_VERSION_MINOR + " INTEGER, " + + ProviderTableMeta.CAPABILITIES_VERSION_MICRO + " INTEGER, " + + ProviderTableMeta.CAPABILITIES_VERSION_STRING + " TEXT, " + + ProviderTableMeta.CAPABILITIES_VERSION_EDITION + " TEXT, " + + ProviderTableMeta.CAPABILITIES_CORE_POLLINTERVAL + " INTEGER, " + + ProviderTableMeta.CAPABILITIES_SHARING_API_ENABLED + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ENABLED + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS + " INTEGER, " + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENFORCED + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_SEND_MAIL + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_UPLOAD + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_USER_SEND_MAIL + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_RESHARING + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_OUTGOING + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_SHARING_FEDERATION_INCOMING + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_FILES_BIGFILECHUNKING + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_FILES_UNDELETE + " INTEGER, " // boolean + + ProviderTableMeta.CAPABILITIES_FILES_VERSIONING + " INTEGER );" ); // boolean + } /** * Version 10 of database does not modify its scheme. It coincides with the upgrade of the ownCloud account names diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index c19fb4a1..39649ef4 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -323,11 +323,7 @@ public class FileDisplayActivity extends HookActivity startTextPreview(file); } - if (DisplayUtils.isGridView(getFile(), getStorageManager())){ - switchToGridView(); - } else { - switchToListView(); - } + switchLayout(getFile()); } else { Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!"); @@ -340,6 +336,14 @@ public class FileDisplayActivity extends HookActivity } } + private void switchLayout(OCFile file){ + if (DisplayUtils.isGridView(file, getStorageManager())){ + switchToGridView(); + } else { + switchToListView(); + } + } + private Fragment chooseInitialSecondFragment(OCFile file) { Fragment secondFragment = null; if (file != null && !file.isFolder()) { @@ -1304,11 +1308,7 @@ public class FileDisplayActivity extends HookActivity MenuItem menuItem = mOptionsMenu.findItem(R.id.action_switch_view); changeGridIcon(); - if (DisplayUtils.isGridView(directory, getStorageManager())){ - switchToGridView(); - } else { - switchToListView(); - } + switchLayout(directory); } /** diff --git a/src/com/owncloud/android/ui/activity/Uploader.java b/src/com/owncloud/android/ui/activity/Uploader.java index daa136d0..cd80a94e 100644 --- a/src/com/owncloud/android/ui/activity/Uploader.java +++ b/src/com/owncloud/android/ui/activity/Uploader.java @@ -626,6 +626,10 @@ public class Uploader extends FileActivity private void onCreateFolderOperationFinish(CreateFolderOperation operation, RemoteOperationResult result) { if (result.isSuccess()) { + dismissLoadingDialog(); + String remotePath = operation.getRemotePath().substring(0, operation.getRemotePath().length() -1); + String newFolder = remotePath.substring(remotePath.lastIndexOf("/") + 1); + mParents.push(newFolder); populateDirectoryList(); } else { try { diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 543378f5..1362a125 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -217,6 +217,24 @@ public class FileDetailFragment extends FileFragment implements OnClickListener item.setVisible(false); item.setEnabled(false); } + + item = menu.findItem(R.id.action_switch_view); + if (item != null){ + item.setVisible(false); + item.setEnabled(false); + } + + item = menu.findItem(R.id.action_sync_account); + if (item != null) { + item.setVisible(false); + item.setEnabled(false); + } + + item = menu.findItem(R.id.action_sort); + if (item != null) { + item.setVisible(false); + item.setEnabled(false); + } } diff --git a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java index a749b5ce..a047ab36 100644 --- a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -40,8 +40,6 @@ import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.media.MediaPlayer.OnErrorListener; import android.media.MediaPlayer.OnPreparedListener; -import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.view.LayoutInflater; @@ -168,7 +166,7 @@ public class PreviewMediaFragment extends FileFragment implements public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); - Log_OC.e(TAG, "onCreateView"); + Log_OC.v(TAG, "onCreateView"); mView = inflater.inflate(R.layout.file_preview, container, false); @@ -189,7 +187,7 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - Log_OC.e(TAG, "onActivityCreated"); + Log_OC.v(TAG, "onActivityCreated"); OCFile file = getFile(); if (savedInstanceState == null) { @@ -255,7 +253,7 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.e(TAG, "onSaveInstanceState"); + Log_OC.v(TAG, "onSaveInstanceState"); outState.putParcelable(PreviewMediaFragment.EXTRA_FILE, getFile()); outState.putParcelable(PreviewMediaFragment.EXTRA_ACCOUNT, mAccount); @@ -279,7 +277,7 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onStart() { super.onStart(); - Log_OC.e(TAG, "onStart"); + Log_OC.v(TAG, "onStart"); OCFile file = getFile(); if (file != null) { @@ -413,7 +411,7 @@ public class PreviewMediaFragment extends FileFragment implements /** * Update the file of the fragment with file value * - * @param file + * @param file Replaces the held file with a new one */ public void updateFile(OCFile file) { setFile(file); @@ -459,7 +457,7 @@ public class PreviewMediaFragment extends FileFragment implements mUri = generateUrlWithCredentials(account, context, getFile()); } - mVideoPreview.setVideoPath(mUri); + mVideoPreview.setVideoURI(getFile().getStorageUri()); } public static String generateUrlWithCredentials(Account account, Context context, OCFile file){ @@ -523,7 +521,7 @@ public class PreviewMediaFragment extends FileFragment implements */ @Override public void onPrepared(MediaPlayer vp) { - Log_OC.e(TAG, "onPrepared"); + Log_OC.v(TAG, "onPrepared"); mVideoPreview.seekTo(mSavedPlaybackPosition); if (mAutoplay) { mVideoPreview.start(); @@ -543,25 +541,9 @@ public class PreviewMediaFragment extends FileFragment implements */ @Override public void onCompletion(MediaPlayer mp) { - Log_OC.e(TAG, "completed"); + Log_OC.v(TAG, "completed"); if (mp != null) { mVideoPreview.seekTo(0); - // next lines are necessary to work around undesired video loops - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.GINGERBREAD) { - mVideoPreview.pause(); - - } - else { - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.GINGERBREAD_MR1) { - // mVideePreview.pause() is not enough - - mMediaController.setEnabled(false); - mVideoPreview.stopPlayback(); - mAutoplay = false; - mSavedPlaybackPosition = 0; - mVideoPreview.setVideoPath(getFile().getStoragePath()); - } - } } // else : called from onError() mMediaController.updatePausePlay(); } @@ -583,25 +565,25 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onPause() { - Log_OC.e(TAG, "onPause"); + Log_OC.v(TAG, "onPause"); super.onPause(); } @Override public void onResume() { super.onResume(); - Log_OC.e(TAG, "onResume"); + Log_OC.v(TAG, "onResume"); } @Override public void onDestroy() { - Log_OC.e(TAG, "onDestroy"); + Log_OC.v(TAG, "onDestroy"); super.onDestroy(); } @Override public void onStop() { - Log_OC.e(TAG, "onStop"); + Log_OC.v(TAG, "onStop"); mPrepared = false; if (mMediaServiceConnection != null) { @@ -642,12 +624,12 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onConfigurationChanged(Configuration newConfig) { - Log_OC.e(TAG, "onConfigurationChanged " + this); + Log_OC.v(TAG, "onConfigurationChanged " + this); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - Log_OC.e(TAG, "onActivityResult " + this); + Log_OC.v(TAG, "onActivityResult " + this); super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { mSavedPlaybackPosition = data.getExtras().getInt( @@ -721,7 +703,7 @@ public class PreviewMediaFragment extends FileFragment implements @Override public void onServiceDisconnected(ComponentName component) { if (component.equals(new ComponentName(getActivity(), MediaService.class))) { - Log_OC.e(TAG, "Media service suddenly disconnected"); + Log_OC.w(TAG, "Media service suddenly disconnected"); if (mMediaController != null) { mMediaController.setMediaPlayer(null); } @@ -785,7 +767,7 @@ public class PreviewMediaFragment extends FileFragment implements if (mPrepared) { mSavedPlaybackPosition = mVideoPreview.getCurrentPosition(); } - Log_OC.e(TAG, "getting position: " + mSavedPlaybackPosition); + Log_OC.v(TAG, "getting position: " + mSavedPlaybackPosition); return mSavedPlaybackPosition; } diff --git a/src/com/owncloud/android/ui/preview/PreviewTextFragment.java b/src/com/owncloud/android/ui/preview/PreviewTextFragment.java index a07d3dff..a37a1bb3 100644 --- a/src/com/owncloud/android/ui/preview/PreviewTextFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewTextFragment.java @@ -290,6 +290,18 @@ public class PreviewTextFragment extends FileFragment { item.setVisible(false); item.setEnabled(false); } + + item = menu.findItem(R.id.action_switch_view); + if (item != null){ + item.setVisible(false); + item.setEnabled(false); + } + + item = menu.findItem(R.id.action_sort); + if (item != null) { + item.setVisible(false); + item.setEnabled(false); + } } /** diff --git a/src/com/owncloud/android/ui/preview/PreviewVideoActivity.java b/src/com/owncloud/android/ui/preview/PreviewVideoActivity.java index 383b0828..c1b4125e 100644 --- a/src/com/owncloud/android/ui/preview/PreviewVideoActivity.java +++ b/src/com/owncloud/android/ui/preview/PreviewVideoActivity.java @@ -78,7 +78,7 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Log_OC.e(TAG, "ACTIVITY\t\tonCreate"); + Log_OC.v(TAG, "onCreate"); setContentView(R.layout.video_layout); @@ -110,7 +110,6 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - Log_OC.e(TAG, "ACTIVITY\t\tonSaveInstanceState"); outState.putInt(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition()); outState.putBoolean(PreviewVideoActivity.EXTRA_AUTOPLAY , mVideoPlayer.isPlaying()); } @@ -118,7 +117,7 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi @Override public void onBackPressed() { - Log_OC.e(TAG, "ACTIVTIY\t\tonBackPressed"); + Log_OC.v(TAG, "onBackPressed"); Intent i = new Intent(); i.putExtra(EXTRA_AUTOPLAY, mVideoPlayer.isPlaying()); i.putExtra(EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition()); @@ -136,7 +135,7 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi */ @Override public void onPrepared(MediaPlayer mp) { - Log_OC.e(TAG, "ACTIVITY\t\tonPrepare"); + Log_OC.v(TAG, "onPrepare"); mVideoPlayer.seekTo(mSavedPlaybackPosition); if (mAutoplay) { mVideoPlayer.start(); @@ -204,20 +203,20 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi file = getStorageManager().getFileById(file.getFileId()); if (file != null) { if (file.isDown()) { - mVideoPlayer.setVideoPath(file.getStoragePath()); - + mVideoPlayer.setVideoURI(file.getStorageUri()); + } else { String url; url = PreviewMediaFragment.generateUrlWithCredentials(getAccount(), getApplicationContext(), getFile()); mVideoPlayer.setVideoURI(Uri.parse(url)); } - + // create and prepare control panel for the user mMediaController = new MediaController(this); mMediaController.setMediaPlayer(mVideoPlayer); mMediaController.setAnchorView(mVideoPlayer); mVideoPlayer.setMediaController(mMediaController); - + } else { finish(); } diff --git a/tests/project.properties b/tests/project.properties index 00cf62ba..916037e3 100644 --- a/tests/project.properties +++ b/tests/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-22 +target=android-23 diff --git a/user_manual/android_app.rst b/user_manual/android_app.rst index de2b2d57..96612349 100644 --- a/user_manual/android_app.rst +++ b/user_manual/android_app.rst @@ -22,13 +22,13 @@ Dolphin. The first time you log in to a new ownCloud account you'll see a screen with a download link to the ownCloud app in the `Google Play store `_. -.. figure:: images/android-first-screen.jpg +.. figure:: images/android-1.png + :scale: 75% + :alt: Android app new account welcome screen. -You will also find these links on your Personal page in the Web interface, +You will also find these links on your Personal page in the ownCloud Web interface. -You can also get it from the `Amazon App store -`_, and get source code and -more information from the `ownCloud download page +Find source code and more information from the `ownCloud download page `_. Connecting to Your ownCloud Server @@ -39,77 +39,100 @@ screen. Enter your server URL, login name, password, and click the Connect button. (Click the eyeball to the right of your password to expose your password.) -.. figure:: images/android-new-account.png +.. figure:: images/android-2.png + :scale: 75% + :alt: New account creation screen. For best security your ownCloud server should be SSL-enabled, so that you can connect via ``https``. The ownCloud app will test your connection as soon as you enter it and tell you if you entered it correctly. If your server has a -self-signed SSL certificate you'll get a scary warning how it is not to be +self-signed SSL certificate you'll get a warning that it is not to be trusted. Click the OK button to accept the certificate and complete your account setup. -.. figure:: images/android-ssl-cert.png +.. figure:: images/android-3.png + :alt: SSL certificate warning. Managing Files -------------- -Now you should see the Files page of your ownCloud account. Click the overflow -button at the top right (that's the one with three vertical dots, and that is -really what it is called) to open a user menu. ``Refresh account`` refreshes the -page view. ``Settings`` take you to your settings menu. ``Sort`` gives you the -option to sort your files by date, or alphabetically. +Now you should see the Files page of your ownCloud account. -.. figure:: images/android-files-page.png +.. figure:: images/android-4.png + :scale: 75% + :alt: Your ownCloud Files page. -The little file folder icon to the left of the overflow button opens a dialog to -create a new folder. The arrow button opens a file upload dialog, and you can -either upload content from other Android apps such as Google Drive, the Gallery, -your music player, or from your Android filesystem. When you add a new file -you will see a confirmation on the top left when it has uploaded successfully, -and it is immediately synchronized with the server. - -.. figure:: images/android-upload.png - -All files (that you have permission to access) on your ownCloud server are -displayed in your Android app, but are not downloaded until you download them. -Downloaded files are marked with a green arrow. - -.. figure:: images/android-file-list.png - -Download and preview a file with a short press on the filename. When the file -is in preview mode, a short press on the overflow button opens a menu with -options for sharing, opening with an app, removing, sending, and displaying file -details. +The ownCloud menu at the top left shows the name of the logged-in user, has a +shortcut to your files, and contains the Settings button. -.. figure:: images/android-file.png +.. figure:: images/android-5.png + :alt: Top-left menu. +Click the overflow button at the top right (that's the one with three vertical +dots, and that is really what it is called) to open a user menu. ``Refresh +account`` syncs your files, and ``Sort`` gives you the option to sort your files +by date, or alphabetically. -A long press on the filename does not download it, but opens a dialog with -options for sharing, downloading, renaming, moving, removing, sending, and -viewing file details. +.. figure:: images/android-6.png + :alt: Top-right menu. +The little file folder icon to the left of the overflow button opens a dialog to +create a new folder. The arrow button opens a file upload dialog, and you can +either upload content from other Android apps such as Google Drive, the Gallery, +your music player, or from your Android filesystem. -.. figure:: images/android-file-options.png +.. figure:: images/android-7.png + :scale: 75% + :alt: File upload dialogue. +All files (that you have permission to access) on your ownCloud server are +displayed in your Android app, but are not downloaded until you click on them to +download them. Downloaded files are marked with a green arrow. + +.. figure:: images/android-8.png + :scale: 75% + :alt: Downloaded files are marked with green arrows. + +Download and preview a file with a short press on the filename. Then a short +press on the overflow button opens a menu with +options for managing your file. + +.. figure:: images/android-9.png + :scale: 75% + :alt: File management options. Betsy Ross says "Don't believe everything you + read on the Internet." + +When you are on your mail Files page, a long press on any folder displays a +list of options: Share Link, Download, Rename, Move, Copy, and Remove. + +.. figure:: images/android-11.png + :scale: 75% + :alt: Folder and file management options. + +When you enter a folder, a long press on any file or folder has these +additional options: Open With, Refresh File, Send, Favorite, and Details. The +Download option appears on files that have not been downloaded to your Android +device. Settings -------- -The Settings screen offers a number of useful options. In the Accounts -section you can configure multiple ownCloud accounts. +Use the Settings screen to control your ownCloud app functions. + +.. figure:: images/android-10.png + :scale: 75% + :alt: Setting screen. + +In the Accounts section you can set up and manage multiple accounts. The Security section sets up strong two-factor authentication by allowing you to add a PIN (personal identification number) to access your account. -The Instant Uploads section creates a directory, :file:`/InstantUpload`, and -any photos or videos created with your Android device's camera are instantly +The Instant Uploads section creates a directory, :file:`/InstantUpload`, and any +photos or videos created with your Android device's camera are instantly uploaded to this directory. You also have the option to choose any other -existing directory. Another nice option is Upload Pictures/Video via WiFi Only, -to conserve your Internet data usage. - -.. figure:: images/android-settings.png +existing directory, or to create a new one. Another nice option is Upload +Pictures/Video via WiFi Only, to conserve your mobile data usage. The bottom section of the Settings screen has links to help and the app's version number. - -.. figure:: images/android-help.png diff --git a/user_manual/images/android-1.png b/user_manual/images/android-1.png new file mode 100644 index 00000000..ed45645a Binary files /dev/null and b/user_manual/images/android-1.png differ diff --git a/user_manual/images/android-10.png b/user_manual/images/android-10.png new file mode 100644 index 00000000..187a753e Binary files /dev/null and b/user_manual/images/android-10.png differ diff --git a/user_manual/images/android-11.png b/user_manual/images/android-11.png new file mode 100644 index 00000000..c84166ec Binary files /dev/null and b/user_manual/images/android-11.png differ diff --git a/user_manual/images/android-2.png b/user_manual/images/android-2.png new file mode 100644 index 00000000..ddee8e40 Binary files /dev/null and b/user_manual/images/android-2.png differ diff --git a/user_manual/images/android-3.png b/user_manual/images/android-3.png new file mode 100644 index 00000000..14afed9f Binary files /dev/null and b/user_manual/images/android-3.png differ diff --git a/user_manual/images/android-4.png b/user_manual/images/android-4.png new file mode 100644 index 00000000..ee9cf66d Binary files /dev/null and b/user_manual/images/android-4.png differ diff --git a/user_manual/images/android-5.png b/user_manual/images/android-5.png new file mode 100644 index 00000000..d089cc1a Binary files /dev/null and b/user_manual/images/android-5.png differ diff --git a/user_manual/images/android-6.png b/user_manual/images/android-6.png new file mode 100644 index 00000000..20f6fbbd Binary files /dev/null and b/user_manual/images/android-6.png differ diff --git a/user_manual/images/android-7.png b/user_manual/images/android-7.png new file mode 100644 index 00000000..aaa33bf1 Binary files /dev/null and b/user_manual/images/android-7.png differ diff --git a/user_manual/images/android-8.png b/user_manual/images/android-8.png new file mode 100644 index 00000000..b1ecc62f Binary files /dev/null and b/user_manual/images/android-8.png differ diff --git a/user_manual/images/android-9.png b/user_manual/images/android-9.png new file mode 100644 index 00000000..631f6b19 Binary files /dev/null and b/user_manual/images/android-9.png differ diff --git a/user_manual/images/android-downloads.png b/user_manual/images/android-downloads.png deleted file mode 100644 index e0bb5454..00000000 Binary files a/user_manual/images/android-downloads.png and /dev/null differ diff --git a/user_manual/images/android-file-list.png b/user_manual/images/android-file-list.png deleted file mode 100644 index e479b9f0..00000000 Binary files a/user_manual/images/android-file-list.png and /dev/null differ diff --git a/user_manual/images/android-file-options.png b/user_manual/images/android-file-options.png deleted file mode 100644 index 12867a31..00000000 Binary files a/user_manual/images/android-file-options.png and /dev/null differ diff --git a/user_manual/images/android-file.png b/user_manual/images/android-file.png deleted file mode 100644 index 89ffd28b..00000000 Binary files a/user_manual/images/android-file.png and /dev/null differ diff --git a/user_manual/images/android-files-page.png b/user_manual/images/android-files-page.png deleted file mode 100644 index 1c7fc4dd..00000000 Binary files a/user_manual/images/android-files-page.png and /dev/null differ diff --git a/user_manual/images/android-first-screen.jpg b/user_manual/images/android-first-screen.jpg deleted file mode 100644 index f4c5132a..00000000 Binary files a/user_manual/images/android-first-screen.jpg and /dev/null differ diff --git a/user_manual/images/android-help.png b/user_manual/images/android-help.png deleted file mode 100644 index 56a7464f..00000000 Binary files a/user_manual/images/android-help.png and /dev/null differ diff --git a/user_manual/images/android-new-account.png b/user_manual/images/android-new-account.png deleted file mode 100644 index ffbe12e5..00000000 Binary files a/user_manual/images/android-new-account.png and /dev/null differ diff --git a/user_manual/images/android-settings.png b/user_manual/images/android-settings.png deleted file mode 100644 index 7a160845..00000000 Binary files a/user_manual/images/android-settings.png and /dev/null differ diff --git a/user_manual/images/android-ssl-cert.png b/user_manual/images/android-ssl-cert.png deleted file mode 100644 index 9286fe62..00000000 Binary files a/user_manual/images/android-ssl-cert.png and /dev/null differ diff --git a/user_manual/images/android-upload.png b/user_manual/images/android-upload.png deleted file mode 100644 index 6ee1b952..00000000 Binary files a/user_manual/images/android-upload.png and /dev/null differ