public void onClick(View v) {
switch (v.getId()) {
case R.id.fdKeepInSync: {
- toggleKeepInSync();
+ CheckBox cb = (CheckBox) getView().findViewById(R.id.fdKeepInSync);
+ mContainerActivity.getFileOperationsHelper().toggleKeepInSync(getFile(),cb.isChecked());
break;
}
case R.id.fdCancelBtn: {
}
}
-
- private void toggleKeepInSync() {
- Log_OC.e(TAG, "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
- Intent observedFileIntent = FileObserverService.makeObservedFileIntent(
- getActivity(),
- file,
- mAccount,
- cb.isChecked());
- getActivity().startService(observedFileIntent);
-
- /// immediate content synchronization
- if (file.keepInSync()) {
- mContainerActivity.getFileOperationsHelper().syncFile(getFile());
- }
- }
/**
* Check if the fragment was created with an empty layout. An empty fragment can't show file details, must be replaced.
import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
-import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.FolderPickerActivity;