Version 4.2.0-beta1. Fix regex in post filter. Fix UI issues.

This commit is contained in:
Alex Ning 2020-12-26 23:40:26 +08:00
parent bb3f76c965
commit 7b154f4d31
6 changed files with 19 additions and 15 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit" applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 52 versionCode 53
versionName "4.1.1" versionName "4.2.0-beta1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {

View File

@ -59,6 +59,8 @@ public class PostFilterPreferenceActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this); ((Infinity) getApplication()).getAppComponent().inject(this);
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_filter_preference); setContentView(R.layout.activity_post_filter_preference);

View File

@ -70,6 +70,8 @@ public class PostFilterUsageListingActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this); ((Infinity) getApplication()).getAppComponent().inject(this);
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_filter_application); setContentView(R.layout.activity_post_filter_application);

View File

@ -118,8 +118,8 @@ public class PostFilter implements Parcelable {
return false; return false;
} }
if (postFilter.postTitleExcludesRegex != null && !postFilter.postTitleExcludesRegex.equals("")) { if (postFilter.postTitleExcludesRegex != null && !postFilter.postTitleExcludesRegex.equals("")) {
Pattern spoilerPattern = Pattern.compile(postFilter.postTitleExcludesRegex); Pattern pattern = Pattern.compile(postFilter.postTitleExcludesRegex);
Matcher matcher = spoilerPattern.matcher(postFilter.postTitleExcludesRegex); Matcher matcher = pattern.matcher(post.getTitle());
if (matcher.find()) { if (matcher.find()) {
return false; return false;
} }
@ -127,7 +127,7 @@ public class PostFilter implements Parcelable {
if (postFilter.postTitleExcludesStrings != null && !postFilter.postTitleExcludesStrings.equals("")) { if (postFilter.postTitleExcludesStrings != null && !postFilter.postTitleExcludesStrings.equals("")) {
String[] titles = postFilter.postTitleExcludesStrings.split(",", 0); String[] titles = postFilter.postTitleExcludesStrings.split(",", 0);
for (String t : titles) { for (String t : titles) {
if (post.getTitle().contains(t)) { if (!t.equals("") && post.getTitle().contains(t)) {
return false; return false;
} }
} }
@ -135,7 +135,7 @@ public class PostFilter implements Parcelable {
if (postFilter.excludeSubreddits != null && !postFilter.excludeSubreddits.equals("")) { if (postFilter.excludeSubreddits != null && !postFilter.excludeSubreddits.equals("")) {
String[] subreddits = postFilter.excludeSubreddits.split(",", 0); String[] subreddits = postFilter.excludeSubreddits.split(",", 0);
for (String s : subreddits) { for (String s : subreddits) {
if (post.getSubredditName().equalsIgnoreCase(s)) { if (!s.equals("") && post.getSubredditName().equalsIgnoreCase(s)) {
return false; return false;
} }
} }
@ -143,7 +143,7 @@ public class PostFilter implements Parcelable {
if (postFilter.excludeUsers != null && !postFilter.excludeUsers.equals("")) { if (postFilter.excludeUsers != null && !postFilter.excludeUsers.equals("")) {
String[] users = postFilter.excludeUsers.split(",", 0); String[] users = postFilter.excludeUsers.split(",", 0);
for (String u : users) { for (String u : users) {
if (post.getAuthor().equalsIgnoreCase(u)) { if (!u.equals("") && post.getAuthor().equalsIgnoreCase(u)) {
return false; return false;
} }
} }
@ -151,7 +151,7 @@ public class PostFilter implements Parcelable {
if (postFilter.excludeFlairs != null && !postFilter.excludeFlairs.equals("")) { if (postFilter.excludeFlairs != null && !postFilter.excludeFlairs.equals("")) {
String[] flairs = postFilter.excludeFlairs.split(",", 0); String[] flairs = postFilter.excludeFlairs.split(",", 0);
for (String f : flairs) { for (String f : flairs) {
if (post.getFlair().equalsIgnoreCase(f)) { if (!f.equals("") && post.getFlair().equalsIgnoreCase(f)) {
return false; return false;
} }
} }
@ -159,7 +159,7 @@ public class PostFilter implements Parcelable {
if (postFilter.containFlairs != null && !postFilter.containFlairs.equals("")) { if (postFilter.containFlairs != null && !postFilter.containFlairs.equals("")) {
String[] flairs = postFilter.containFlairs.split(",", 0); String[] flairs = postFilter.containFlairs.split(",", 0);
for (String f : flairs) { for (String f : flairs) {
if (post.getFlair().equalsIgnoreCase(f)) { if (!f.equals("") && post.getFlair().equalsIgnoreCase(f)) {
return false; return false;
} }
} }

View File

@ -929,5 +929,5 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd
<string name="theme_item_no_preview_post_type_background_color">"无预览文章类型背景颜色"</string> <string name="theme_item_no_preview_post_type_background_color">"无预览文章类型背景颜色"</string>
<string name="theme_item_no_preview_post_type_background_color_detail">"应用于:占位符,指示没有预览可用时的帖子类型"</string> <string name="theme_item_no_preview_post_type_background_color_detail">"应用于:占位符,指示没有预览可用时的帖子类型"</string>
<string name="settings_language_title">"语言"</string> <string name="settings_language_title">"语言"</string>
<string name="settings_enable_search_history">"启用搜索记录"</string> <string name="settings_enable_search_history_title">"启用搜索记录"</string>
</resources> </resources>

View File

@ -964,12 +964,12 @@
<string name="only_nsfw">Only NSFW</string> <string name="only_nsfw">Only NSFW</string>
<string name="only_spoiler">Only Spoiler</string> <string name="only_spoiler">Only Spoiler</string>
<string name="title_excludes_strings_hint">Title: excludes keywords</string> <string name="title_excludes_strings_hint">Title: excludes keywords (key1,key2)</string>
<string name="title_excludes_regex_hint">Title: excludes regex</string> <string name="title_excludes_regex_hint">Title: excludes regex</string>
<string name="exclude_subreddits_hint">Exclude subreddits</string> <string name="exclude_subreddits_hint">Exclude subreddits (e.g. funny,AskReddit)</string>
<string name="exclude_users_hint">Exclude users</string> <string name="exclude_users_hint">Exclude users (e.g. Hostilenemy,random)</string>
<string name="exclude_flairs_hint">Exclude flairs</string> <string name="exclude_flairs_hint">Exclude flairs (e.g. flair1,flair2)</string>
<string name="contain_flairs_hint">Contain flairs</string> <string name="contain_flairs_hint">Contain flairs (e.g. flair1,flair2)</string>
<string name="min_vote_hint">Min vote (-1: no restriction)</string> <string name="min_vote_hint">Min vote (-1: no restriction)</string>
<string name="max_vote_hint">Max vote (-1: no restriction)</string> <string name="max_vote_hint">Max vote (-1: no restriction)</string>
<string name="min_comments_hint">Min comments (-1: no restriction)</string> <string name="min_comments_hint">Min comments (-1: no restriction)</string>