-
-
- private void toggleKeepInSync() {
- CheckBox cb = (CheckBox) getView().findViewById(R.id.fdKeepInSync);
- OCFile file = getFile();
- file.setKeepInSync(cb.isChecked());
- mContainerActivity.getStorageManager().saveFile(file);
-
- /// register the OCFile instance in the observer service to monitor local updates;
- /// if necessary, the file is download
- Intent intent = new Intent(getActivity().getApplicationContext(),
- FileObserverService.class);
- intent.putExtra(FileObserverService.KEY_FILE_CMD,
- (cb.isChecked()?
- FileObserverService.CMD_ADD_OBSERVED_FILE:
- FileObserverService.CMD_DEL_OBSERVED_FILE));
- intent.putExtra(FileObserverService.KEY_CMD_ARG_FILE, file);
- intent.putExtra(FileObserverService.KEY_CMD_ARG_ACCOUNT, mAccount);
- getActivity().startService(intent);
-
- if (file.keepInSync()) {
- mContainerActivity.getFileOperationsHelper().syncFile(getFile());
- }
- }
-
- private void showDialogToRemoveFile() {
- OCFile file = getFile();
- ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(
- R.string.confirmation_remove_alert,
- new String[]{file.getFileName()},
- file.isDown() ? R.string.confirmation_remove_remote_and_local : R.string.confirmation_remove_remote,
- file.isDown() ? R.string.confirmation_remove_local : -1,
- R.string.common_cancel);
- confDialog.setOnConfirmationListener(this);
- confDialog.show(getFragmentManager(), FTAG_CONFIRMATION);
- }