Add negation (!) to filter bar

Filter terms can now be negated with !
This commit is contained in:
0xboobface 2020-03-16 13:39:39 +01:00
parent e333722522
commit 76794e588e
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,7 @@
3.4.1
========================
* Filter terms can now be negated by prepending them with a "!"
3.4.0 3.4.0
======================== ========================
* Added support for Stripchat * Added support for Stripchat

View File

@ -814,8 +814,14 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
if (m.getOnlineState(true) != ctbrec.Model.State.ONLINE) { if (m.getOnlineState(true) != ctbrec.Model.State.ONLINE) {
tokensMissing = true; tokensMissing = true;
} }
} else if (!searchText.toLowerCase().contains(token.toLowerCase())) { } else {
tokensMissing = true; boolean negated = false;
if(token.startsWith("!")) {
negated = true;
token = token.substring(1);
}
boolean tokenFound = searchText.toLowerCase().contains(token.toLowerCase());
tokensMissing = !tokenFound && !negated || tokenFound && negated;
} }
return !tokensMissing; return !tokensMissing;
} }