FileMenuFilter: reorder conditionals for performance (Spotbugs)

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-08-05 12:57:06 +02:00
parent 7c9941ac0c
commit 8c62cb1c0c

View file

@ -235,7 +235,7 @@ public class FileMenuFilter {
private void filterSendFiles(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment) { private void filterSendFiles(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment) {
boolean show = true; boolean show = true;
if (containsEncryptedFile() || overflowMenu || SEND_OFF.equalsIgnoreCase(context.getString(R.string.send_files_to_other_apps))) { if (overflowMenu || SEND_OFF.equalsIgnoreCase(context.getString(R.string.send_files_to_other_apps)) || containsEncryptedFile()) {
show = false; show = false;
} }
if (!inSingleFileFragment && (isSingleSelection() || !anyFileDown())) { if (!inSingleFileFragment && (isSingleSelection() || !anyFileDown())) {
@ -321,8 +321,8 @@ public class FileMenuFilter {
} }
private void filterUnsetEncrypted(List<Integer> toShow, List<Integer> toHide, boolean endToEndEncryptionEnabled) { private void filterUnsetEncrypted(List<Integer> toShow, List<Integer> toHide, boolean endToEndEncryptionEnabled) {
if (files.isEmpty() || !isSingleSelection() || isSingleFile() || !isEncryptedFolder() || hasEncryptedParent() if (!endToEndEncryptionEnabled || files.isEmpty() || !isSingleSelection() || isSingleFile() || !isEncryptedFolder() || hasEncryptedParent()
|| !endToEndEncryptionEnabled || !isEmptyFolder()) { || !isEmptyFolder()) {
toHide.add(R.id.action_unset_encrypted); toHide.add(R.id.action_unset_encrypted);
} else { } else {
toShow.add(R.id.action_unset_encrypted); toShow.add(R.id.action_unset_encrypted);