aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/AndroidManifest.xml7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/res/values/strings.xml5
-rw-r--r--app/src/main/res/xml/main_preferences.xml5
8 files changed, 39 insertions, 9 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9591a025..a72dd210 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -37,12 +37,19 @@
tools:replace="android:label">
<activity
android:name=".activities.CommentFilterUsageListingActivity"
+ android:parentActivityName=".activities.SettingsActivity"
android:exported="false" />
<activity
android:name=".activities.CustomizeCommentFilterActivity"
+ android:label="@string/customize_comment_filter_activity_label"
+ android:parentActivityName=".activities.SettingsActivity"
+ android:theme="@style/AppTheme.NoActionBar"
android:exported="false" />
<activity
android:name=".activities.CommentFilterPreferenceActivity"
+ android:label="@string/comment_filter_preference_activity_label"
+ android:parentActivityName=".activities.SettingsActivity"
+ android:theme="@style/AppTheme.NoActionBar"
android:exported="false" />
<activity
android:name=".activities.HistoryActivity"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
index 16f8b2d8..59639054 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
@@ -499,9 +499,7 @@ public class CustomizePostFilterActivity extends BaseActivity {
if (typeface != null) {
Utils.setFontToAllTextViews(coordinatorLayout, typeface);
}
- }
-
- public void setCursorDrawableColor(EditText editText, int color) {
+ } void setCursorDrawableColor(EditText editText, int color) {
try {
Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
fCursorDrawableRes.setAccessible(true);
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 5d1ad217..090cd27c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java
@@ -32,9 +32,9 @@ public class CommentFilterUsageEmbeddedRecyclerViewAdapter extends RecyclerView.
@Override
public void onBindViewHolder(@NonNull EntryViewHolder holder, int position) {
if (commentFilterUsageList == null || commentFilterUsageList.isEmpty()) {
- holder.textView.setText(R.string.click_to_apply_post_filter);
+ holder.textView.setText(R.string.comment_filter_applied_to_all_subreddits);
} else if (holder.getBindingAdapterPosition() > 4) {
- holder.textView.setText(baseActivity.getString(R.string.post_filter_usage_embedded_more_count, commentFilterUsageList.size() - 5));
+ holder.textView.setText(baseActivity.getString(R.string.comment_filter_usage_embedded_more_count, commentFilterUsageList.size() - 5));
} else {
CommentFilterUsage commentFilterUsage = commentFilterUsageList.get(holder.getBindingAdapterPosition());
switch (commentFilterUsage.usage) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java
index 48fd090f..914c64f2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java
@@ -39,14 +39,14 @@ public class CommentFilterWithUsageRecyclerViewAdapter extends RecyclerView.Adap
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof CommentFilterViewHolder) {
- ((CommentFilterViewHolder) holder).binding.commentFilterNameTextViewItemCommentFilter.setText(commentFilterWithUsageList.get(position - 1).commentFilter.name);
- ((CommentFilterViewHolder) holder).adapter.setCommentFilterUsageList(commentFilterWithUsageList.get(position - 1).commentFilterUsageList);
+ ((CommentFilterViewHolder) holder).binding.commentFilterNameTextViewItemCommentFilter.setText(commentFilterWithUsageList.get(position).commentFilter.name);
+ ((CommentFilterViewHolder) holder).adapter.setCommentFilterUsageList(commentFilterWithUsageList.get(position).commentFilterUsageList);
}
}
@Override
public int getItemCount() {
- return commentFilterWithUsageList == null ? 1 : 1 + commentFilterWithUsageList.size();
+ return commentFilterWithUsageList == null ? 0 : commentFilterWithUsageList.size();
}
public void setCommentFilterWithUsageList(List<CommentFilterWithUsage> commentFilterWithUsageList) {
@@ -68,7 +68,7 @@ public class CommentFilterWithUsageRecyclerViewAdapter extends RecyclerView.Adap
}
binding.getRoot().setOnClickListener(view -> {
- onItemClickListener.onItemClick(commentFilterWithUsageList.get(getBindingAdapterPosition() - 1).commentFilter);
+ onItemClickListener.onItemClick(commentFilterWithUsageList.get(getBindingAdapterPosition()).commentFilter);
});
binding.commentFilterUsageRecyclerViewItemCommentFilter.setRecycledViewPool(recycledViewPool);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java
index 284ab852..37126ab6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java
@@ -9,6 +9,7 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
+import androidx.annotation.NonNull;
import androidx.biometric.BiometricManager;
import androidx.preference.Preference;
@@ -17,6 +18,7 @@ import javax.inject.Named;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.activities.CommentFilterPreferenceActivity;
import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity;
import ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceFragmentCompat;
@@ -35,6 +37,7 @@ public class MainPreferenceFragment extends CustomFontPreferenceFragmentCompat {
Preference securityPreference = findPreference(SharedPreferencesUtils.SECURITY);
Preference postFilterPreference = findPreference(SharedPreferencesUtils.POST_FILTER);
+ Preference commentFilterPreference = findPreference(SharedPreferencesUtils.COMMENT_FILTER);
Preference privacyPolicyPreference = findPreference(SharedPreferencesUtils.PRIVACY_POLICY_KEY);
Preference redditUserAgreementPreference = findPreference(SharedPreferencesUtils.REDDIT_USER_AGREEMENT_KEY);
@@ -53,6 +56,17 @@ public class MainPreferenceFragment extends CustomFontPreferenceFragmentCompat {
});
}
+ if (commentFilterPreference != null) {
+ commentFilterPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(@NonNull Preference preference) {
+ Intent intent = new Intent(activity, CommentFilterPreferenceActivity.class);
+ activity.startActivity(intent);
+ return true;
+ }
+ });
+ }
+
if (privacyPolicyPreference != null) {
privacyPolicyPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
index baef18de..0fe8c0ce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -218,6 +218,7 @@ public class SharedPreferencesUtils {
public static final String HIDE_THE_NUMBER_OF_VOTES_IN_COMMENTS = "hide_the_number_of_votes_in_comments";
public static final String COMMENT_DIVIDER_TYPE = "comment_divider_type";
public static final String SUBSCRIBED_THINGS_SYNC_TIME = "subscribed_things_sync_time";
+ public static final String COMMENT_FILTER = "comment_filter";
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 863c9ba9..9090da33 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -46,6 +46,8 @@
<string name="post_poll_activity_label">Poll Post</string>
<string name="history_activity_label">History</string>
<string name="subscription_activity_label">Subscription</string>
+ <string name="comment_filter_preference_activity_label">Comment Filter</string>
+ <string name="customize_comment_filter_activity_label">Customize Post Filter</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
@@ -651,6 +653,7 @@
<string name="settings_easier_to_watch_in_full_screen_title">Easier to Watch in Full Screen</string>
<string name="settings_hide_fab_in_post_feed">Hide FAB in Post Feed</string>
<string name="settings_comment_divider_type">Comment Divider Type</string>
+ <string name="settings_comment_filter_title">Comment Filter</string>
<string name="no_link_available">Cannot get the link</string>
@@ -1382,5 +1385,7 @@
<string name="click_to_apply_post_filter">Click here to apply it to some post feeds</string>
<string name="post_filter_usage_embedded_more_count">and %1$d more</string>
+ <string name="comment_filter_applied_to_all_subreddits">Applied to all subreddits</string>
+ <string name="comment_filter_usage_embedded_more_count">and %1$d more</string>
</resources>
diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml
index d7433851..b582f0da 100644
--- a/app/src/main/res/xml/main_preferences.xml
+++ b/app/src/main/res/xml/main_preferences.xml
@@ -68,6 +68,11 @@
app:title="@string/settings_post_filter_title" />
<ml.docilealligator.infinityforreddit.customviews.CustomFontPreference
+ app:key="comment_filter"
+ app:icon="@drawable/ic_filter_24dp"
+ app:title="@string/settings_comment_filter_title" />
+
+ <ml.docilealligator.infinityforreddit.customviews.CustomFontPreference
app:icon="@drawable/ic_sort_24dp"
app:title="@string/settings_sort_type_title"
app:fragment="ml.docilealligator.infinityforreddit.settings.SortTypePreferenceFragment" />