فهرست منبع

some minor code formatting

tobiasKaminsky 7 سال پیش
والد
کامیت
09f9019c9c

+ 8 - 17
src/main/java/com/owncloud/android/ui/activity/ShareActivity.java

@@ -154,27 +154,18 @@ public class ShareActivity extends FileActivity
             return OCShare.READ_PERMISSION_FLAG;    // minimum permissions
 
         } else if (isFederated) {
-            OwnCloudVersion serverVersion =
-                    com.owncloud.android.authentication.AccountUtils.getServerVersion(getAccount());
+            OwnCloudVersion serverVersion = com.owncloud.android.authentication.AccountUtils.
+                    getServerVersion(getAccount());
             if (serverVersion != null && serverVersion.isNotReshareableFederatedSupported()) {
-                return (
-                        getFile().isFolder() ?
-                                OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 :
-                                OCShare.FEDERATED_PERMISSIONS_FOR_FILE_AFTER_OC9
-                );
+                return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 :
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FILE_AFTER_OC9);
             } else {
-                return (
-                        getFile().isFolder() ?
-                                OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9 :
-                                OCShare.FEDERATED_PERMISSIONS_FOR_FILE_UP_TO_OC9
-                );
+                return (getFile().isFolder() ? OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9 :
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FILE_UP_TO_OC9);
             }
         } else {
-            return (
-                    getFile().isFolder() ?
-                            OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER :
-                            OCShare.MAXIMUM_PERMISSIONS_FOR_FILE
-            );
+            return (getFile().isFolder() ? OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER :
+                    OCShare.MAXIMUM_PERMISSIONS_FOR_FILE);
         }
     }
 

+ 8 - 12
src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -151,23 +151,19 @@ public class EditShareFragment extends Fragment {
             int sharePermissions = mShare.getPermissions();
             boolean isFederated = ShareType.FEDERATED.equals(mShare.getShareType());
             OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mAccount);
-            boolean isNotReshareableFederatedSupported = (
-                    serverVersion != null &&
-                            serverVersion.isNotReshareableFederatedSupported()
-            );
-            CompoundButton compound;
-
-            compound = (CompoundButton) editShareView.findViewById(R.id.canShareSwitch);
-            if(isFederated) {
+            boolean isNotReshareableFederatedSupported = (serverVersion != null &&
+                    serverVersion.isNotReshareableFederatedSupported());
+
+            CompoundButton compound = (CompoundButton) editShareView.findViewById(R.id.canShareSwitch);
+
+            if (isFederated) {
                 compound.setVisibility(View.INVISIBLE);
             }
             compound.setChecked((sharePermissions & OCShare.SHARE_PERMISSION_FLAG) > 0);
 
             compound = (CompoundButton) editShareView.findViewById(R.id.canEditSwitch);
-            int anyUpdatePermission =
-                    OCShare.CREATE_PERMISSION_FLAG |
-                            OCShare.UPDATE_PERMISSION_FLAG |
-                            OCShare.DELETE_PERMISSION_FLAG;
+            int anyUpdatePermission = OCShare.CREATE_PERMISSION_FLAG | OCShare.UPDATE_PERMISSION_FLAG |
+                    OCShare.DELETE_PERMISSION_FLAG;
             boolean canEdit = (sharePermissions & anyUpdatePermission) > 0;
             compound.setChecked(canEdit);
 

+ 6 - 9
src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -29,7 +29,6 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
-import android.os.Parcelable;
 import android.support.annotation.Nullable;
 import android.support.v4.app.DialogFragment;
 import android.webkit.MimeTypeMap;
@@ -373,8 +372,8 @@ public class FileOperationsHelper {
      */
     public void showShareFile(OCFile file){
         Intent intent = new Intent(mFileActivity, ShareActivity.class);
-        intent.putExtra(mFileActivity.EXTRA_FILE, (Parcelable) file);
-        intent.putExtra(mFileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
+        intent.putExtra(FileActivity.EXTRA_FILE, file);
+        intent.putExtra(FileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
         mFileActivity.startActivity(intent);
 
     }
@@ -481,13 +480,11 @@ public class FileOperationsHelper {
             OwnCloudVersion serverVersion = AccountUtils.getServerVersion(mFileActivity.getAccount());
 
             if (serverVersion != null && serverVersion.isNotReshareableFederatedSupported()) {
-                updateShareIntent.
-                        putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
-                                OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9);
+                updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9);
             } else {
-                updateShareIntent.
-                        putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
-                                OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9);
+                updateShareIntent.putExtra(OperationsService.EXTRA_SHARE_PERMISSIONS,
+                        OCShare.FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9);
             }
         }