aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-14 12:25:26 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-14 12:25:26 +0000
commit200f5839ff3d673b1e87c4d65c984f50c90fb661 (patch)
tree46e2bb81dc90cbf68ee35087ce2eef4e41215217 /app
parent4f9bd0cde0140ef77e3e4004e96f6f990de572c5 (diff)
downloadinfinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.tar
infinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.tar.gz
infinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.tar.bz2
infinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.tar.lz
infinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.tar.xz
infinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.tar.zst
infinity-for-reddit-200f5839ff3d673b1e87c4d65c984f50c90fb661.zip
Ignore case when searching comments.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java14
-rw-r--r--app/src/main/res/layout/activity_view_post_detail.xml3
2 files changed, 10 insertions, 7 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
index 4edf51a8..56cc7706 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
@@ -770,14 +770,15 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
if (visibleComments != null) {
if (searchNextComment) {
for (int i = currentSearchIndex + 1; i < visibleComments.size(); i++) {
- if (visibleComments.get(i).getCommentRawText() != null && visibleComments.get(i).getCommentRawText().contains(query)) {
+ if (visibleComments.get(i).getCommentRawText() != null &&
+ visibleComments.get(i).getCommentRawText().toLowerCase().contains(query.toLowerCase())) {
if (mCommentsAdapter != null) {
mCommentsAdapter.highlightSearchResult(i);
mCommentsAdapter.notifyItemChanged(i);
if (mCommentsRecyclerView == null) {
- mRecyclerView.smoothScrollToPosition(i + 1);
+ mRecyclerView.scrollToPosition(i + 1);
} else {
- mCommentsRecyclerView.smoothScrollToPosition(i);
+ mCommentsRecyclerView.scrollToPosition(i);
}
}
return;
@@ -787,14 +788,15 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
return;
} else {
for (int i = currentSearchIndex - 1; i >= 0; i--) {
- if (visibleComments.get(i).getCommentRawText() !=null && visibleComments.get(i).getCommentRawText().contains(query)) {
+ if (visibleComments.get(i).getCommentRawText() !=null &&
+ visibleComments.get(i).getCommentRawText().toLowerCase().contains(query.toLowerCase())) {
if (mCommentsAdapter != null) {
mCommentsAdapter.highlightSearchResult(i);
mCommentsAdapter.notifyItemChanged(i);
if (mCommentsRecyclerView == null) {
- mRecyclerView.smoothScrollToPosition(i + 1);
+ mRecyclerView.scrollToPosition(i + 1);
} else {
- mCommentsRecyclerView.smoothScrollToPosition(i);
+ mCommentsRecyclerView.scrollToPosition(i);
}
}
return;
diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml
index eeaf034d..da98158d 100644
--- a/app/src/main/res/layout/activity_view_post_detail.xml
+++ b/app/src/main/res/layout/activity_view_post_detail.xml
@@ -78,7 +78,8 @@
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:textSize="?attr/font_default"
- android:hint="@string/search_comments" />
+ android:hint="@string/search_comments"
+ android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>