aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-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
-rw-r--r--app/src/main/res/layout/activity_customize_comment_filter.xml25
-rw-r--r--app/src/main/res/values/arrays.xml5
-rw-r--r--app/src/main/res/values/strings.xml4
5 files changed, 53 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);
diff --git a/app/src/main/res/layout/activity_customize_comment_filter.xml b/app/src/main/res/layout/activity_customize_comment_filter.xml
index 9153e01a..dbb24455 100644
--- a/app/src/main/res/layout/activity_customize_comment_filter.xml
+++ b/app/src/main/res/layout/activity_customize_comment_filter.xml
@@ -62,6 +62,31 @@
</com.google.android.material.textfield.TextInputLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="20dp">
+
+ <TextView
+ android:id="@+id/display_mode_title_text_view_customize_comment_filter_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:text="@string/comment_filter_display_mode"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ <Spinner
+ android:id="@+id/display_mode_spinner_customize_comment_filter_activity"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:entries="@array/comment_filter_display_mode" />
+
+ </LinearLayout>
+
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/exclude_strings_text_input_layout_customize_comment_filter_activity"
android:layout_width="match_parent"
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 8da3ffdb..2acccb9a 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -720,4 +720,9 @@
<item>0</item>
</string-array>
+ <string-array name="comment_filter_display_mode">
+ <item>@string/comment_filter_display_mode_remove_comments</item>
+ <item>@string/comment_filter_display_mode_fully_collapse_comments</item>
+ </string-array>
+
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 039627dd..5f772352 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1401,5 +1401,9 @@
<string name="emote">Emote</string>
<string name="none">None</string>
+ <string name="comment_filter_display_mode">Display mode</string>
+ <string name="comment_filter_display_mode_remove_comments">Remove comments</string>
+ <string name="comment_filter_display_mode_fully_collapse_comments">Fully collapse comments</string>
+
</resources>