Skip to content

Commit ed9f1c7

Browse files
committed
[Finder] Add eq_any and eq_none keys for installer filter
`eq_any` filters the apps installed with any of the given installer packages while `eq_none` filters them out. Signed-off-by: Muntashir Al-Islam <muntashirakon@riseup.net>
1 parent 8746293 commit ed9f1c7

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

app/src/main/java/io/github/muntashirakon/AppManager/filters/options/InstallerOption.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public class InstallerOption extends FilterOption {
2020
private final Map<String, Integer> mKeysWithType = new LinkedHashMap<String, Integer>() {{
2121
put(KEY_ALL, TYPE_NONE);
2222
put("installer", TYPE_STR_SINGLE);
23-
put("installers", TYPE_STR_MULTIPLE);
23+
put("installer_any", TYPE_STR_MULTIPLE);
24+
put("installer_none", TYPE_STR_MULTIPLE);
2425
put("regex", TYPE_REGEX);
2526
}};
2627

@@ -48,13 +49,20 @@ public TestResult test(@NonNull IFilterableAppInfo info, @NonNull TestResult res
4849
return result.setMatched(false);
4950
case "installer":
5051
return result.setMatched(installers.contains(value));
51-
case "installers":
52+
case "installer_any":
5253
for (String installer: stringValues) {
5354
if (installers.contains(installer)) {
5455
return result.setMatched(true);
5556
}
5657
}
5758
return result.setMatched(false);
59+
case "installer_none":
60+
for (String installer: stringValues) {
61+
if (installers.contains(installer)) {
62+
return result.setMatched(false);
63+
}
64+
}
65+
return result.setMatched(true);
5866
case "regex":
5967
for (String installer : installers) {
6068
if (regexValue.matcher(installer).matches()) {
@@ -91,8 +99,10 @@ public CharSequence toLocalizedString(@NonNull Context context) {
9199
return sb.append(LangUtils.getSeparatorString()).append("any");
92100
case "installer":
93101
return sb.append(" ").append(value);
94-
case "installers":
95-
return sb.append(" (exclusive) ").append(String.join(", ", stringValues));
102+
case "installer_any":
103+
return sb.append(" matching any of ").append(String.join(", ", stringValues));
104+
case "installer_none":
105+
return sb.append(" matching none of ").append(String.join(", ", stringValues));
96106
case "regex":
97107
return sb.append(" that matches '").append(value).append("'");
98108
default:

0 commit comments

Comments
 (0)