Add regular expression feed filtering (#557)

* Initial implementation of regex feed filtering

Mimics Mastodon web's functionality, but in a simpler form; a single
regular expression is shared across the home, local and federated feeds.

Strings are currently only provided in English and will need to be
translated.

* Fix buggy behaviour on filter regex update

* Validate regex filter input

Fixes buggy behaviour on inputting a regular expression feed filter by
testing the expression continuously as the user types, displaying an
error and disabling the 'OK' button of the dialog at any time it's not a
valid regular expression. Disables spelling suggestions in the input to
make the experience less frustrating and error prone.

Also fixes some generally buggy behaviour upon preference change,
specifically in cases where no Matcher was set prior to a new pattern
being set, which would cause the app to crash.

* Apply regex filter to spoiler text

* Get rid of empty catch block in regex filter code

* Make regex filter error string translatable
This commit is contained in:
Gareth Murphy 2018-04-05 21:58:44 +01:00 committed by Konrad Pozniak
commit 6d6c9575c4
4 changed files with 68 additions and 1 deletions

View file

@ -13,4 +13,11 @@
android:title="@string/pref_title_show_replies" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/title_advanced">
<EditTextPreference
android:key="tabFilterRegex"
android:inputType="textNoSuggestions"
android:title="@string/pref_title_filter_regex" />
</PreferenceCategory>
</PreferenceScreen>