aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-07-18 01:31:05 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-07-18 01:31:05 +0000
commit2863bac0111daddf3e1d762be6266a525f59e95f (patch)
tree53a9bd1450d46209434dee02cbbaa6b1ae21f2dc /app/src/main/java
parent695076a1bdcae381db3255b296c551763d96ddcf (diff)
downloadinfinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.tar
infinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.tar.gz
infinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.tar.bz2
infinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.tar.lz
infinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.tar.xz
infinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.tar.zst
infinity-for-reddit-2863bac0111daddf3e1d762be6266a525f59e95f.zip
Add an entry for Display mode in CustomizeCommentFilterActivity.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java2
2 files changed, 19 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java
index 95ebd9a2..668ea783 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java
@@ -11,6 +11,8 @@ import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@@ -138,6 +140,7 @@ public class CustomizeCommentFilterActivity extends BaseActivity {
private void bindView() {
binding.nameTextInputEditTextCustomizeCommentFilterActivity.setText(commentFilter.name);
+ binding.displayModeSpinnerCustomizeCommentFilterActivity.setSelection(commentFilter.displayMode == CommentFilter.DisplayMode.REMOVE_COMMENT ? 0 : 1);
binding.excludeStringsTextInputEditTextCustomizeCommentFilterActivity.setText(commentFilter.excludeStrings);
binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.setText(commentFilter.excludeUsers);
binding.minVoteTextInputEditTextCustomizeCommentFilterActivity.setText(Integer.toString(commentFilter.minVote));
@@ -179,6 +182,18 @@ public class CustomizeCommentFilterActivity extends BaseActivity {
binding.nameTextInputLayoutCustomizeCommentFilterActivity.setBoxStrokeColor(primaryTextColor);
binding.nameTextInputLayoutCustomizeCommentFilterActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
binding.nameTextInputEditTextCustomizeCommentFilterActivity.setTextColor(primaryTextColor);
+ binding.displayModeTitleTextViewCustomizeCommentFilterActivity.setTextColor(primaryTextColor);
+ binding.displayModeSpinnerCustomizeCommentFilterActivity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+ ((TextView) parent.getChildAt(0)).setTextColor(primaryTextColor);
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+
+ }
+ });
binding.excludeStringsTextInputLayoutCustomizeCommentFilterActivity.setBoxStrokeColor(primaryTextColor);
binding.excludeStringsTextInputLayoutCustomizeCommentFilterActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
binding.excludeStringsTextInputEditTextCustomizeCommentFilterActivity.setTextColor(primaryTextColor);
@@ -299,6 +314,8 @@ public class CustomizeCommentFilterActivity extends BaseActivity {
private void constructCommentFilter() throws PatternSyntaxException {
commentFilter.name = binding.nameTextInputEditTextCustomizeCommentFilterActivity.getText().toString();
+ commentFilter.displayMode = binding.displayModeSpinnerCustomizeCommentFilterActivity.getSelectedItemPosition() == 0 ?
+ CommentFilter.DisplayMode.REMOVE_COMMENT : CommentFilter.DisplayMode.COLLAPSE_COMMENT;
commentFilter.excludeStrings = binding.excludeStringsTextInputEditTextCustomizeCommentFilterActivity.getText().toString();
commentFilter.excludeUsers = binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.getText().toString();
commentFilter.maxVote = binding.maxVoteTextInputEditTextCustomizeCommentFilterActivity.getText() == null || binding.maxVoteTextInputEditTextCustomizeCommentFilterActivity.getText().toString().equals("") ? -1 : Integer.parseInt(binding.maxVoteTextInputEditTextCustomizeCommentFilterActivity.getText().toString());
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 796fd68d..4cce731d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilter.java
@@ -38,6 +38,7 @@ public class CommentFilter implements Parcelable {
protected CommentFilter(Parcel in) {
name = in.readString();
+ displayMode = in.readInt();
maxVote = in.readInt();
minVote = in.readInt();
excludeStrings = in.readString();
@@ -120,6 +121,7 @@ public class CommentFilter implements Parcelable {
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(name);
+ dest.writeInt(displayMode);
dest.writeInt(maxVote);
dest.writeInt(minVote);
dest.writeString(excludeStrings);