aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewCommentFilterUsageBottomSheetFragment.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsage.java1
-rw-r--r--app/src/main/res/layout/fragment_new_comment_filter_usage_bottom_sheet.xml18
8 files changed, 19 insertions, 36 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
index e89a47dd..ffbbb703 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
@@ -405,7 +405,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("CREATE TABLE comment_filter " +
- "(name TEXT NOT NULL PRIMARY KEY, max_vote INTEGER NOT NULL, min_vote INTEGER NOT NULL, exclude_strings TEXT)");
+ "(name TEXT NOT NULL PRIMARY KEY, max_vote INTEGER NOT NULL, min_vote INTEGER NOT NULL, exclude_strings TEXT, exclude_users TEXT)");
database.execSQL("CREATE TABLE comment_filter_usage (name TEXT NOT NULL, usage INTEGER NOT NULL, " +
"name_of_usage TEXT NOT NULL, PRIMARY KEY(name, usage, name_of_usage), FOREIGN KEY(name) REFERENCES comment_filter(name) ON DELETE CASCADE)");
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java
index b174e9e8..7a1d6662 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java
@@ -94,7 +94,6 @@ public class CommentFilterUsageListingActivity extends BaseActivity {
public void newCommentFilterUsage(int type) {
switch (type) {
case CommentFilterUsage.SUBREDDIT_TYPE:
- case CommentFilterUsage.USER_TYPE:
editAndCommentFilterUsageNameOfUsage(type, null);
break;
}
@@ -119,10 +118,6 @@ public class CommentFilterUsageListingActivity extends BaseActivity {
case CommentFilterUsage.SUBREDDIT_TYPE:
textInputEditText.setHint(R.string.settings_tab_subreddit_name);
break;
- case CommentFilterUsage.USER_TYPE:
- textInputEditText.setHint(R.string.settings_tab_username);
- titleStringId = R.string.user;
- break;
}
Utils.showKeyboard(this, new Handler(), textInputEditText);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java
index 090cd27c..0f958e3e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java
@@ -41,9 +41,6 @@ public class CommentFilterUsageEmbeddedRecyclerViewAdapter extends RecyclerView.
case CommentFilterUsage.SUBREDDIT_TYPE:
holder.textView.setText("r/" + commentFilterUsage.nameOfUsage);
break;
- case CommentFilterUsage.USER_TYPE:
- holder.textView.setText("u/" + commentFilterUsage.nameOfUsage);
- break;
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java
index a6f510fd..134e9c18 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java
@@ -45,9 +45,6 @@ public class CommentFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<
case CommentFilterUsage.SUBREDDIT_TYPE:
((CommentFilterUsageRecyclerViewAdapter.CommentFilterUsageViewHolder) holder).usageTextView.setText(activity.getString(R.string.post_filter_usage_subreddit, commentFilterUsage.nameOfUsage));
break;
- case CommentFilterUsage.USER_TYPE:
- ((CommentFilterUsageRecyclerViewAdapter.CommentFilterUsageViewHolder) holder).usageTextView.setText(activity.getString(R.string.post_filter_usage_user, commentFilterUsage.nameOfUsage));
- break;
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewCommentFilterUsageBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewCommentFilterUsageBottomSheetFragment.java
index 2ff59d2b..b74fc39a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewCommentFilterUsageBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewCommentFilterUsageBottomSheetFragment.java
@@ -32,11 +32,6 @@ public class NewCommentFilterUsageBottomSheetFragment extends LandscapeExpandedR
dismiss();
});
- binding.userTextViewNewCommentFilterUsageBottomSheetFragment.setOnClickListener(view -> {
- activity.newCommentFilterUsage(CommentFilterUsage.USER_TYPE);
- dismiss();
- });
-
if (activity.typeface != null) {
Utils.setFontToAllTextViews(binding.getRoot(), activity.typeface);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java
index 49c60d23..93b65365 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java
@@ -23,6 +23,8 @@ public class CommentFilter implements Parcelable {
public int minVote = -1;
@ColumnInfo(name = "exclude_strings")
public String excludeStrings;
+ @ColumnInfo(name = "exclude_users")
+ public String excludeUsers;
public CommentFilter() {
@@ -33,6 +35,7 @@ public class CommentFilter implements Parcelable {
maxVote = in.readInt();
minVote = in.readInt();
excludeStrings = in.readString();
+ excludeUsers = in.readString();
}
public static final Creator<CommentFilter> CREATOR = new Creator<CommentFilter>() {
@@ -62,6 +65,14 @@ public class CommentFilter implements Parcelable {
}
}
}
+ if (commentFilter.excludeUsers != null && !commentFilter.excludeUsers.equals("")) {
+ String[] users = commentFilter.excludeUsers.split(",", 0);
+ for (String u : users) {
+ if (!u.trim().equals("") && comment.getAuthor().equalsIgnoreCase(u.trim())) {
+ return false;
+ }
+ }
+ }
return true;
}
@@ -83,6 +94,12 @@ public class CommentFilter implements Parcelable {
stringBuilder.append(",").append(c.excludeStrings);
commentFilter.excludeStrings = stringBuilder.toString();
}
+
+ if (c.excludeUsers != null && !c.excludeUsers.equals("")) {
+ stringBuilder = new StringBuilder(commentFilter.excludeUsers == null ? "" : commentFilter.excludeUsers);
+ stringBuilder.append(",").append(c.excludeUsers);
+ commentFilter.excludeUsers = stringBuilder.toString();
+ }
}
return commentFilter;
@@ -99,5 +116,6 @@ public class CommentFilter implements Parcelable {
dest.writeInt(maxVote);
dest.writeInt(minVote);
dest.writeString(excludeStrings);
+ dest.writeString(excludeUsers);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsage.java
index 368452ce..87d5ef17 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsage.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsage.java
@@ -13,7 +13,6 @@ import androidx.room.ForeignKey;
childColumns = "name", onDelete = ForeignKey.CASCADE))
public class CommentFilterUsage implements Parcelable {
public static final int SUBREDDIT_TYPE = 1;
- public static final int USER_TYPE = 2;
@NonNull
@ColumnInfo(name = "name")
diff --git a/app/src/main/res/layout/fragment_new_comment_filter_usage_bottom_sheet.xml b/app/src/main/res/layout/fragment_new_comment_filter_usage_bottom_sheet.xml
index 2cd5e545..546a87de 100644
--- a/app/src/main/res/layout/fragment_new_comment_filter_usage_bottom_sheet.xml
+++ b/app/src/main/res/layout/fragment_new_comment_filter_usage_bottom_sheet.xml
@@ -29,24 +29,6 @@
android:focusable="true"
android:background="?attr/selectableItemBackground" />
- <TextView
- android:id="@+id/user_text_view_new_comment_filter_usage_bottom_sheet_fragment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/user"
- android:textColor="?attr/primaryTextColor"
- android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family"
- android:paddingTop="16dp"
- android:paddingBottom="16dp"
- android:paddingStart="32dp"
- android:paddingEnd="32dp"
- app:drawableStartCompat="@drawable/ic_user_24dp"
- android:drawablePadding="48dp"
- android:clickable="true"
- android:focusable="true"
- android:background="?attr/selectableItemBackground" />
-
</LinearLayout>
</androidx.core.widget.NestedScrollView> \ No newline at end of file