aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-11-04 04:06:30 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-11-04 04:06:30 +0000
commit6ee78c979f362e1f4573450df7db514be9f7bc4a (patch)
tree90a794adef65bda6792c41d335a65d90480e073b /app
parent66ce42081ca0b2b862abf9ddfc62778dd57bbd0f (diff)
downloadinfinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.tar
infinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.tar.gz
infinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.tar.bz2
infinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.tar.lz
infinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.tar.xz
infinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.tar.zst
infinity-for-reddit-6ee78c979f362e1f4573450df7db514be9f7bc4a.zip
New option in CommentMoreBottomSheetFragment: Add to comment filter.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java62
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentFilterOptionsBottomSheetFragment.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java84
-rw-r--r--app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml19
-rw-r--r--app/src/main/res/values/arrays.xml4
-rw-r--r--app/src/main/res/values/strings.xml2
8 files changed, 127 insertions, 64 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java
index 71b2a765..74a65218 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java
@@ -6,18 +6,22 @@ import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProvider;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+
import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.adapters.CommentFilterWithUsageRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.CommentFilterOptionsBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.comment.Comment;
import ml.docilealligator.infinityforreddit.commentfilter.CommentFilter;
import ml.docilealligator.infinityforreddit.commentfilter.CommentFilterWithUsageViewModel;
import ml.docilealligator.infinityforreddit.commentfilter.DeleteCommentFilter;
@@ -26,6 +30,8 @@ import ml.docilealligator.infinityforreddit.databinding.ActivityCommentFilterPre
public class CommentFilterPreferenceActivity extends BaseActivity {
+ public static final String EXTRA_COMMENT = "EC";
+
private ActivityCommentFilterPreferenceBinding binding;
@Inject
@@ -51,25 +57,33 @@ public class CommentFilterPreferenceActivity extends BaseActivity {
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
applyCustomTheme();
setSupportActionBar(binding.toolbarCommentFilterPreferenceActivity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ Comment comment = getIntent().getParcelableExtra(EXTRA_COMMENT);
+
binding.fabCommentFilterPreferenceActivity.setOnClickListener(view -> {
- Intent intent = new Intent(this, CustomizeCommentFilterActivity.class);
- intent.putExtra(CustomizeCommentFilterActivity.EXTRA_FROM_SETTINGS, true);
- startActivity(intent);
+ if (comment != null) {
+ showCommentFilterOptions(comment, null);
+ } else {
+ Intent intent = new Intent(this, CustomizeCommentFilterActivity.class);
+ intent.putExtra(CustomizeCommentFilterActivity.EXTRA_FROM_SETTINGS, true);
+ startActivity(intent);
+ }
});
adapter = new CommentFilterWithUsageRecyclerViewAdapter(this, commentFilter -> {
- CommentFilterOptionsBottomSheetFragment commentFilterOptionsBottomSheetFragment = new CommentFilterOptionsBottomSheetFragment();
- Bundle bundle = new Bundle();
- bundle.putParcelable(CommentFilterOptionsBottomSheetFragment.EXTRA_POST_FILTER, commentFilter);
- commentFilterOptionsBottomSheetFragment.setArguments(bundle);
- commentFilterOptionsBottomSheetFragment.show(getSupportFragmentManager(), commentFilterOptionsBottomSheetFragment.getTag());
+ if (comment != null) {
+ showCommentFilterOptions(comment, commentFilter);
+ } else {
+ CommentFilterOptionsBottomSheetFragment commentFilterOptionsBottomSheetFragment = new CommentFilterOptionsBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(CommentFilterOptionsBottomSheetFragment.EXTRA_COMMENT_FILTER, commentFilter);
+ commentFilterOptionsBottomSheetFragment.setArguments(bundle);
+ commentFilterOptionsBottomSheetFragment.show(getSupportFragmentManager(), commentFilterOptionsBottomSheetFragment.getTag());
+ }
});
binding.recyclerViewCommentFilterPreferenceActivity.setAdapter(adapter);
@@ -97,6 +111,32 @@ public class CommentFilterPreferenceActivity extends BaseActivity {
DeleteCommentFilter.deleteCommentFilter(redditDataRoomDatabase, executor, commentFilter);
}
+ public void showCommentFilterOptions(Comment comment, @Nullable CommentFilter commentFilter) {
+ String[] options = getResources().getStringArray(R.array.add_to_comment_filter_options);
+ boolean[] selectedOptions = new boolean[]{false};
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.select)
+ .setMultiChoiceItems(options, selectedOptions, (dialogInterface, i, b) -> selectedOptions[i] = b)
+ .setPositiveButton(R.string.ok, (dialogInterface, i) -> {
+ Intent intent = new Intent(CommentFilterPreferenceActivity.this, CustomizeCommentFilterActivity.class);
+ if (commentFilter != null) {
+ intent.putExtra(CustomizeCommentFilterActivity.EXTRA_COMMENT_FILTER, commentFilter);
+ }
+ intent.putExtra(CustomizeCommentFilterActivity.EXTRA_FROM_SETTINGS, true);
+ for (int j = 0; j < selectedOptions.length; j++) {
+ if (selectedOptions[j]) {
+ switch (j) {
+ case 0:
+ intent.putExtra(CustomizeCommentFilterActivity.EXTRA_EXCLUDE_USER, comment.getAuthor());
+ break;
+ }
+ }
+ }
+ startActivity(intent);
+ })
+ .show();
+ }
+
@Override
protected SharedPreferences getDefaultSharedPreferences() {
return sharedPreferences;
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 ce612cde..94dcd532 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeCommentFilterActivity.java
@@ -46,6 +46,7 @@ public class CustomizeCommentFilterActivity extends BaseActivity {
public static final String EXTRA_COMMENT_FILTER = "ECF";
public static final String EXTRA_FROM_SETTINGS = "EFS";
+ public static final String EXTRA_EXCLUDE_USER = "EEU";
public static final String RETURN_EXTRA_COMMENT_FILTER = "RECF";
private static final String COMMENT_FILTER_STATE = "CFS";
private static final String ORIGINAL_NAME_STATE = "ONS";
@@ -142,6 +143,16 @@ public class CustomizeCommentFilterActivity extends BaseActivity {
binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.setText(commentFilter.excludeUsers);
binding.minVoteTextInputEditTextCustomizeCommentFilterActivity.setText(Integer.toString(commentFilter.minVote));
binding.maxVoteTextInputEditTextCustomizeCommentFilterActivity.setText(Integer.toString(commentFilter.maxVote));
+
+ Intent intent = getIntent();
+ String excludeUser = intent.getStringExtra(EXTRA_EXCLUDE_USER);
+
+ if (excludeUser != null && !excludeUser.equals("")) {
+ if (!binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.getText().toString().equals("")) {
+ binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.append(",");
+ }
+ binding.excludeUsersTextInputEditTextCustomizeCommentFilterActivity.append(excludeUser);
+ }
}
@Override
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 09ba5f0a..c838c07d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
@@ -6,6 +6,7 @@ import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.lifecycle.Observer;
@@ -130,7 +131,7 @@ public class PostFilterPreferenceActivity extends BaseActivity {
});
}
- public void showPostFilterOptions(Post post, PostFilter postFilter) {
+ public void showPostFilterOptions(Post post, @Nullable PostFilter postFilter) {
String[] options = getResources().getStringArray(R.array.add_to_post_filter_options);
boolean[] selectedOptions = new boolean[]{false, false, false, false, false, false};
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentFilterOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentFilterOptionsBottomSheetFragment.java
index fd06d30e..46ac8493 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentFilterOptionsBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentFilterOptionsBottomSheetFragment.java
@@ -7,9 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.activities.CommentFilterPreferenceActivity;
import ml.docilealligator.infinityforreddit.commentfilter.CommentFilter;
import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment;
@@ -18,7 +16,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
public class CommentFilterOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment {
- public static final String EXTRA_POST_FILTER = "EPF";
+ public static final String EXTRA_COMMENT_FILTER = "ECF";
private CommentFilterPreferenceActivity activity;
public CommentFilterOptionsBottomSheetFragment() {
@@ -31,7 +29,7 @@ public class CommentFilterOptionsBottomSheetFragment extends LandscapeExpandedRo
// Inflate the layout for this fragment
FragmentCommentFilterOptionsBottomSheetBinding binding = FragmentCommentFilterOptionsBottomSheetBinding.inflate(inflater, container, false);
- CommentFilter commentFilter = getArguments().getParcelable(EXTRA_POST_FILTER);
+ CommentFilter commentFilter = getArguments().getParcelable(EXTRA_COMMENT_FILTER);
binding.editTextViewCommentFilterOptionsBottomSheetFragment.setOnClickListener(view -> {
activity.editCommentFilter(commentFilter);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java
index 3ec419db..f82e759e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java
@@ -10,18 +10,16 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
-import butterknife.BindView;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
import ml.docilealligator.infinityforreddit.activities.CommentActivity;
+import ml.docilealligator.infinityforreddit.activities.CommentFilterPreferenceActivity;
import ml.docilealligator.infinityforreddit.activities.EditCommentActivity;
import ml.docilealligator.infinityforreddit.activities.GiveAwardActivity;
import ml.docilealligator.infinityforreddit.activities.ReportActivity;
@@ -29,6 +27,7 @@ import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity;
import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.comment.Comment;
import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment;
+import ml.docilealligator.infinityforreddit.databinding.FragmentCommentMoreBottomSheetBinding;
import ml.docilealligator.infinityforreddit.utils.Utils;
@@ -43,24 +42,8 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
public static final String EXTRA_POSITION = "EP";
public static final String EXTRA_SHOW_REPLY_AND_SAVE_OPTION = "ESSARO";
public static final String EXTRA_IS_NSFW = "EIN";
- @BindView(R.id.edit_text_view_comment_more_bottom_sheet_fragment)
- TextView editTextView;
- @BindView(R.id.delete_text_view_comment_more_bottom_sheet_fragment)
- TextView deleteTextView;
- @BindView(R.id.reply_text_view_comment_more_bottom_sheet_fragment)
- TextView replyTextView;
- @BindView(R.id.save_text_view_comment_more_bottom_sheet_fragment)
- TextView saveTextView;
- @BindView(R.id.share_text_view_comment_more_bottom_sheet_fragment)
- TextView shareTextView;
- @BindView(R.id.copy_text_view_comment_more_bottom_sheet_fragment)
- TextView copyTextView;
- @BindView(R.id.give_award_text_view_comment_more_bottom_sheet_fragment)
- TextView giveAwardTextView;
- @BindView(R.id.report_view_comment_more_bottom_sheet_fragment)
- TextView reportTextView;
- @BindView(R.id.see_removed_view_comment_more_bottom_sheet_fragment)
- TextView seeRemovedTextView;
+
+ private FragmentCommentMoreBottomSheetBinding binding;
private BaseActivity activity;
public CommentMoreBottomSheetFragment() {
@@ -70,31 +53,30 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_comment_more_bottom_sheet, container, false);
- ButterKnife.bind(this, rootView);
+ binding = FragmentCommentMoreBottomSheetBinding.inflate(inflater, container, false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
- rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
+ binding.getRoot().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
Bundle bundle = getArguments();
if (bundle == null) {
dismiss();
- return rootView;
+ return binding.getRoot();
}
Comment comment = bundle.getParcelable(EXTRA_COMMENT);
if (comment == null) {
dismiss();
- return rootView;
+ return binding.getRoot();
}
String accessToken = bundle.getString(EXTRA_ACCESS_TOKEN);
boolean editAndDeleteAvailable = bundle.getBoolean(EXTRA_EDIT_AND_DELETE_AVAILABLE, false);
boolean showReplyAndSaveOption = bundle.getBoolean(EXTRA_SHOW_REPLY_AND_SAVE_OPTION, false);
if (accessToken != null && !accessToken.equals("")) {
- giveAwardTextView.setVisibility(View.VISIBLE);
- giveAwardTextView.setOnClickListener(view -> {
+ binding.giveAwardTextViewCommentMoreBottomSheetFragment.setVisibility(View.VISIBLE);
+ binding.giveAwardTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
Intent intent = new Intent(activity, GiveAwardActivity.class);
intent.putExtra(GiveAwardActivity.EXTRA_THING_FULLNAME, comment.getFullName());
intent.putExtra(GiveAwardActivity.EXTRA_ITEM_POSITION, bundle.getInt(EXTRA_POSITION));
@@ -107,10 +89,10 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
});
if (editAndDeleteAvailable) {
- editTextView.setVisibility(View.VISIBLE);
- deleteTextView.setVisibility(View.VISIBLE);
+ binding.editTextViewCommentMoreBottomSheetFragment.setVisibility(View.VISIBLE);
+ binding.deleteTextViewCommentMoreBottomSheetFragment.setVisibility(View.VISIBLE);
- editTextView.setOnClickListener(view -> {
+ binding.editTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
Intent intent = new Intent(activity, EditCommentActivity.class);
intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, comment.getFullName());
intent.putExtra(EditCommentActivity.EXTRA_CONTENT, comment.getCommentMarkdown());
@@ -124,7 +106,7 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
dismiss();
});
- deleteTextView.setOnClickListener(view -> {
+ binding.deleteTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
dismiss();
if (activity instanceof ViewPostDetailActivity) {
((ViewPostDetailActivity) activity).deleteComment(comment.getFullName(), bundle.getInt(EXTRA_POSITION));
@@ -136,16 +118,16 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
}
if (showReplyAndSaveOption) {
- replyTextView.setVisibility(View.VISIBLE);
- saveTextView.setVisibility(View.VISIBLE);
+ binding.replyTextViewCommentMoreBottomSheetFragment.setVisibility(View.VISIBLE);
+ binding.saveTextViewCommentMoreBottomSheetFragment.setVisibility(View.VISIBLE);
if (comment.isSaved()) {
- saveTextView.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(activity, R.drawable.ic_bookmark_24dp), null, null, null);
- saveTextView.setText(R.string.unsave_comment);
+ binding.saveTextViewCommentMoreBottomSheetFragment.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(activity, R.drawable.ic_bookmark_24dp), null, null, null);
+ binding.saveTextViewCommentMoreBottomSheetFragment.setText(R.string.unsave_comment);
} else {
- saveTextView.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(activity, R.drawable.ic_bookmark_border_24dp), null, null, null);
- saveTextView.setText(R.string.save_comment);
+ binding.saveTextViewCommentMoreBottomSheetFragment.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(activity, R.drawable.ic_bookmark_border_24dp), null, null, null);
+ binding.saveTextViewCommentMoreBottomSheetFragment.setText(R.string.save_comment);
}
- replyTextView.setOnClickListener(view -> {
+ binding.replyTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
Intent intent = new Intent(activity, CommentActivity.class);
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1);
intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_BODY_MARKDOWN_KEY, comment.getCommentMarkdown());
@@ -159,7 +141,7 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
dismiss();
});
- saveTextView.setOnClickListener(view -> {
+ binding.saveTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
if (activity instanceof ViewPostDetailActivity) {
((ViewPostDetailActivity) activity).saveComment(comment, bundle.getInt(EXTRA_POSITION));
}
@@ -167,7 +149,7 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
});
}
- shareTextView.setOnClickListener(view -> {
+ binding.shareTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
dismiss();
try {
Intent intent = new Intent(Intent.ACTION_SEND);
@@ -179,19 +161,19 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
}
});
- shareTextView.setOnLongClickListener(view -> {
+ binding.shareTextViewCommentMoreBottomSheetFragment.setOnLongClickListener(view -> {
dismiss();
activity.copyLink(comment.getPermalink());
return true;
});
- copyTextView.setOnClickListener(view -> {
+ binding.copyTextViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
dismiss();
CopyTextBottomSheetFragment.show(activity.getSupportFragmentManager(),
comment.getCommentRawText(), comment.getCommentMarkdown());
});
- reportTextView.setOnClickListener(view -> {
+ binding.reportViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
Intent intent = new Intent(activity, ReportActivity.class);
intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, comment.getSubredditName());
intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, comment.getFullName());
@@ -204,9 +186,9 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
"[deleted]".equals(comment.getCommentRawText()) ||
"[removed]".equals(comment.getCommentRawText())
) {
- seeRemovedTextView.setVisibility(View.VISIBLE);
+ binding.seeRemovedViewCommentMoreBottomSheetFragment.setVisibility(View.VISIBLE);
- seeRemovedTextView.setOnClickListener(view -> {
+ binding.seeRemovedViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
dismiss();
if (activity instanceof ViewPostDetailActivity) {
((ViewPostDetailActivity) activity).showRemovedComment(comment, bundle.getInt(EXTRA_POSITION));
@@ -214,11 +196,17 @@ public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBott
});
}
+ binding.addToCommentFilterViewCommentMoreBottomSheetFragment.setOnClickListener(view -> {
+ Intent intent = new Intent(activity, CommentFilterPreferenceActivity.class);
+ intent.putExtra(CommentFilterPreferenceActivity.EXTRA_COMMENT, comment);
+ activity.startActivity(intent);
+ });
+
if (activity.typeface != null) {
- Utils.setFontToAllTextViews(rootView, activity.typeface);
+ Utils.setFontToAllTextViews(binding.getRoot(), activity.typeface);
}
- return rootView;
+ return binding.getRoot();
}
@Override
diff --git a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml
index fcae03f0..2ae50a0f 100644
--- a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml
+++ b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml
@@ -183,6 +183,25 @@
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_preview_24dp" />
+ <TextView
+ android:id="@+id/add_to_comment_filter_view_comment_more_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?attr/selectableItemBackground"
+ android:clickable="true"
+ android:drawablePadding="48dp"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:paddingStart="32dp"
+ android:paddingTop="16dp"
+ android:paddingEnd="32dp"
+ android:paddingBottom="16dp"
+ android:text="@string/add_to_comment_filter"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ app:drawableStartCompat="@drawable/ic_filter_24dp" />
+
</LinearLayout>
</androidx.core.widget.NestedScrollView>
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 020a1564..3283e2cd 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -577,6 +577,10 @@
<item>@string/contain_domain</item>
</string-array>
+ <string-array name="add_to_comment_filter_options">
+ <item>@string/exclude_user</item>
+ </string-array>
+
<string-array name="settings_app_lock_timeout">
<item>@string/app_lock_timeout_immediately</item>
<item>@string/app_lock_timeout_1_min</item>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 915535ce..d0c97909 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1388,4 +1388,6 @@
Otherwise, Infinity may not load posts at all. Sorry for the inconvenience.</string>
<string name="i_understand">I understand</string>
+ <string name="add_to_comment_filter">Add to Comment Filter</string>
+
</resources>