NOTE: You must have mvn (version >= 3.1.1) in your environment path. Current Android 'platforms-tools' need to be installed.
-* Download/install Android plugin for Maven, then build ownCloud with mvn:
-* "cd .."
-* "git clone https://github.com/mosabua/maven-android-sdk-deployer.git"
-* "cd maven-android-sdk-deployer"
-* "mvn -pl com.simpligility.android.sdk-deployer:android-19 -am install"
-* "cd ../android/oc_framework"
-* "mvn install"
-* "cd .."
-* Now you can create ownCloud APK using "mvn package"
+Download/install Android plugin for Maven, install oc_framework, then build ownCloud with mvn:
+
+* cd ..
+* git clone https://github.com/mosabua/maven-android-sdk-deployer.git
+* cd maven-android-sdk-deployer
+* mvn -pl com.simpligility.android.sdk-deployer:android-19 -am install
+* cd ../android/oc_framework
+* mvn install
+* cd ..
+
+Now you can create ownCloud APK using "mvn package"
### 4. Building with Eclipse:
* Again, click "Edit" and set "compare:develop"
* Enter description and send pull request.
+### 6. Create another pull request:
+
+To make sure your new pull request does not contain commits which are already contained in previous PRs, create a new branch which is a clone of upstream/develop.
+
+* git fetch upstream
+* git checkout -b my_new_develop_branch upstream/develop
+* If you want to rename that branch later: "git checkout -b my_new_develop_branch_with_new_name"
+* Push branch to server: "git push -u origin name_of_local_develop_branch"
+* Use Github to issue PR
+
[0]: https://github.com/owncloud/android/blob/master/CONTRIBUTING.md
[1]: http://owncloud.org/about/contributor-agreement/
<string name="uploader_btn_upload_text">Subir</string>
<string name="uploader_wrn_no_account_title">No se encuentra la cuenta</string>
<string name="uploader_info_uploading">Subiendo</string>
+ <string name="filedetails_select_file">Seleccione un archivo para desplegar información adicional.</string>
+ <string name="filedetails_size">Tamaño:</string>
+ <string name="filedetails_type">Tipo:</string>
+ <string name="filedetails_created">Creado:</string>
+ <string name="filedetails_modified">Modificado:</string>
+ <string name="filedetails_download">Descargar</string>
+ <string name="common_yes">Si</string>
+ <string name="common_no">No</string>
+ <string name="common_ok">OK</string>
+ <string name="common_cancel">Cancelar</string>
+ <string name="common_error">Error</string>
+ <string name="uploader_info_dirname">Nombre del directorio</string>
+ <string name="common_choose_account">Elija una cuenta</string>
+ <string name="pincode_enter_pin_code">Por favor, ingreses su PIN de aplicación</string>
+ <string name="pincode_configure_your_pin">Ingrese su PIN de aplicación</string>
+ <string name="pincode_reenter_your_pincode">Por favor, reingrese su PIN de aplicación</string>
</resources>
<string name="prefs_pincode_summary">クライアントを保護する</string>
<string name="prefs_instant_upload">自動アップロードを有効</string>
<string name="prefs_instant_upload_summary">カメラで撮影した画像を自動アップロード</string>
- <string name="prefs_log_title">記録を有効化</string>
- <string name="prefs_log_summary">これは問題を記録するのにつかわれます。</string>
- <string name="prefs_log_title_history">記録している履歴</string>
+ <string name="prefs_log_title">ログを有効にする</string>
+ <string name="prefs_log_summary">これは問題をログに記録するのに使用します。</string>
+ <string name="prefs_log_title_history">ログ履歴</string>
<string name="prefs_log_summary_history">これは記録されたログを表示します</string>
<string name="prefs_log_delete_history_button">履歴を削除</string>
<string name="prefs_help">ヘルプ</string>
<string name="sync_current_folder_was_removed">フォルダ %1$s はもう存在しません</string>
<string name="foreign_files_move">全て移動</string>
<string name="foreign_files_success">全てのファイルは移動されました</string>
- <string name="foreign_files_fail">いくつかのファイルは移動出来ませんでした</string>
+ <string name="foreign_files_fail">一部のファイルは移動できませんでした</string>
<string name="foreign_files_local_text">ローカル: %1$s</string>
<string name="foreign_files_remote_text">リモート: %1$s</string>
<string name="upload_query_move_foreign_files">%1$s フォルダに選択されたファイルをコピーするのに十分なスペースがありません。コピーする代わりに、それらを移動させますか?</string>
<string name="media_err_malformed">メディアファイルが正確にエンコードされていません</string>
<string name="media_err_timeout">再生中にタイムアウトが発生しました</string>
<string name="media_err_invalid_progressive_playback">メディアファイルをストリーミングできません</string>
- <string name="media_err_unknown">メディアファイルをStock Media Playerでプレイ出来ません</string>
+ <string name="media_err_unknown">メディアファイルをStock Media Playerで再生できません</string>
<string name="media_err_security_ex">プレイに際してセキュリティエラー %1$s</string>
<string name="media_err_io_ex">プレイに際して入力エラー %1$s</string>
<string name="media_err_unexpected">プレイに際して予期しないエラー %1$s</string>
<string name="auth_nossl_plain_ok_title">暗号化通信が利用できません。</string>
<string name="auth_connection_established">接続が確立しました</string>
<string name="auth_testing_connection">接続をテスト中...</string>
- <string name="auth_not_configured_title">サーバーの間違った設定</string>
- <string name="auth_account_not_new">å\90\8cã\81\98ã\83¦ã\83¼ã\82¶ã\81¨ã\82µã\83¼ã\83\90のアカウントがデバイス上にすでに存在します</string>
- <string name="auth_account_not_the_same">å\85¥å\8a\9bã\81\95ã\82\8cã\81\9fã\83¦ã\83¼ã\82¶ã\81¯ã\81\93ã\81®ã\82¢ã\82«ã\82¦ã\83³ã\83\88ã\81®ã\83¦ã\83¼ã\82¶と一致しません</string>
+ <string name="auth_not_configured_title">サーバー設定が間違っています</string>
+ <string name="auth_account_not_new">å\90\8cã\81\98ã\83¦ã\83¼ã\82¶ã\83¼ã\81¨ã\82µã\83¼ã\83\90ã\83¼のアカウントがデバイス上にすでに存在します</string>
+ <string name="auth_account_not_the_same">å\85¥å\8a\9bã\81\95ã\82\8cã\81\9fã\83¦ã\83¼ã\82¶ã\83¼ã\81¯ã\81\93ã\81®ã\82¢ã\82«ã\82¦ã\83³ã\83\88ã\81®ã\83¦ã\83¼ã\82¶ã\83¼と一致しません</string>
<string name="auth_unknown_error_title">不明なエラーに発生しました</string>
<string name="auth_unknown_host_title">ホストが見つかりませんでした</string>
- <string name="auth_incorrect_path_title">ã\81®ã\82¤ã\83³ã\82¹ã\82¿ã\83³ã\82¹ã\81\8cè¦\8bã\81¤ã\81\8bã\82\8aã\81¾ã\81\9bã\82\93ã\81§ã\81\97ã\81\9f</string>
- <string name="auth_timeout_title">サーバーからの反応がありません。</string>
+ <string name="auth_incorrect_path_title">ã\82µã\83¼ã\83\90ã\83¼ã\81®ã\82¤ã\83³ã\82¹ã\82¿ã\83³ã\82¹ã\81\8cè¦\8bã\81¤ã\81\8bã\82\8aã\81¾ã\81\9bã\82\93</string>
+ <string name="auth_timeout_title">サーバーからの反応がありません</string>
<string name="auth_incorrect_address_title">不明なURL形式</string>
<string name="auth_ssl_general_error_title">SSLの初期化に失敗しました</string>
- <string name="auth_ssl_unverified_server_title">SSL サーバ識別子を確認できませんでした</string>
- <string name="auth_bad_oc_version_title">認識出来ないサーバのバージョンです</string>
+ <string name="auth_ssl_unverified_server_title">SSLサーバー識別子を確認できませんでした</string>
+ <string name="auth_bad_oc_version_title">認識できないサーバーのバージョンです</string>
<string name="auth_wrong_connection_title">接続を確立できませんでした</string>
<string name="auth_secure_connection">暗号化通信を確立しました</string>
<string name="auth_unauthorized">間違ったユーザー名もしくはパスワード</string>
<string name="auth_expired_oauth_token_toast">認証情報は有効期限切れです。再度認証を行ってください。</string>
<string name="auth_expired_basic_auth_toast">現在のパスワードを入力してください</string>
<string name="auth_expired_saml_sso_token_toast">セッションの有効期限切れです。再度接続してください。</string>
- <string name="auth_connecting_auth_server">認証サーバに接続中 ...</string>
- <string name="auth_unsupported_auth_method">サーバはこの認証方式をサポートしていません</string>
+ <string name="auth_connecting_auth_server">èª\8d証ã\82µã\83¼ã\83\90ã\83¼ã\81«æ\8e¥ç¶\9aä¸ ...</string>
+ <string name="auth_unsupported_auth_method">ã\82µã\83¼ã\83\90ã\83¼ã\81¯ã\81\93ã\81®èª\8d証æ\96¹å¼\8fã\82\92ã\82µã\83\9dã\83¼ã\83\88ã\81\97ã\81¦ã\81\84ã\81¾ã\81\9bã\82\93</string>
<string name="auth_unsupported_multiaccount">%1$s は複数アカウントをサポートしていません</string>
<string name="fd_keep_in_sync">ファイルを最新に保つ</string>
<string name="common_rename">名前を変更</string>
<string name="confirmation_remove_folder_alert">本当に %1$s およびそのコンテンツを削除してもよろしいですか?</string>
<string name="confirmation_remove_local">ローカルのみ</string>
<string name="confirmation_remove_folder_local">ローカルコンテンツのみ</string>
- <string name="confirmation_remove_remote">サーバから削除</string>
+ <string name="confirmation_remove_remote">ã\82µã\83¼ã\83\90ã\83¼ã\81\8bã\82\89å\89\8aé\99¤</string>
<string name="confirmation_remove_remote_and_local">リモートとローカルの両方</string>
<string name="remove_success_msg">削除に成功しました</string>
<string name="remove_fail_msg">削除を完了できませんでした</string>
<string name="wait_a_moment">しばらくお待ちください</string>
<string name="filedisplay_unexpected_bad_get_content">予期せぬ問題;他のアプリでファイルを選択してみてください。</string>
<string name="filedisplay_no_file_selected">ファイルは選択されていません</string>
- <string name="oauth_check_onoff">oAuth2 でログイン</string>
+ <string name="oauth_check_onoff">oAuth2でログイン</string>
<string name="oauth_login_connection">oAuth2サーバーに接続中...</string>
<string name="ssl_validator_header">サイトの識別子を確認できませんでした</string>
- <string name="ssl_validator_reason_cert_not_trusted">- サーバ証明書は信頼されていません</string>
- <string name="ssl_validator_reason_cert_expired">- サーバ証明書は有効期限切れです</string>
- <string name="ssl_validator_reason_cert_not_yet_valid">- サーバ証明書は若すぎます</string>
+ <string name="ssl_validator_reason_cert_not_trusted">- サーバー証明書は信頼されていません</string>
+ <string name="ssl_validator_reason_cert_expired">- サーバー証明書は有効期限切れです</string>
+ <string name="ssl_validator_reason_cert_not_yet_valid">- サーバー証明書の有効期限は未来のものです</string>
<string name="ssl_validator_reason_hostname_not_verified">- URLは証明書内のホスト名と一致しません</string>
<string name="ssl_validator_question">この証明書を信頼してもよろしいですか?</string>
<string name="ssl_validator_not_saved">証明書は保存できませんでした</string>
<string name="placeholder_media_time">12:23:45</string>
<string name="instant_upload_on_wifi">WiFi経由でのみ写真をアップロード</string>
<string name="instant_upload_path">/InstantUpload</string>
- <string name="conflict_title">æ\9b´æ\96°ã\81®競合</string>
- <string name="conflict_message">リモートファイル %s はローカルファイルと同期していません。続行すると、サーバ上のファイルを置き換えます。</string>
+ <string name="conflict_title">æ\9b´æ\96°ã\81\8c競合</string>
+ <string name="conflict_message">リモートファイル %s はローカルファイルと同期していません。続行すると、サーバー上のファイルを置き換えます。</string>
<string name="conflict_keep_both">両方を保持</string>
<string name="conflict_overwrite">上書き</string>
<string name="conflict_dont_upload">アップロードしない</string>
<string name="preview_image_description">イメージプレビュー</string>
<string name="preview_image_error_unknown_format">この画像は表示できません</string>
- <string name="error__upload__local_file_not_copied">%1$s は %2$s ローカルディレクトリにコピー出来ませんでした</string>
+ <string name="error__upload__local_file_not_copied">%1$s は %2$s ローカルディレクトリにコピーできませんでした</string>
<string name="actionbar_failed_instant_upload">インスタントアップロードに失敗</string>
<string name="failed_upload_headline_text">インスタントアップロードに失敗</string>
<string name="failed_upload_headline_hint">全ての失敗したインスタントアップロードの要約</string>
<string name="failed_upload_load_more_images">更に画像を読み込む</string>
<string name="failed_upload_retry_do_nothing_text">オンラインでなく、インスタントアップロードのために何もしません</string>
<string name="failed_upload_failure_text">失敗メッセージ:</string>
- <string name="failed_upload_quota_exceeded_text">サーバーの設定を確認してください。許容を超過している可能性があります。</string>
+ <string name="failed_upload_quota_exceeded_text">サーバー設定を確認してください。クォータサイズを超えている可能性があります。</string>
</resources>
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<resources/>
<string name="common_cancel">Avbryt</string>
<string name="common_save_exit">Lagre og avslutt</string>
<string name="common_error">Feil</string>
+ <string name="common_error_unknown">Ukjent feil</string>
<string name="about_title">Om</string>
<string name="change_password">Endre passord</string>
<string name="delete_account">Slett konto</string>
}
public void saveShares(Collection<OCShare> shares) {
+ cleanShares();
if (shares != null) {
- cleanShares();
-
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(shares.size());
// prepare operations to insert or update files to save in the given folder
}
// apply operations in batch
- @SuppressWarnings("unused")
- ContentProviderResult[] results = null;
- Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider");
- try {
- if (getContentResolver() != null) {
- results = getContentResolver().applyBatch(MainApp.getAuthority(), operations);
-
- } else {
- results = getContentProviderClient().applyBatch(operations);
+ if (operations.size() > 0) {
+ @SuppressWarnings("unused")
+ ContentProviderResult[] results = null;
+ Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider");
+ try {
+ if (getContentResolver() != null) {
+ results = getContentResolver().applyBatch(MainApp.getAuthority(), operations);
+
+ } else {
+ results = getContentProviderClient().applyBatch(operations);
+ }
+
+ } catch (OperationApplicationException e) {
+ Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
+
+ } catch (RemoteException e) {
+ Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
}
-
- } catch (OperationApplicationException e) {
- Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
-
- } catch (RemoteException e) {
- Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
}
-
}
}
public void updateSharedFiles(Collection<OCFile> sharedFiles) {
+ cleanSharedFiles();
+
if (sharedFiles != null) {
- cleanSharedFiles();
-
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(sharedFiles.size());
// prepare operations to insert or update files to save in the given folder
}
// apply operations in batch
- @SuppressWarnings("unused")
- ContentProviderResult[] results = null;
- Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider");
- try {
- if (getContentResolver() != null) {
- results = getContentResolver().applyBatch(MainApp.getAuthority(), operations);
-
- } else {
- results = getContentProviderClient().applyBatch(operations);
+ if (operations.size() > 0) {
+ @SuppressWarnings("unused")
+ ContentProviderResult[] results = null;
+ Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider");
+ try {
+ if (getContentResolver() != null) {
+ results = getContentResolver().applyBatch(MainApp.getAuthority(), operations);
+
+ } else {
+ results = getContentProviderClient().applyBatch(operations);
+ }
+
+ } catch (OperationApplicationException e) {
+ Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
+
+ } catch (RemoteException e) {
+ Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
}
-
- } catch (OperationApplicationException e) {
- Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
-
- } catch (RemoteException e) {
- Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
}
-
}
}
public void saveSharesDB(ArrayList<OCShare> shares) {
-
- if (shares.size() > 0) {
- // Save share file
- saveShares(shares);
-
- ArrayList<OCFile> sharedFiles = new ArrayList<OCFile>();
-
- for (OCShare share : shares) {
- // Get the path
- String path = share.getPath();
- if (share.isDirectory()) {
- path = path + FileUtils.PATH_SEPARATOR;
- }
-
- // Update OCFile with data from share: ShareByLink ¿and publicLink?
- OCFile file = getFileByPath(path);
- if (file != null) {
- if (share.getShareType().equals(ShareType.PUBLIC_LINK)) {
- file.setShareByLink(true);
- sharedFiles.add(file);
- }
- }
- }
-
- if (sharedFiles.size() > 0) {
- updateSharedFiles(sharedFiles);
- }
+ saveShares(shares);
+
+ ArrayList<OCFile> sharedFiles = new ArrayList<OCFile>();
+
+ for (OCShare share : shares) {
+ // Get the path
+ String path = share.getPath();
+ if (share.isDirectory()) {
+ path = path + FileUtils.PATH_SEPARATOR;
+ }
+
+ // Update OCFile with data from share: ShareByLink ¿and publicLink?
+ OCFile file = getFileByPath(path);
+ if (file != null) {
+ if (share.getShareType().equals(ShareType.PUBLIC_LINK)) {
+ file.setShareByLink(true);
+ sharedFiles.add(file);
+ }
+ }
}
+
+ updateSharedFiles(sharedFiles);
}
}
import android.accounts.Account;
import android.content.Context;
import android.content.Intent;
+import android.support.v4.content.LocalBroadcastManager;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.operations.remote.ReadRemoteFileOperation;
import com.owncloud.android.lib.operations.remote.ReadRemoteFolderOperation;
import com.owncloud.android.lib.operations.common.RemoteFile;
-import com.owncloud.android.syncadapter.FileSyncService;
+import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
private static final String TAG = SynchronizeFolderOperation.class.getSimpleName();
+ public static final String EVENT_SINGLE_FOLDER_SYNCED = SynchronizeFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_SYNCED";
/** Time stamp for the synchronization process in progress */
private long mCurrentSyncTime;
}
if (!mSyncFullAccount) {
- sendStickyBroadcast(false, mLocalFolder.getRemotePath(), result);
+ sendLocalBroadcast(mLocalFolder.getRemotePath(), result);
}
return result;
* @param inProgress 'True' when the synchronization progress is not finished.
* @param dirRemotePath Remote path of a folder that was just synchronized (with or without success)
*/
- private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) {
- Intent i = new Intent(FileSyncService.getSyncMessage());
- i.putExtra(FileSyncService.IN_PROGRESS, inProgress);
- i.putExtra(FileSyncService.ACCOUNT_NAME, mAccount.name);
+ private void sendLocalBroadcast(String dirRemotePath, RemoteOperationResult result) {
+ Intent intent = new Intent(EVENT_SINGLE_FOLDER_SYNCED);
+ intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, mAccount.name);
if (dirRemotePath != null) {
- i.putExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH, dirRemotePath);
+ intent.putExtra(FileSyncAdapter.EXTRA_FOLDER_PATH, dirRemotePath);
}
- if (result != null) {
- i.putExtra(FileSyncService.SYNC_RESULT, result);
- }
- mContext.sendStickyBroadcast(i);
+ intent.putExtra(FileSyncAdapter.EXTRA_RESULT, result);
+ //mContext.sendStickyBroadcast(intent);
+ LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
}
import android.content.Intent;
import android.content.SyncResult;
import android.os.Bundle;
+import android.support.v4.content.LocalBroadcastManager;
/**
* Implementation of {@link AbstractThreadedSyncAdapter} responsible for synchronizing
private static final int MAX_FAILED_RESULTS = 3;
+ public static final String EVENT_FULL_SYNC_START = FileSyncAdapter.class.getName() + ".EVENT_FULL_SYNC_START";
+ public static final String EVENT_FULL_SYNC_END = FileSyncAdapter.class.getName() + ".EVENT_FULL_SYNC_END";
+ public static final String EVENT_FOLDER_CONTENTS_SYNCED = FileSyncAdapter.class.getName() + ".EVENT_FOLDER_CONTENTS_SYNCED";
+ public static final String EVENT_FOLDER_SIZE_SYNCED = FileSyncAdapter.class.getName() + ".EVENT_FOLDER_SIZE_SYNCED";
+
+ public static final String EXTRA_ACCOUNT_NAME = FileSyncAdapter.class.getName() + ".EXTRA_ACCOUNT_NAME";
+ public static final String EXTRA_FOLDER_PATH = FileSyncAdapter.class.getName() + ".EXTRA_FOLDER_PATH";
+ public static final String EXTRA_RESULT = FileSyncAdapter.class.getName() + ".EXTRA_RESULT";
+
+
/** Time stamp for the current synchronization process, used to distinguish fresh data */
private long mCurrentSyncTime;
}
Log_OC.d(TAG, "Synchronization of ownCloud account " + account.name + " starting");
- sendStickyBroadcast(true, null, null); // message to signal the start of the synchronization to the UI
+ sendLocalBroadcast(EVENT_FULL_SYNC_START, null, null); // message to signal the start of the synchronization to the UI
try {
updateOCVersion();
if (mForgottenLocalFiles.size() > 0) {
notifyForgottenLocalFiles();
}
- sendStickyBroadcast(false, null, mLastFailedResult); // message to signal the end to the UI
+ sendLocalBroadcast(EVENT_FULL_SYNC_END, null, mLastFailedResult); // message to signal the end to the UI
}
}
// synchronized folder -> notice to UI - ALWAYS, although !result.isSuccess
- sendStickyBroadcast(true, folder.getRemotePath(), null);
+ sendLocalBroadcast(EVENT_FOLDER_CONTENTS_SYNCED, folder.getRemotePath(), result);
// check the result of synchronizing the folder
if (result.isSuccess() || result.getCode() == ResultCode.SYNC_CONFLICT) {
syncDown = (parentEtagChanged || etag == null || etag.length() == 0);
if(syncDown) { */
synchronizeFolder(newFile);
- // update the size of the parent folder again after recursive synchronization
- //getStorageManager().updateFolderSize(parent.getFileId());
- sendStickyBroadcast(true, parent.getRemotePath(), null); // notify again to refresh size in UI
+ sendLocalBroadcast(EVENT_FOLDER_SIZE_SYNCED, parent.getRemotePath(), null);
//}
}
}
/**
* Sends a message to any application component interested in the progress of the synchronization.
*
- * @param inProgress 'True' when the synchronization progress is not finished.
- * @param dirRemotePath Remote path of a folder that was just synchronized (with or without success)
+ * @param event Event in the process of synchronization to be notified.
+ * @param dirRemotePath Remote path of the folder target of the event occurred.
+ * @param result Result of an individual {@ SynchronizeFolderOperation}, if completed; may be null.
*/
- private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) {
- Intent i = new Intent(FileSyncService.getSyncMessage());
- i.putExtra(FileSyncService.IN_PROGRESS, inProgress);
- i.putExtra(FileSyncService.ACCOUNT_NAME, getAccount().name);
+ private void sendLocalBroadcast(String event, String dirRemotePath, RemoteOperationResult result) {
+ Intent intent = new Intent(event);
+ intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, getAccount().name);
if (dirRemotePath != null) {
- i.putExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH, dirRemotePath);
+ intent.putExtra(FileSyncAdapter.EXTRA_FOLDER_PATH, dirRemotePath);
}
if (result != null) {
- i.putExtra(FileSyncService.SYNC_RESULT, result);
+ intent.putExtra(FileSyncAdapter.EXTRA_RESULT, result);
}
- getContext().sendStickyBroadcast(i);
+ //getContext().sendStickyBroadcast(i);
+ LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
}
*/\r
public class FileSyncService extends Service {\r
\r
- private static final String SYNC_MESSAGE = "ACCOUNT_SYNC";\r
- public static final String SYNC_FOLDER_REMOTE_PATH = "SYNC_FOLDER_REMOTE_PATH";\r
- public static final String IN_PROGRESS = "SYNC_IN_PROGRESS";\r
- public static final String ACCOUNT_NAME = "ACCOUNT_NAME";\r
- public static final String SYNC_RESULT = "SYNC_RESULT";\r
-\r
// Storage for an instance of the sync adapter\r
private static FileSyncAdapter sSyncAdapter = null;\r
// Object to use as a thread-safe lock\r
private static final Object sSyncAdapterLock = new Object();\r
\r
- public static String getSyncMessage(){\r
- return FileSyncService.class.getName().toString() + SYNC_MESSAGE;\r
- }\r
/*\r
* {@inheritDoc}\r
*/\r
import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.services.OperationsService;
-import com.owncloud.android.syncadapter.FileSyncService;
+import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.dialog.EditNameDialog;
import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener;
import com.owncloud.android.ui.dialog.LoadingDialog;
// Action bar setup
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
- setSupportProgressBarIndeterminateVisibility(mSyncInProgress); // always AFTER setContentView(...) ; to work around bug in its implementation
+ setSupportProgressBarIndeterminateVisibility(mSyncInProgress || mRefreshSharesInProgress); // always AFTER setContentView(...) ; to work around bug in its implementation
Log_OC.d(TAG, "onCreate() end");
}
Log_OC.e(TAG, "onResume() start");
// Listen for sync messages
- IntentFilter syncIntentFilter = new IntentFilter(FileSyncService.getSyncMessage());
+ IntentFilter syncIntentFilter = new IntentFilter(FileSyncAdapter.EVENT_FULL_SYNC_START);
+ syncIntentFilter.addAction(FileSyncAdapter.EVENT_FULL_SYNC_END);
+ syncIntentFilter.addAction(FileSyncAdapter.EVENT_FOLDER_SIZE_SYNCED);
+ syncIntentFilter.addAction(FileSyncAdapter.EVENT_FOLDER_CONTENTS_SYNCED);
+ syncIntentFilter.addAction(SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SYNCED);
mSyncBroadcastReceiver = new SyncBroadcastReceiver();
- registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
+ //registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
+ LocalBroadcastManager.getInstance(this).registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
// Listen for upload messages
IntentFilter uploadIntentFilter = new IntentFilter(FileUploader.getUploadFinishMessage());
super.onPause();
Log_OC.e(TAG, "onPause() start");
if (mSyncBroadcastReceiver != null) {
- unregisterReceiver(mSyncBroadcastReceiver);
+ //unregisterReceiver(mSyncBroadcastReceiver);
+ LocalBroadcastManager.getInstance(this).unregisterReceiver(mSyncBroadcastReceiver);
mSyncBroadcastReceiver = null;
}
if (mUploadFinishReceiver != null) {
*/
@Override
public void onReceive(Context context, Intent intent) {
- boolean inProgress = intent.getBooleanExtra(FileSyncService.IN_PROGRESS, false);
- String accountName = intent.getStringExtra(FileSyncService.ACCOUNT_NAME);
- RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncService.SYNC_RESULT);
+ String event = intent.getAction();
+ String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
+ String synchFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
+ RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
+ boolean sameAccount = (getAccount() != null && accountName.equals(getAccount().name) && getStorageManager() != null);
- if (getAccount() != null && accountName.equals(getAccount().name)
- && getStorageManager() != null) {
+ if (sameAccount) {
- String synchFolderRemotePath = intent.getStringExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH);
-
- OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath());
- OCFile currentDir = (getCurrentDir() == null) ? null : getStorageManager().getFileByPath(getCurrentDir().getRemotePath());
-
- if (currentDir == null) {
- // current folder was removed from the server
- Toast.makeText( FileDisplayActivity.this,
- String.format(getString(R.string.sync_current_folder_was_removed), mDirectories.getItem(0)),
- Toast.LENGTH_LONG)
- .show();
- browseToRoot();
+ if (!FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
+ OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath());
+ OCFile currentDir = (getCurrentDir() == null) ? null : getStorageManager().getFileByPath(getCurrentDir().getRemotePath());
+
+ if (currentDir == null) {
+ // current folder was removed from the server
+ Toast.makeText( FileDisplayActivity.this,
+ String.format(getString(R.string.sync_current_folder_was_removed), mDirectories.getItem(0)),
+ Toast.LENGTH_LONG)
+ .show();
+ browseToRoot();
+
+ } else {
+ if (currentFile == null && !getFile().isFolder()) {
+ // currently selected file was removed in the server, and now we know it
+ cleanSecondFragment();
+ currentFile = currentDir;
+ }
- } else {
- if (currentFile == null && !getFile().isFolder()) {
- // currently selected file was removed in the server, and now we know it
- cleanSecondFragment();
- currentFile = currentDir;
- }
-
- if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) {
- OCFileListFragment fileListFragment = getListOfFilesFragment();
- if (fileListFragment != null) {
- fileListFragment.listDirectory(currentDir);
+ if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) {
+ OCFileListFragment fileListFragment = getListOfFilesFragment();
+ if (fileListFragment != null) {
+ fileListFragment.listDirectory(currentDir);
+ }
}
+ setFile(currentFile);
}
- setFile(currentFile);
- }
-
- if (!mRefreshSharesInProgress) {
- /// get the shared files
- if (getFileOperationsHelper().isSharedSupported(FileDisplayActivity.this)) {
+
+ mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
+ !SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SYNCED.equals(event) &&
+ (synchResult == null || synchResult.isSuccess())) ;
+
+ if (synchResult != null &&
+ synchResult.isSuccess() &&
+ (SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SYNCED.equals(event) ||
+ FileSyncAdapter.EVENT_FOLDER_CONTENTS_SYNCED.equals(event)
+ ) &&
+ !mRefreshSharesInProgress &&
+ getFileOperationsHelper().isSharedSupported(FileDisplayActivity.this)
+ ) {
startGetShares();
}
- setSupportProgressBarIndeterminateVisibility(inProgress);
- } else {
- setSupportProgressBarIndeterminateVisibility(true);
+
}
-
- removeStickyBroadcast(intent);
- mSyncInProgress = inProgress;
-
+ //removeStickyBroadcast(intent);
+ setSupportProgressBarIndeterminateVisibility(mSyncInProgress || mRefreshSharesInProgress);
}
if (synchResult != null) {
startService(intent);
mRefreshSharesInProgress = true;
- setSupportProgressBarIndeterminateVisibility(true);
-
}
}
/* ownCloud Android client application\r
* Copyright (C) 2011 Bartek Przybylski\r
- * Copyright (C) 2012-2013 ownCloud Inc.\r
+ * Copyright (C) 2012-2014 ownCloud Inc.\r
*\r
* This program is free software: you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License version 2,\r
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
- * Copyright (C) 2012-2013 ownCloud Inc.
+ * Copyright (C) 2012-2014 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,
view.findViewById(R.id.imageView2).setVisibility(View.INVISIBLE); // not GONE; the alignment changes; ugly way to keep it
view.findViewById(R.id.imageView3).setVisibility(View.GONE);
+
+ view.findViewById(R.id.shareIcon).setVisibility(View.GONE);
}
return view;