import com.owncloud.android.ui.activity.TransferServiceGetter;\r
import com.owncloud.android.ui.dialog.EditNameDialog;\r
import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener;\r
-import com.owncloud.android.utils.FileStorageUtils;\r
import com.owncloud.android.utils.OwnCloudVersion;\r
\r
import com.owncloud.android.R;\r
mFile.setKeepInSync(cb.isChecked());\r
FileDataStorageManager fdsm = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver());\r
fdsm.saveFile(mFile);\r
- if (mFile.keepInSync()) {\r
+ \r
+ /* NOT HERE\r
+ * now that FileObserverService is involved, the easiest way to coordinate it with the download service\r
+ * in every possible case is let the FileObserverService decide if the download should be started at\r
+ * this moment or not\r
+ * \r
+ * see changes at FileObserverService#addObservedFile\r
+ \r
+ if (mFile.keepInSync()) {\r
onClick(getView().findViewById(R.id.fdDownloadBtn));\r
} else {\r
mContainerActivity.onFileStateChanged(); // put inside 'else' to not call it twice (here, and in the virtual click on fdDownloadBtn)\r
- }\r
+ }*/\r
\r
+ /// register the OCFile instance in the observer service to monitor local updates;\r
+ /// if necessary, the file is download \r
Intent intent = new Intent(getActivity().getApplicationContext(),\r
FileObserverService.class);\r
intent.putExtra(FileObserverService.KEY_FILE_CMD,\r
(cb.isChecked()?\r
FileObserverService.CMD_ADD_OBSERVED_FILE:\r
FileObserverService.CMD_DEL_OBSERVED_FILE));\r
- String localPath = mFile.getStoragePath();\r
- if (localPath == null || localPath.length() <= 0) {\r
- localPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile);\r
- }\r
- intent.putExtra(FileObserverService.KEY_CMD_ARG, localPath);\r
+ intent.putExtra(FileObserverService.KEY_CMD_ARG_FILE, mFile);\r
+ intent.putExtra(FileObserverService.KEY_CMD_ARG_ACCOUNT, mAccount);\r
Log.e(TAG, "starting observer service");\r
getActivity().startService(intent);\r
\r
+ mContainerActivity.onFileStateChanged(); \r
break;\r
}\r
case R.id.fdRenameBtn: {\r