ソースを参照

simplify if-clauses

AndyScherzinger 6 年 前
コミット
c0e116a298

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

@@ -92,7 +92,7 @@ public class FileOperationsHelper {
     private static final String TAG = FileOperationsHelper.class.getSimpleName();
     private static final String TAG = FileOperationsHelper.class.getSimpleName();
     private static final Pattern mPatternUrl = Pattern.compile("^URL=(.+)$");
     private static final Pattern mPatternUrl = Pattern.compile("^URL=(.+)$");
     private static final Pattern mPatternString = Pattern.compile("<string>(.+)</string>");
     private static final Pattern mPatternString = Pattern.compile("<string>(.+)</string>");
-    private FileActivity mFileActivity = null;
+    private FileActivity mFileActivity;
     /// Identifier of operation in progress which result shouldn't be lost
     /// Identifier of operation in progress which result shouldn't be lost
     private long mWaitingForOpId = Long.MAX_VALUE;
     private long mWaitingForOpId = Long.MAX_VALUE;
 
 
@@ -431,10 +431,8 @@ public class FileOperationsHelper {
      * @return 'True' if the server supports the Share API
      * @return 'True' if the server supports the Share API
      */
      */
     public boolean isSharedSupported() {
     public boolean isSharedSupported() {
-        if (mFileActivity.getAccount() != null) {
-            return AccountUtils.getServerVersion(mFileActivity.getAccount()).isSharedSupported();
-        }
-        return false;
+        return mFileActivity.getAccount() != null &&
+                AccountUtils.getServerVersion(mFileActivity.getAccount()).isSharedSupported();
     }
     }
 
 
 
 
@@ -474,8 +472,7 @@ public class FileOperationsHelper {
     private void queueShareIntent(Intent shareIntent) {
     private void queueShareIntent(Intent shareIntent) {
         if (isSharedSupported()) {
         if (isSharedSupported()) {
             // Unshare the file
             // Unshare the file
-            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().
-                    queueNewOperation(shareIntent);
+            mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(shareIntent);
 
 
             mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
             mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
                     getString(R.string.wait_a_moment));
                     getString(R.string.wait_a_moment));
@@ -942,10 +939,8 @@ public class FileOperationsHelper {
      * @return 'True' if the server doesn't need to check forbidden characters
      * @return 'True' if the server doesn't need to check forbidden characters
      */
      */
     public boolean isVersionWithForbiddenCharacters() {
     public boolean isVersionWithForbiddenCharacters() {
-        if (mFileActivity.getAccount() != null) {
-            return AccountUtils.getServerVersion(mFileActivity.getAccount()).isVersionWithForbiddenCharacters();
-        }
-        return false;
+        return mFileActivity.getAccount() != null &&
+                AccountUtils.getServerVersion(mFileActivity.getAccount()).isVersionWithForbiddenCharacters();
     }
     }
 
 
     /**
     /**