From 96e2a2b97bd4065e4218fcda6e99f3015d899935 Mon Sep 17 00:00:00 2001 From: purigarcia Date: Wed, 8 Jul 2015 10:22:41 +0200 Subject: [PATCH] toggleKeepInSync is moved to FileOperationsHelper --- .../android/ui/fragment/FileDetailFragment.java | 24 ++-------------------- .../android/ui/fragment/OCFileListFragment.java | 1 - 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 7983c27c..b093ccb0 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -268,7 +268,8 @@ public class FileDetailFragment extends FileFragment implements OnClickListener 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: { @@ -280,27 +281,6 @@ public class FileDetailFragment extends FileFragment implements OnClickListener } } - - 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. diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 2fb525fb..7160973c 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -42,7 +42,6 @@ import com.owncloud.android.datamodel.OCFile; 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; -- 2.11.0