瀏覽代碼

Update strings, comments and removed some conditions

Juan Carlos González Cabrero 9 年之前
父節點
當前提交
94864bb094

+ 1 - 1
res/values/strings.xml

@@ -382,7 +382,7 @@
     <string name="share_via_link_expiration_date_label">Set expiration date</string>
     <string name="share_via_link_password_label">Password protect</string>
     <string name="share_via_link_password_title">Secured</string>
-    <string name="share_via_link_edit_permission_label">Allow edit</string>
+    <string name="share_via_link_edit_permission_label">Allow editing</string>
     <string name="share_get_public_link_button">Get link</string>
 
     <string name="share_search">Search</string>

+ 5 - 5
src/com/owncloud/android/files/FileOperationsHelper.java

@@ -411,17 +411,17 @@ public class FileOperationsHelper {
     }
 
     /**
-     * Updates a public share on a file to set its edit permissions.
+     * Updates a public share on a folder to set its editing permission.
      * Starts a request to do it in {@link OperationsService}
      *
-     * @param file                     File which public share will be constrained with an expiration date.
-     * @param uploadPermission          New state of the permissions of edit a folder shared via link.
+     * @param folder                     Folder which editing permission of his public share will be modified.
+     * @param uploadPermission          New state of the permission for editing the folder shared via link.
      */
-    public void setUploadPermissionsToShare(OCFile file, boolean uploadPermission) {
+    public void setUploadPermissionsToShare(OCFile folder, boolean uploadPermission) {
         Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
         updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
         updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
-        updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+        updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, folder.getRemotePath());
         updateShareIntent.putExtra(
                 OperationsService.EXTRA_SHARE_PUBLIC_UPLOAD,
                 uploadPermission

+ 15 - 22
src/com/owncloud/android/ui/fragment/ShareFileFragment.java

@@ -490,17 +490,11 @@ public class ShareFileFragment extends Fragment
                 // Fragment recreation on device rotations
                 return;
             }
-            boolean permission;
-            if (isChecked) {
-                permission = true;
-            } else {
-                permission = false;
-            }
 
             ((FileActivity) getActivity()).getFileOperationsHelper().
                     setUploadPermissionsToShare(
                             mFile,
-                            permission
+                            isChecked
                     );
             ;
 
@@ -742,23 +736,22 @@ public class ShareFileFragment extends Fragment
 
             /// update state of the edit permission switch
             Switch editPermissionSwitch = getEditPermissionSwitch();
-            if(getEditPermissionSection().getVisibility() == View.VISIBLE) {
-                // set null listener before setChecked() to prevent infinite loop of calls
-                editPermissionSwitch.setOnCheckedChangeListener(null);
-                if (mPublicShare.getPermissions() > OCShare.READ_PERMISSION_FLAG) {
-                    if (!editPermissionSwitch.isChecked()) {
-                        editPermissionSwitch.toggle();
-                    }
-                } else {
-                    if (editPermissionSwitch.isChecked()) {
-                        editPermissionSwitch.toggle();
-                    }
+
+            // set null listener before setChecked() to prevent infinite loop of calls
+            editPermissionSwitch.setOnCheckedChangeListener(null);
+            if (mPublicShare.getPermissions() > OCShare.READ_PERMISSION_FLAG) {
+                if (!editPermissionSwitch.isChecked()) {
+                    editPermissionSwitch.toggle();
+                }
+            } else {
+                if (editPermissionSwitch.isChecked()) {
+                    editPermissionSwitch.toggle();
                 }
-                // recover listener
-                editPermissionSwitch.setOnCheckedChangeListener(
-                        mOnEditPermissionInteractionListener
-                );
             }
+            // recover listener
+            editPermissionSwitch.setOnCheckedChangeListener(
+                    mOnEditPermissionInteractionListener
+            );
 
         } else {
             /// no public share -> collapse section