forked from sk22/megalodon
-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from FineFindus/fix/apply-filter-highlight
fix: apply filter highlight
- Loading branch information
Showing
7 changed files
with
38 additions
and
251 deletions.
There are no files selected for viewing
104 changes: 0 additions & 104 deletions
104
mastodon/src/androidTest/java/org/joinmastodon/android/utils/StatusFilterPredicateTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
mastodon/src/main/java/org/joinmastodon/android/model/AltTextFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
package org.joinmastodon.android.model; | ||
|
||
import org.joinmastodon.android.GlobalUserPreferences; | ||
import org.jsoup.internal.StringUtil; | ||
|
||
import java.util.EnumSet; | ||
|
||
public class AltTextFilter extends LegacyFilter { | ||
|
||
public AltTextFilter(FilterAction filterAction, FilterContext firstContext, FilterContext... restContexts) { | ||
public AltTextFilter(FilterAction filterAction, EnumSet<FilterContext> filterContexts) { | ||
this.filterAction = filterAction; | ||
isRemote = false; | ||
context = EnumSet.of(firstContext, restContexts); | ||
context = filterContexts; | ||
} | ||
|
||
@Override | ||
public boolean matches(Status status) { | ||
return status.getContentStatus().mediaAttachments.stream().map(attachment -> attachment.description).anyMatch(StringUtil::isBlank); | ||
} | ||
|
||
@Override | ||
public boolean isActive(){ | ||
return !GlobalUserPreferences.showPostsWithoutAlt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.