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]
-Subproject commit fff67c91f73532229cd678cbbee19b52b0852db5
+Subproject commit 2e0f2a79224383145d61cc15ca42c6bcc59902d5
<string name="file_list__footer__files_and_folder">파일 %1$d개, 폴더 1개</string>
<string name="file_list__footer__files_and_folders">파일 %1$d개, 폴더 %2$d개</string>
<string name="share_dialog_title">공유</string>
+ <string name="share_with_user_section_title">Share with Users and Groups</string>
+ <string name="share_no_users">No data shared with users yet</string>
+ <string name="share_add_user_or_group">Add User or Group</string>
<string name="share_search">검색</string>
</resources>
<string name="ssl_validator_label_validity_to">Para:</string>
<string name="ssl_validator_label_signature">Assinatura:</string>
<string name="ssl_validator_label_signature_algorithm">Algoritmo:</string>
+ <string name="digest_algorithm_not_available">Este algoritmo de resumo não está disponível no seu telefone.</string>
+ <string name="ssl_validator_label_certificate_fingerprint">Impressão digital:</string>
+ <string name="certificate_load_problem">Existe um problema ao carregar o certificado.</string>
<string name="ssl_validator_null_cert">O certificado não pode ser mostrado.</string>
<string name="ssl_validator_no_info_about_error">- Nenhuma informação sobre o erro</string>
<string name="placeholder_sentence">Este é um espaço reservado</string>
<string name="file_list_seconds_ago">pred sekundami</string>
<string name="file_list_empty">Žiadny súbor. Nahrajte niečo!</string>
<string name="file_list_loading">Načítavam...</string>
+ <string name="file_list_no_app_for_file_type">Nenašla sa aplikácia pre tento typ súboru!</string>
<string name="local_file_list_empty">V tomto priečinku nie sú žiadne súbory.</string>
<string name="filedetails_select_file">Viac informácií získate kliknutím na súbor.</string>
<string name="filedetails_size">Veľkosť:</string>
<string name="filedetails_created">Vytvorený:</string>
<string name="filedetails_modified">Zmenený:</string>
<string name="filedetails_download">Stiahnuť</string>
+ <string name="filedetails_sync_file">Synchronizovať</string>
<string name="filedetails_renamed_in_upload_msg">Súbor bol premenovaný na %1$s počas nahrávania</string>
<string name="list_layout">Rozvrhnutie zoznamu</string>
<string name="action_share_file">Zdieľať linku</string>
<string name="action_unshare_file">Zrušiť zdieľanie odkazu</string>
+ <string name="action_share_with_users">Zdieľať s používateľmi</string>
<string name="common_yes">Áno</string>
<string name="common_no">Nie</string>
<string name="common_ok">OK</string>
+ <string name="common_cancel_sync">Zrušiť synchronizáciu</string>
<string name="common_cancel">Zrušiť</string>
<string name="common_save_exit">Uložiť a ukončiť</string>
<string name="common_error">Chyba</string>
<string name="ssl_validator_label_validity_to">Do: </string>
<string name="ssl_validator_label_signature">Podpis:</string>
<string name="ssl_validator_label_signature_algorithm">Algoritmus:</string>
+ <string name="digest_algorithm_not_available">Algoritmus digest nie je na vašom telefóne dostupný.</string>
+ <string name="ssl_validator_label_certificate_fingerprint">Odtlačok:</string>
+ <string name="certificate_load_problem">Nastal problém s načítaním certifikátu.</string>
<string name="ssl_validator_null_cert">Certifikát nemohol byť zobrazený.</string>
<string name="ssl_validator_no_info_about_error">- Žiadne informácie o tejto chybe</string>
<string name="placeholder_sentence">Toto je \"placeholder\"</string>
<string name="prefs_category_instant_uploading">Okamžité nahratie</string>
<string name="prefs_category_security">Zabezpečenie</string>
<string name="prefs_instant_video_upload_path_title">Cesta pre nahrávanie videí</string>
+ <string name="sync_folder_failed_content">Synchronizáciu priečinka %1$s nebolo možné dokončiť</string>
<string name="shared_subject_header">zdieľané</string>
<string name="with_you_subject_header">s vami</string>
<string name="subject_user_shared_with_you">%1$s vám zdieľal \"%2$s\"</string>
<string name="file_list__footer__files_and_folder">%1$d súb., 1 priečinok</string>
<string name="file_list__footer__files_and_folders">%1$d súb., %2$d prieč.</string>
<string name="share_dialog_title">Zdieľanie</string>
+ <string name="share_with_user_section_title">Zdieľať s používateľmi alebo skupinami</string>
+ <string name="share_no_users">Zatiaľ s používateľmi nezdieľate žiadne dáta.</string>
+ <string name="share_add_user_or_group">Pridať používateľa alebo skupinu</string>
<string name="share_search">Hľadať</string>
+ <string name="search_users_and_groups_hint">Vyhľadať používateľov alebo skupiny</string>
+ <string name="share_group_clarification">%1$s (skupina)</string>
+ <string name="share_sharee_unavailable">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</string>
</resources>
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;
}
}
+
+ 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;
+ }
}
/**
* ownCloud Android client application
*
+ * @author Bartek Przybylski
+ * @author David A. Velasco
* Copyright (C) 2012 Bartek Przybylski
* Copyright (C) 2015 ownCloud Inc.
*
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;
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.
}
/**
+ * 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;
}
/**
public class ProviderMeta {\r
\r
public static final String DB_NAME = "filelist";\r
- public static final int DB_VERSION = 12;\r
+ public static final int DB_VERSION = 13;\r
\r
private ProviderMeta() {\r
}\r
static public class ProviderTableMeta implements BaseColumns {\r
public static final String FILE_TABLE_NAME = "filelist";\r
public static final String OCSHARES_TABLE_NAME = "ocshares";\r
+ public static final String CAPABILITIES_TABLE_NAME = "capabilities";\r
public static final Uri CONTENT_URI = Uri.parse("content://"\r
+ MainApp.getAuthority() + "/");\r
public static final Uri CONTENT_URI_FILE = Uri.parse("content://"\r
+ MainApp.getAuthority() + "/dir");\r
public static final Uri CONTENT_URI_SHARE = Uri.parse("content://"\r
+ MainApp.getAuthority() + "/shares");\r
+ public static final Uri CONTENT_URI_CAPABILITIES = Uri.parse("content://"\r
+ + MainApp.getAuthority() + "/capabilities");\r
\r
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.owncloud.file";\r
public static final String CONTENT_TYPE_ITEM = "vnd.android.cursor.item/vnd.owncloud.file";\r
public static final String FILE_STORAGE_PATH = "media_path";\r
public static final String FILE_PATH = "path";\r
public static final String FILE_ACCOUNT_OWNER = "file_owner";\r
- public static final String FILE_LAST_SYNC_DATE = "last_sync_date"; // _for_properties, but let's keep it as it is\r
+ public static final String FILE_LAST_SYNC_DATE = "last_sync_date";// _for_properties, but let's keep it as it is\r
public static final String FILE_LAST_SYNC_DATE_FOR_DATA = "last_sync_date_for_data";\r
public static final String FILE_KEEP_IN_SYNC = "keep_in_sync";\r
public static final String FILE_ETAG = "etag";\r
public static final String OCSHARES_DEFAULT_SORT_ORDER = OCSHARES_FILE_SOURCE \r
+ " collate nocase asc";\r
\r
+ // Columns of capabilities table\r
+ public static final String CAPABILITIES_ACCOUNT_NAME = "account";\r
+ public static final String CAPABILITIES_VERSION_MAYOR = "version_mayor";\r
+ public static final String CAPABILITIES_VERSION_MINOR = "version_minor";\r
+ public static final String CAPABILITIES_VERSION_MICRO = "version_micro";\r
+ public static final String CAPABILITIES_VERSION_STRING = "version_string";\r
+ public static final String CAPABILITIES_VERSION_EDITION = "version_edition";\r
+ public static final String CAPABILITIES_CORE_POLLINTERVAL = "core_pollinterval";\r
+ public static final String CAPABILITIES_SHARING_API_ENABLED = "sharing_api_enabled";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_ENABLED = "sharing_public_enabled";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_PASSWORD_ENFORCED = "sharing_public_password_enforced";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENABLED =\r
+ "sharing_public_expire_date_enabled";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_DAYS =\r
+ "sharing_public_expire_date_days";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_EXPIRE_DATE_ENFORCED =\r
+ "sharing_public_expire_date_enforced";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_SEND_MAIL = "sharing_public_send_mail";\r
+ public static final String CAPABILITIES_SHARING_PUBLIC_UPLOAD = "sharing_public_upload";\r
+ public static final String CAPABILITIES_SHARING_USER_SEND_MAIL = "sharing_user_send_mail";\r
+ public static final String CAPABILITIES_SHARING_RESHARING = "sharing_resharing";\r
+ public static final String CAPABILITIES_SHARING_FEDERATION_OUTGOING = "sharing_federation_outgoing";\r
+ public static final String CAPABILITIES_SHARING_FEDERATION_INCOMING = "sharing_federation_incoming";\r
+ public static final String CAPABILITIES_FILES_BIGFILECHUNKING = "files_bigfilechunking";\r
+ public static final String CAPABILITIES_FILES_UNDELETE = "files_undelete";\r
+ public static final String CAPABILITIES_FILES_VERSIONING = "files_versioning";\r
+\r
+ public static final String CAPABILITIES_DEFAULT_SORT_ORDER = CAPABILITIES_ACCOUNT_NAME\r
+ + " collate nocase asc";\r
}\r
}\r
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;
}
// 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);
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)))
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);
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;
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");
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;
/** 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;
/** 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,
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);
}
mState = State.PLAYING;
setUpAsForeground(String.format(getString(R.string.media_state_playing), mFile.getFileName()));
configAndStartMediaPlayer();
-
}
}
/**
* 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());
}
*
* 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());
}
/**
mState = State.STOPPED;
releaseResources(true);
giveUpAudioFocus();
+ stopForeground(true);
super.onDestroy();
}
Log_OC.d(TAG, "Create directory " + mRemotePath + " in Database");
}
}
+
+ public String getRemotePath() {
+ return mRemotePath;
+ }
}
--- /dev/null
+/**
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+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;
+ }
+
+}
if (OCFile.ROOT_PATH.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) {
updateOCVersion(client);
+
}
result = checkForChanges(client);
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;
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());
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
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;
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.
*/
private DataBaseHelper mDbHelper;
- // Projection for filelist table
- private static HashMap<String, String> mFileProjectionMap;
- static {
- mFileProjectionMap = new HashMap<String, String>();
- 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<String, String> mOCSharesProjectionMap;
- static {
- mOCSharesProjectionMap = new HashMap<String, String>();
- 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
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());
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);
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;
}
SQLiteQueryBuilder sqlQuery = new SQLiteQueryBuilder();
sqlQuery.setTables(ProviderTableMeta.FILE_TABLE_NAME);
- sqlQuery.setProjectionMap(mFileProjectionMap);
switch (mUriMatcher.match(uri)) {
case ROOT_DIRECTORY:
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));
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;
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
// 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 + "("
+ ProviderTableMeta.OCSHARES_USER_ID + " INTEGER, "
+ ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + " INTEGER,"
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " TEXT );" );
+
+ // Create table capabilities
+ createCapabilitiesTable(db);
+
}
@Override
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
startTextPreview(file);
}
- if (DisplayUtils.isGridView(getFile(), getStorageManager())){
- switchToGridView();
- } else {
- switchToListView();
- }
+ switchLayout(getFile());
} else {
Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!");
}
}
+ 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()) {
MenuItem menuItem = mOptionsMenu.findItem(R.id.action_switch_view);
changeGridIcon();
- if (DisplayUtils.isGridView(directory, getStorageManager())){
- switchToGridView();
- } else {
- switchToListView();
- }
+ switchLayout(directory);
}
/**
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 {
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);
+ }
}
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;
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);
@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) {
@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);
@Override
public void onStart() {
super.onStart();
- Log_OC.e(TAG, "onStart");
+ Log_OC.v(TAG, "onStart");
OCFile file = getFile();
if (file != null) {
/**
* 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);
mUri = generateUrlWithCredentials(account, context, getFile());
}
- mVideoPreview.setVideoPath(mUri);
+ mVideoPreview.setVideoURI(getFile().getStorageUri());
}
public static String generateUrlWithCredentials(Account account, Context context, OCFile file){
*/
@Override
public void onPrepared(MediaPlayer vp) {
- Log_OC.e(TAG, "onPrepared");
+ Log_OC.v(TAG, "onPrepared");
mVideoPreview.seekTo(mSavedPlaybackPosition);
if (mAutoplay) {
mVideoPreview.start();
*/
@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();
}
@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) {
@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(
@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);
}
if (mPrepared) {
mSavedPlaybackPosition = mVideoPreview.getCurrentPosition();
}
- Log_OC.e(TAG, "getting position: " + mSavedPlaybackPosition);
+ Log_OC.v(TAG, "getting position: " + mSavedPlaybackPosition);
return mSavedPlaybackPosition;
}
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);
+ }
}
/**
@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);
@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());
}
@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());
*/
@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();
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();
}
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
-target=android-22
+target=android-23
with a download link to the ownCloud app in the `Google Play store
<https://play.google.com/store/apps/details?id=com.owncloud.android>`_.
-.. 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
-<http://www.amazon.com/ownCloud-Inc/dp/B00944PQMK/>`_, and get source code and
-more information from the `ownCloud download page
+Find source code and more information from the `ownCloud download page
<http://owncloud.org/install/#mobile>`_.
Connecting to Your ownCloud Server
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