implements FileFragment.ContainerActivity,
OnSslUntrustedCertListener, OnEnforceableRefreshListener {
-
-
private SyncBroadcastReceiver mSyncBroadcastReceiver;
private UploadFinishReceiver mUploadFinishReceiver;
private DownloadFinishReceiver mDownloadFinishReceiver;
(uploadedRemotePath.startsWith(currentDir.getRemotePath()));
if (sameAccount && isDescendant) {
- refreshListOfFilesFragment();
+ String linkedToRemotePath =
+ intent.getStringExtra(FileDownloader.EXTRA_LINKED_TO_PATH);
+ if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) {
+ refreshListOfFilesFragment();
+ }
}
boolean uploadWasFine = intent.getBooleanExtra(FileUploader.EXTRA_UPLOAD_RESULT,
}
+ // TODO refactor this receiver, and maybe DownloadFinishReceiver; this method is duplicated :S
+ private boolean isAscendant(String linkedToRemotePath) {
+ OCFile currentDir = getCurrentDir();
+ return (
+ currentDir != null &&
+ currentDir.getRemotePath().startsWith(linkedToRemotePath)
+ );
+ }
+
+
}
*/
private class DownloadFinishReceiver extends BroadcastReceiver {
- //int refreshCounter = 0;
@Override
public void onReceive(Context context, Intent intent) {
try {
- boolean sameAccount = isSameAccount(context, intent);
+ boolean sameAccount = isSameAccount(intent);
String downloadedRemotePath =
intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
boolean isDescendant = isDescendant(downloadedRemotePath);
String linkedToRemotePath =
intent.getStringExtra(FileDownloader.EXTRA_LINKED_TO_PATH);
if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) {
- //Log_OC.v(TAG, "refresh #" + ++refreshCounter);
refreshListOfFilesFragment();
}
refreshSecondFragment(
);
}
- private boolean isSameAccount(Context context, Intent intent) {
+ private boolean isSameAccount(Intent intent) {
String accountName = intent.getStringExtra(FileDownloader.ACCOUNT_NAME);
return (accountName != null && getAccount() != null &&
accountName.equals(getAccount().name));
setFile(file);
}
+ /**
+ * Shows the share view for sharing {@link OCFile} received as a
+ * parameter in the second fragment.
+ *
+ * @param file {@link OCFile} File to share with
+ */
+ @Override
+ public void showShareFile(OCFile file) {
+ Intent intent = new Intent(this, ShareActivity.class);
+ intent.putExtra(EXTRA_FILE, file);
+ intent.putExtra(EXTRA_ACCOUNT, getAccount());
+ startActivity(intent);
+ }
+
@Override
protected void updateActionBarTitleAndHomeButton(OCFile chosenFile) {
if (mDualPane) {
OCFile syncedFile = operation.getLocalFile();
onTransferStateChanged(syncedFile, true, true);
invalidateOptionsMenu();
+ refreshShowDetails();
}
}
}