ソースを参照

fix spotbugs

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 7 ヶ月 前
コミット
7abddb240d

+ 1 - 1
app/src/main/java/com/owncloud/android/authentication/AccountAuthenticator.java

@@ -71,7 +71,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
 
         final Bundle bundle = new Bundle();
 
-        if (MDMConfig.INSTANCE.multiAccountSupport(mContext) && accounts.length > 1) {
+        if (accounts.length > 1 && MDMConfig.INSTANCE.multiAccountSupport(mContext)) {
             try {
                 validateAccountType(accountType);
             } catch (AuthenticatorException e) {

+ 18 - 4
app/src/main/java/com/owncloud/android/files/FileMenuFilter.java

@@ -185,10 +185,24 @@ public class FileMenuFilter {
     }
 
     private void filterSendFiles(List<Integer> toHide, boolean inSingleFileFragment) {
-        if ((context != null && !MDMConfig.INSTANCE.sendFilesSupport(context)) ||
-            (overflowMenu || containsEncryptedFile()) ||
-            (!inSingleFileFragment && (isSingleSelection() || !allFileDown())) ||
-            !toHide.contains(R.id.action_send_share_file)) {
+        boolean sendFilesNotSupported = context != null && !MDMConfig.INSTANCE.sendFilesSupport(context);
+        boolean hasEncryptedFile = containsEncryptedFile();
+        boolean isSingleSelection = isSingleSelection();
+        boolean allFilesNotDown = !allFileDown();
+
+        if (sendFilesNotSupported) {
+            toHide.add(R.id.action_send_file);
+            return;
+        }
+
+        if (overflowMenu || hasEncryptedFile) {
+            toHide.add(R.id.action_send_file);
+            return;
+        }
+
+        if (!inSingleFileFragment && (isSingleSelection || allFilesNotDown)) {
+            toHide.add(R.id.action_send_file);
+        } else if (!toHide.contains(R.id.action_send_share_file)) {
             toHide.add(R.id.action_send_file);
         }
     }