aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java69
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java62
-rw-r--r--app/src/main/res/layout/activity_customize_post_filter.xml64
-rw-r--r--app/src/main/res/values/arrays.xml1
-rw-r--r--app/src/main/res/values/strings.xml4
7 files changed, 191 insertions, 17 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
index 4eb10c4a..0f7cbe75 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
@@ -354,6 +354,9 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
database.execSQL("ALTER TABLE recent_search_queries ADD COLUMN time INTEGER DEFAULT 0 NOT NULL");
database.execSQL("ALTER TABLE custom_themes ADD COLUMN media_indicator_icon_color INTEGER DEFAULT " + Color.parseColor("#FFFFFF") + " NOT NULL");
database.execSQL("ALTER TABLE custom_themes ADD COLUMN media_indicator_background_color INTEGER DEFAULT " + Color.parseColor("#000000") + " NOT NULL");
+ database.execSQL("ALTER TABLE post_filter ADD COLUMN post_title_contains_strings TEXT");
+ database.execSQL("ALTER TABLE post_filter ADD COLUMN post_title_contains_regex TEXT");
+ database.execSQL("ALTER TABLE post_filter ADD COLUMN contain_domains TEXT");
}
};
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
index 862a5603..37194312 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
@@ -59,6 +59,7 @@ public class CustomizePostFilterActivity extends BaseActivity {
public static final String EXTRA_EXCLUDE_FLAIR = "EEF";
public static final String EXTRA_CONTAIN_FLAIR = "ECF";
public static final String EXTRA_EXCLUDE_DOMAIN = "EED";
+ public static final String EXTRA_CONTAIN_DOMAIN = "ECD";
public static final String RETURN_EXTRA_POST_FILTER = "REPF";
private static final String POST_FILTER_STATE = "PFS";
private static final String ORIGINAL_NAME_STATE = "ONS";
@@ -130,10 +131,18 @@ public class CustomizePostFilterActivity extends BaseActivity {
TextInputLayout titleExcludesStringsTextInputLayout;
@BindView(R.id.title_excludes_strings_text_input_edit_text_customize_post_filter_activity)
TextInputEditText titleExcludesStringsTextInputEditText;
+ @BindView(R.id.title_contains_strings_text_input_layout_customize_post_filter_activity)
+ TextInputLayout titleContainsStringsTextInputLayout;
+ @BindView(R.id.title_contains_strings_text_input_edit_text_customize_post_filter_activity)
+ TextInputEditText titleContainsStringsTextInputEditText;
@BindView(R.id.title_excludes_regex_text_input_layout_customize_post_filter_activity)
TextInputLayout titleExcludesRegexTextInputLayout;
@BindView(R.id.title_excludes_regex_text_input_edit_text_customize_post_filter_activity)
TextInputEditText titleExcludesRegexTextInputEditText;
+ @BindView(R.id.title_contains_regex_text_input_layout_customize_post_filter_activity)
+ TextInputLayout titleContainsRegexTextInputLayout;
+ @BindView(R.id.title_contains_regex_text_input_edit_text_customize_post_filter_activity)
+ TextInputEditText titleContainsRegexTextInputEditText;
@BindView(R.id.excludes_subreddits_text_input_layout_customize_post_filter_activity)
TextInputLayout excludesSubredditsTextInputLayout;
@BindView(R.id.excludes_subreddits_text_input_edit_text_customize_post_filter_activity)
@@ -154,10 +163,14 @@ public class CustomizePostFilterActivity extends BaseActivity {
TextInputLayout containsFlairsTextInputLayout;
@BindView(R.id.contains_flairs_text_input_edit_text_customize_post_filter_activity)
TextInputEditText containsFlairsTextInputEditText;
- @BindView(R.id.excludes_domains_text_input_layout_customize_post_filter_activity)
- TextInputLayout excludesDomainsTextInputLayout;
- @BindView(R.id.excludes_domains_text_input_edit_text_customize_post_filter_activity)
- TextInputEditText excludesDomainsTextInputEditText;
+ @BindView(R.id.exclude_domains_text_input_layout_customize_post_filter_activity)
+ TextInputLayout excludeDomainsTextInputLayout;
+ @BindView(R.id.exclude_domains_text_input_edit_text_customize_post_filter_activity)
+ TextInputEditText excludeDomainsTextInputEditText;
+ @BindView(R.id.contain_domains_text_input_layout_customize_post_filter_activity)
+ TextInputLayout containDomainsTextInputLayout;
+ @BindView(R.id.contain_domains_text_input_edit_text_customize_post_filter_activity)
+ TextInputEditText containDomainsTextInputEditText;
@BindView(R.id.min_vote_text_input_layout_customize_post_filter_activity)
TextInputLayout minVoteTextInputLayout;
@BindView(R.id.min_vote_text_input_edit_text_customize_post_filter_activity)
@@ -307,12 +320,15 @@ public class CustomizePostFilterActivity extends BaseActivity {
onlyNSFWSwitch.setChecked(postFilter.onlyNSFW);
onlySpoilerSwitch.setChecked(postFilter.onlySpoiler);
titleExcludesStringsTextInputEditText.setText(postFilter.postTitleExcludesStrings);
+ titleContainsStringsTextInputEditText.setText(postFilter.postTitleContainsStrings);
titleExcludesRegexTextInputEditText.setText(postFilter.postTitleExcludesRegex);
+ titleContainsRegexTextInputEditText.setText(postFilter.postTitleContainsRegex);
excludesSubredditsTextInputEditText.setText(postFilter.excludeSubreddits);
excludesUsersTextInputEditText.setText(postFilter.excludeUsers);
excludesFlairsTextInputEditText.setText(postFilter.excludeFlairs);
containsFlairsTextInputEditText.setText(postFilter.containFlairs);
- excludesDomainsTextInputEditText.setText(postFilter.excludeDomains);
+ excludeDomainsTextInputEditText.setText(postFilter.excludeDomains);
+ containDomainsTextInputEditText.setText(postFilter.containDomains);
minVoteTextInputEditText.setText(Integer.toString(postFilter.minVote));
maxVoteTextInputEditText.setText(Integer.toString(postFilter.maxVote));
minCommentsTextInputEditText.setText(Integer.toString(postFilter.minComments));
@@ -326,6 +342,7 @@ public class CustomizePostFilterActivity extends BaseActivity {
String excludeFlair = intent.getStringExtra(EXTRA_EXCLUDE_FLAIR);
String containFlair = intent.getStringExtra(EXTRA_CONTAIN_FLAIR);
String excludeDomain = intent.getStringExtra(EXTRA_EXCLUDE_DOMAIN);
+ String containDomain = intent.getStringExtra(EXTRA_CONTAIN_DOMAIN);
if (excludeSubreddit != null && !excludeSubreddit.equals("")) {
if (!excludesSubredditsTextInputEditText.getText().toString().equals("")) {
@@ -352,10 +369,16 @@ public class CustomizePostFilterActivity extends BaseActivity {
containsFlairsTextInputEditText.append(containFlair);
}
if (excludeDomain != null && !excludeDomain.equals("")) {
- if (!excludesDomainsTextInputEditText.getText().toString().equals("")) {
- excludesDomainsTextInputEditText.append(",");
+ if (!excludeDomainsTextInputEditText.getText().toString().equals("")) {
+ excludeDomainsTextInputEditText.append(",");
}
- excludesDomainsTextInputEditText.append(Uri.parse(excludeDomain).getHost());
+ excludeDomainsTextInputEditText.append(Uri.parse(excludeDomain).getHost());
+ }
+ if (containDomain != null && !containDomain.equals("")) {
+ if (!containDomainsTextInputEditText.getText().toString().equals("")) {
+ containDomainsTextInputEditText.append(",");
+ }
+ containDomainsTextInputEditText.append(Uri.parse(containDomain).getHost());
}
}
@@ -390,9 +413,15 @@ public class CustomizePostFilterActivity extends BaseActivity {
titleExcludesStringsTextInputLayout.setBoxStrokeColor(primaryTextColor);
titleExcludesStringsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
titleExcludesStringsTextInputEditText.setTextColor(primaryTextColor);
+ titleContainsStringsTextInputLayout.setBoxStrokeColor(primaryTextColor);
+ titleContainsStringsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
+ titleContainsStringsTextInputEditText.setTextColor(primaryTextColor);
titleExcludesRegexTextInputLayout.setBoxStrokeColor(primaryTextColor);
titleExcludesRegexTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
titleExcludesRegexTextInputEditText.setTextColor(primaryTextColor);
+ titleContainsRegexTextInputLayout.setBoxStrokeColor(primaryTextColor);
+ titleContainsRegexTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
+ titleContainsRegexTextInputEditText.setTextColor(primaryTextColor);
excludesSubredditsTextInputLayout.setBoxStrokeColor(primaryTextColor);
excludesSubredditsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
excludesSubredditsTextInputEditText.setTextColor(primaryTextColor);
@@ -407,9 +436,12 @@ public class CustomizePostFilterActivity extends BaseActivity {
containsFlairsTextInputLayout.setBoxStrokeColor(primaryTextColor);
containsFlairsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
containsFlairsTextInputEditText.setTextColor(primaryTextColor);
- excludesDomainsTextInputLayout.setBoxStrokeColor(primaryTextColor);
- excludesDomainsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
- excludesDomainsTextInputEditText.setTextColor(primaryTextColor);
+ excludeDomainsTextInputLayout.setBoxStrokeColor(primaryTextColor);
+ excludeDomainsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
+ excludeDomainsTextInputEditText.setTextColor(primaryTextColor);
+ containDomainsTextInputLayout.setBoxStrokeColor(primaryTextColor);
+ containDomainsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
+ containDomainsTextInputEditText.setTextColor(primaryTextColor);
minVoteTextInputLayout.setBoxStrokeColor(primaryTextColor);
minVoteTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
minVoteTextInputEditText.setTextColor(primaryTextColor);
@@ -432,12 +464,15 @@ public class CustomizePostFilterActivity extends BaseActivity {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
nameTextInputEditText.setTextCursorDrawable(cursorDrawable);
titleExcludesStringsTextInputEditText.setTextCursorDrawable(cursorDrawable);
+ titleContainsStringsTextInputEditText.setTextCursorDrawable(cursorDrawable);
titleExcludesRegexTextInputEditText.setTextCursorDrawable(cursorDrawable);
+ titleContainsRegexTextInputEditText.setTextCursorDrawable(cursorDrawable);
excludesSubredditsTextInputEditText.setTextCursorDrawable(cursorDrawable);
excludesUsersTextInputEditText.setTextCursorDrawable(cursorDrawable);
excludesFlairsTextInputEditText.setTextCursorDrawable(cursorDrawable);
containsFlairsTextInputEditText.setTextCursorDrawable(cursorDrawable);
- excludesDomainsTextInputEditText.setTextCursorDrawable(cursorDrawable);
+ excludeDomainsTextInputEditText.setTextCursorDrawable(cursorDrawable);
+ containDomainsTextInputEditText.setTextCursorDrawable(cursorDrawable);
minVoteTextInputEditText.setTextCursorDrawable(cursorDrawable);
maxVoteTextInputEditText.setTextCursorDrawable(cursorDrawable);
minCommentsTextInputEditText.setTextCursorDrawable(cursorDrawable);
@@ -447,12 +482,15 @@ public class CustomizePostFilterActivity extends BaseActivity {
} else {
setCursorDrawableColor(nameTextInputEditText, primaryTextColor);
setCursorDrawableColor(titleExcludesStringsTextInputEditText, primaryTextColor);
+ setCursorDrawableColor(titleContainsStringsTextInputEditText, primaryTextColor);
setCursorDrawableColor(titleExcludesRegexTextInputEditText, primaryTextColor);
+ setCursorDrawableColor(titleContainsRegexTextInputEditText, primaryTextColor);
setCursorDrawableColor(excludesSubredditsTextInputEditText, primaryTextColor);
setCursorDrawableColor(excludesUsersTextInputEditText, primaryTextColor);
setCursorDrawableColor(excludesFlairsTextInputEditText, primaryTextColor);
setCursorDrawableColor(containsFlairsTextInputEditText, primaryTextColor);
- setCursorDrawableColor(excludesDomainsTextInputEditText, primaryTextColor);
+ setCursorDrawableColor(excludeDomainsTextInputEditText, primaryTextColor);
+ setCursorDrawableColor(containDomainsTextInputEditText, primaryTextColor);
setCursorDrawableColor(minVoteTextInputEditText, primaryTextColor);
setCursorDrawableColor(maxVoteTextInputEditText, primaryTextColor);
setCursorDrawableColor(minCommentsTextInputEditText, primaryTextColor);
@@ -594,12 +632,15 @@ public class CustomizePostFilterActivity extends BaseActivity {
postFilter.maxAwards = maxAwardsTextInputEditText.getText() == null || maxAwardsTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(maxAwardsTextInputEditText.getText().toString());
postFilter.minAwards = minAwardsTextInputEditText.getText() == null || minAwardsTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(minAwardsTextInputEditText.getText().toString());
postFilter.postTitleExcludesRegex = titleExcludesRegexTextInputEditText.getText().toString();
+ postFilter.postTitleContainsRegex = titleContainsRegexTextInputEditText.getText().toString();
postFilter.postTitleExcludesStrings = titleExcludesStringsTextInputEditText.getText().toString();
+ postFilter.postTitleContainsStrings = titleContainsStringsTextInputEditText.getText().toString();
postFilter.excludeSubreddits = excludesSubredditsTextInputEditText.getText().toString();
postFilter.excludeUsers = excludesUsersTextInputEditText.getText().toString();
postFilter.excludeFlairs = excludesFlairsTextInputEditText.getText().toString();
postFilter.containFlairs = containsFlairsTextInputEditText.getText().toString();
- postFilter.excludeDomains = excludesDomainsTextInputEditText.getText().toString();
+ postFilter.excludeDomains = excludeDomainsTextInputEditText.getText().toString();
+ postFilter.containDomains = containDomainsTextInputEditText.getText().toString();
postFilter.containTextType = postTypeTextCheckBox.isChecked();
postFilter.containLinkType = postTypeLinkCheckBox.isChecked();
postFilter.containImageType = postTypeImageCheckBox.isChecked();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
index 4ed7534d..d8c89639 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
@@ -121,7 +121,7 @@ public class PostFilterPreferenceActivity extends BaseActivity {
public void showPostFilterOptions(Post post, PostFilter postFilter) {
String[] options = getResources().getStringArray(R.array.add_to_post_filter_options);
- boolean[] selectedOptions = new boolean[]{false, false, false, false, false};
+ boolean[] selectedOptions = new boolean[]{false, false, false, false, false, false};
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.select)
.setMultiChoiceItems(options, selectedOptions, (dialogInterface, i, b) -> selectedOptions[i] = b)
@@ -149,6 +149,9 @@ public class PostFilterPreferenceActivity extends BaseActivity {
case 4:
intent.putExtra(CustomizePostFilterActivity.EXTRA_EXCLUDE_DOMAIN, post.getUrl());
break;
+ case 5:
+ intent.putExtra(CustomizePostFilterActivity.EXTRA_CONTAIN_DOMAIN, post.getUrl());
+ break;
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java
index 9cc0987f..833cd5a8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java
@@ -41,8 +41,12 @@ public class PostFilter implements Parcelable {
public boolean onlySpoiler;
@ColumnInfo(name = "post_title_excludes_regex")
public String postTitleExcludesRegex;
+ @ColumnInfo(name = "post_title_contains_regex")
+ public String postTitleContainsRegex;
@ColumnInfo(name = "post_title_excludes_strings")
public String postTitleExcludesStrings;
+ @ColumnInfo(name = "post_title_contains_strings")
+ public String postTitleContainsStrings;
@ColumnInfo(name = "exclude_subreddits")
public String excludeSubreddits;
@ColumnInfo(name = "exclude_users")
@@ -53,6 +57,8 @@ public class PostFilter implements Parcelable {
public String excludeFlairs;
@ColumnInfo(name = "exclude_domains")
public String excludeDomains;
+ @ColumnInfo(name = "contain_domains")
+ public String containDomains;
@ColumnInfo(name = "contain_text_type")
public boolean containTextType = true;
@ColumnInfo(name = "contain_link_type")
@@ -82,12 +88,15 @@ public class PostFilter implements Parcelable {
onlyNSFW = in.readByte() != 0;
onlySpoiler = in.readByte() != 0;
postTitleExcludesRegex = in.readString();
+ postTitleContainsRegex = in.readString();
postTitleExcludesStrings = in.readString();
+ postTitleContainsStrings = in.readString();
excludeSubreddits = in.readString();
excludeUsers = in.readString();
containFlairs = in.readString();
excludeFlairs = in.readString();
excludeDomains = in.readString();
+ containDomains = in.readString();
containTextType = in.readByte() != 0;
containLinkType = in.readByte() != 0;
containImageType = in.readByte() != 0;
@@ -170,6 +179,13 @@ public class PostFilter implements Parcelable {
return false;
}
}
+ if (postFilter.postTitleContainsRegex != null && !postFilter.postTitleContainsRegex.equals("")) {
+ Pattern pattern = Pattern.compile(postFilter.postTitleContainsRegex);
+ Matcher matcher = pattern.matcher(post.getTitle());
+ if (!matcher.find()) {
+ return false;
+ }
+ }
if (postFilter.postTitleExcludesStrings != null && !postFilter.postTitleExcludesStrings.equals("")) {
String[] titles = postFilter.postTitleExcludesStrings.split(",", 0);
for (String t : titles) {
@@ -178,6 +194,19 @@ public class PostFilter implements Parcelable {
}
}
}
+ if (postFilter.postTitleContainsStrings != null && !postFilter.postTitleContainsStrings.equals("")) {
+ String[] titles = postFilter.postTitleContainsStrings.split(",", 0);
+ boolean hasRequiredString = false;
+ for (String t : titles) {
+ if (post.getTitle().toLowerCase().contains(t.toLowerCase().trim())) {
+ hasRequiredString = true;
+ break;
+ }
+ }
+ if (!hasRequiredString) {
+ return false;
+ }
+ }
if (postFilter.excludeSubreddits != null && !postFilter.excludeSubreddits.equals("")) {
String[] subreddits = postFilter.excludeSubreddits.split(",", 0);
for (String s : subreddits) {
@@ -211,6 +240,20 @@ public class PostFilter implements Parcelable {
}
}
}
+ if (post.getUrl() != null && postFilter.containDomains != null && !postFilter.containDomains.equals("")) {
+ String[] domains = postFilter.containDomains.split(",", 0);
+ String url = post.getUrl().toLowerCase();
+ boolean hasRequiredDomain = false;
+ for (String f : domains) {
+ if (url.contains(f.trim().toLowerCase())) {
+ hasRequiredDomain = true;
+ break;
+ }
+ }
+ if (!hasRequiredDomain) {
+ return false;
+ }
+ }
if (postFilter.containFlairs != null && !postFilter.containFlairs.equals("")) {
String[] flairs = postFilter.containFlairs.split(",", 0);
if (flairs.length > 0) {
@@ -255,12 +298,22 @@ public class PostFilter implements Parcelable {
postFilter.postTitleExcludesRegex = p.postTitleExcludesRegex;
}
+ if (p.postTitleContainsRegex != null && !p.postTitleContainsRegex.equals("")) {
+ postFilter.postTitleContainsRegex = p.postTitleContainsRegex;
+ }
+
if (p.postTitleExcludesStrings != null && !p.postTitleExcludesStrings.equals("")) {
stringBuilder = new StringBuilder(postFilter.postTitleExcludesStrings == null ? "" : postFilter.postTitleExcludesStrings);
stringBuilder.append(",").append(p.postTitleExcludesStrings);
postFilter.postTitleExcludesStrings = stringBuilder.toString();
}
+ if (p.postTitleContainsStrings != null && !p.postTitleContainsStrings.equals("")) {
+ stringBuilder = new StringBuilder(postFilter.postTitleContainsStrings == null ? "" : postFilter.postTitleContainsStrings);
+ stringBuilder.append(",").append(p.postTitleContainsStrings);
+ postFilter.postTitleContainsStrings = stringBuilder.toString();
+ }
+
if (p.excludeSubreddits != null && !p.excludeSubreddits.equals("")) {
stringBuilder = new StringBuilder(postFilter.excludeSubreddits == null ? "" : postFilter.excludeSubreddits);
stringBuilder.append(",").append(p.excludeSubreddits);
@@ -291,6 +344,12 @@ public class PostFilter implements Parcelable {
postFilter.excludeDomains = stringBuilder.toString();
}
+ if (p.containDomains != null && !p.containDomains.equals("")) {
+ stringBuilder = new StringBuilder(postFilter.containDomains == null ? "" : postFilter.containDomains);
+ stringBuilder.append(",").append(p.containDomains);
+ postFilter.containDomains = stringBuilder.toString();
+ }
+
postFilter.containTextType = p.containTextType || postFilter.containTextType;
postFilter.containLinkType = p.containLinkType || postFilter.containLinkType;
postFilter.containImageType = p.containImageType || postFilter.containImageType;
@@ -320,12 +379,15 @@ public class PostFilter implements Parcelable {
parcel.writeByte((byte) (onlyNSFW ? 1 : 0));
parcel.writeByte((byte) (onlySpoiler ? 1 : 0));
parcel.writeString(postTitleExcludesRegex);
+ parcel.writeString(postTitleContainsRegex);
parcel.writeString(postTitleExcludesStrings);
+ parcel.writeString(postTitleContainsStrings);
parcel.writeString(excludeSubreddits);
parcel.writeString(excludeUsers);
parcel.writeString(containFlairs);
parcel.writeString(excludeFlairs);
parcel.writeString(excludeDomains);
+ parcel.writeString(containDomains);
parcel.writeByte((byte) (containTextType ? 1 : 0));
parcel.writeByte((byte) (containLinkType ? 1 : 0));
parcel.writeByte((byte) (containImageType ? 1 : 0));
diff --git a/app/src/main/res/layout/activity_customize_post_filter.xml b/app/src/main/res/layout/activity_customize_post_filter.xml
index 572d6f94..0d2dfd49 100644
--- a/app/src/main/res/layout/activity_customize_post_filter.xml
+++ b/app/src/main/res/layout/activity_customize_post_filter.xml
@@ -324,6 +324,26 @@
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/title_contains_strings_text_input_layout_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/title_contains_strings_text_input_edit_text_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default"
+ android:hint="@string/title_contains_strings_hint" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <com.google.android.material.textfield.TextInputLayout
android:id="@+id/title_excludes_regex_text_input_layout_customize_post_filter_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -343,6 +363,26 @@
</com.google.android.material.textfield.TextInputLayout>
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/title_contains_regex_text_input_layout_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/title_contains_regex_text_input_edit_text_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default"
+ android:hint="@string/title_contains_regex_hint" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -457,7 +497,7 @@
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
- android:id="@+id/excludes_domains_text_input_layout_customize_post_filter_activity"
+ android:id="@+id/exclude_domains_text_input_layout_customize_post_filter_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
@@ -467,7 +507,7 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
- android:id="@+id/excludes_domains_text_input_edit_text_customize_post_filter_activity"
+ android:id="@+id/exclude_domains_text_input_edit_text_customize_post_filter_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
@@ -477,6 +517,26 @@
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/contain_domains_text_input_layout_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/contain_domains_text_input_edit_text_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default"
+ android:hint="@string/contain_domains_hint" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <com.google.android.material.textfield.TextInputLayout
android:id="@+id/min_vote_text_input_layout_customize_post_filter_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 1573c6da..fdf0911e 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -546,6 +546,7 @@
<item>@string/exclude_flair</item>
<item>@string/contain_flair</item>
<item>@string/exclude_domain</item>
+ <item>@string/contain_domain</item>
</string-array>
<string-array name="settings_app_lock_timeout">
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f5654e8e..18f024c0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1077,12 +1077,15 @@
<string name="only_nsfw">Only NSFW</string>
<string name="only_spoiler">Only Spoiler</string>
<string name="title_excludes_strings_hint">Title: excludes keywords (key1,key2)</string>
+ <string name="title_contains_strings_hint">Title: contains keywords (key1,key2)</string>
<string name="title_excludes_regex_hint">Title: excludes regex</string>
+ <string name="title_contains_regex_hint">Title: contains regex</string>
<string name="exclude_subreddits_hint">Exclude subreddits (e.g. funny,AskReddit)</string>
<string name="exclude_users_hint">Exclude users (e.g. Hostilenemy,random)</string>
<string name="exclude_flairs_hint">Exclude flairs (e.g. flair1,flair2)</string>
<string name="contain_flairs_hint">Contain flairs (e.g. flair1,flair2)</string>
<string name="exclude_domains_hint">Exclude domains</string>
+ <string name="contain_domains_hint">Contain domains</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="min_comments_hint">Min comments (-1: no restriction)</string>
@@ -1158,6 +1161,7 @@
<string name="exclude_flair">Exclude this flair</string>
<string name="contain_flair">Contain this flair</string>
<string name="exclude_domain">Exclude this domain</string>
+ <string name="contain_domain">Contain this domain</string>
<string name="suggest_title">Suggest Title</string>
<string name="suggest_title_failed">Failed to suggest a title</string>