aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-12-26 07:25:40 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-12-26 07:25:40 +0000
commit97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15 (patch)
treee8976d97e03ae64479554906d2be6beea7944f0a
parentfa55fb369dd4c893f300e75bfadb705a9e82233f (diff)
downloadinfinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.tar
infinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.tar.gz
infinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.tar.bz2
infinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.tar.lz
infinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.tar.xz
infinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.tar.zst
infinity-for-reddit-97b5c5d5c6e4f0327aaa0e864ae1ce36b6e26a15.zip
Continue adding post filter.
Diffstat (limited to '')
-rw-r--r--app/src/main/AndroidManifest.xml6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java197
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java93
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java79
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java66
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java48
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java38
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java12
-rw-r--r--app/src/main/res/layout/activity_post_filter_application.xml53
-rw-r--r--app/src/main/res/layout/dialog_edit_name.xml2
-rw-r--r--app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml38
-rw-r--r--app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml106
-rw-r--r--app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml52
-rw-r--r--app/src/main/res/layout/item_post_filter_usage.xml14
-rw-r--r--app/src/main/res/values/strings.xml11
22 files changed, 869 insertions, 9 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d6f42976..b6a76dae 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -32,7 +32,11 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:label">
- <activity android:name=".activities.PostFilterPreferenceActivity"
+ <activity android:name=".activities.PostFilterUsageListingActivity"
+ android:parentActivityName=".activities.SettingsActivity"
+ android:theme="@style/AppTheme.NoActionBar" />
+ <activity
+ android:name=".activities.PostFilterPreferenceActivity"
android:label="@string/post_filter_preference_activity_label"
android:parentActivityName=".activities.SettingsActivity"
android:theme="@style/AppTheme.NoActionBar" />
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index d6c8ccf1..38b477e8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -22,6 +22,7 @@ import ml.docilealligator.infinityforreddit.activities.InboxActivity;
import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.activities.LoginActivity;
import ml.docilealligator.infinityforreddit.activities.MainActivity;
+import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity;
import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity;
import ml.docilealligator.infinityforreddit.activities.PostImageActivity;
import ml.docilealligator.infinityforreddit.activities.PostLinkActivity;
@@ -236,4 +237,6 @@ public interface AppComponent {
void inject(PostHistoryFragment postHistoryFragment);
void inject(PostFilterPreferenceActivity postFilterPreferenceActivity);
+
+ void inject(PostFilterUsageListingActivity postFilterUsageListingActivity);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java
index edc3a2ac..a42c3fa4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java
@@ -155,7 +155,7 @@ public class CustomThemeListingActivity extends BaseActivity implements
@Override
public void changeName(String oldThemeName) {
View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_name, null);
- EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_name_dialog);
+ EditText themeNameEditText = dialogView.findViewById(R.id.name_edit_text_edit_name_dialog);
themeNameEditText.setText(oldThemeName);
themeNameEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -294,7 +294,7 @@ public class CustomThemeListingActivity extends BaseActivity implements
.setPositiveButton(R.string.rename, (dialogInterface, i)
-> {
View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_name, null);
- EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_name_dialog);
+ EditText themeNameEditText = dialogView.findViewById(R.id.name_edit_text_edit_name_dialog);
themeNameEditText.setText(customTheme.name);
themeNameEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
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 b6ff5e9d..94597df6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
@@ -14,6 +14,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import java.util.concurrent.Executor;
+
import javax.inject.Inject;
import javax.inject.Named;
@@ -25,6 +27,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.adapters.FilterFragmentPostFilterRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostFilterOptionsBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.postfilter.DeletePostFilter;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
import ml.docilealligator.infinityforreddit.postfilter.PostFilterViewModel;
@@ -47,6 +50,8 @@ public class PostFilterPreferenceActivity extends BaseActivity {
RedditDataRoomDatabase redditDataRoomDatabase;
@Inject
CustomThemeWrapper customThemeWrapper;
+ @Inject
+ Executor executor;
public PostFilterViewModel postFilterViewModel;
private FilterFragmentPostFilterRecyclerViewAdapter adapter;
@@ -94,11 +99,13 @@ public class PostFilterPreferenceActivity extends BaseActivity {
}
public void applyPostFilterTo(PostFilter postFilter) {
-
+ Intent intent = new Intent(this, PostFilterUsageListingActivity.class);
+ intent.putExtra(PostFilterUsageListingActivity.EXTRA_POST_FILTER, postFilter);
+ startActivity(intent);
}
public void deletePostFilter(PostFilter postFilter) {
-
+ DeletePostFilter.deletePostFilter(redditDataRoomDatabase, executor, postFilter);
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java
new file mode 100644
index 00000000..08ee8829
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java
@@ -0,0 +1,197 @@
+package ml.docilealligator.infinityforreddit.activities;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.res.ColorStateList;
+import android.os.Bundle;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+
+import androidx.appcompat.widget.Toolbar;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.lifecycle.ViewModelProvider;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.textfield.TextInputEditText;
+import com.google.android.material.textfield.TextInputLayout;
+
+import java.util.concurrent.Executor;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.adapters.PostFilterUsageRecyclerViewAdapter;
+import ml.docilealligator.infinityforreddit.bottomsheetfragments.NewPostFilterUsageBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostFilterUsageOptionsBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.postfilter.DeletePostFilterUsage;
+import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
+import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
+import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsageViewModel;
+import ml.docilealligator.infinityforreddit.postfilter.SavePostFilterUsage;
+
+public class PostFilterUsageListingActivity extends BaseActivity {
+
+ public static final String EXTRA_POST_FILTER = "EPF";
+ @BindView(R.id.coordinator_layout_post_filter_application_activity)
+ CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.appbar_layout_post_filter_application_activity)
+ AppBarLayout appBarLayout;
+ @BindView(R.id.toolbar_post_filter_application_activity)
+ Toolbar toolbar;
+ @BindView(R.id.recycler_view_post_filter_application_activity)
+ RecyclerView recyclerView;
+ @BindView(R.id.fab_post_filter_application_activity)
+ FloatingActionButton fab;
+ @Inject
+ @Named("default")
+ SharedPreferences sharedPreferences;
+ @Inject
+ RedditDataRoomDatabase redditDataRoomDatabase;
+ @Inject
+ CustomThemeWrapper customThemeWrapper;
+ @Inject
+ Executor executor;
+ public PostFilterUsageViewModel postFilterUsageViewModel;
+ private PostFilterUsageRecyclerViewAdapter adapter;
+ private PostFilter postFilter;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ ((Infinity) getApplication()).getAppComponent().inject(this);
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_post_filter_application);
+
+ ButterKnife.bind(this);
+
+ applyCustomTheme();
+
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ postFilter = getIntent().getParcelableExtra(EXTRA_POST_FILTER);
+
+ setTitle(postFilter.name);
+
+ fab.setOnClickListener(view -> {
+ NewPostFilterUsageBottomSheetFragment newPostFilterUsageBottomSheetFragment = new NewPostFilterUsageBottomSheetFragment();
+ newPostFilterUsageBottomSheetFragment.show(getSupportFragmentManager(), newPostFilterUsageBottomSheetFragment.getTag());
+ });
+
+ adapter = new PostFilterUsageRecyclerViewAdapter(this, postFilterUsage -> {
+ PostFilterUsageOptionsBottomSheetFragment postFilterUsageOptionsBottomSheetFragment = new PostFilterUsageOptionsBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(PostFilterUsageOptionsBottomSheetFragment.EXTRA_POST_FILTER_USAGE, postFilterUsage);
+ postFilterUsageOptionsBottomSheetFragment.setArguments(bundle);
+ postFilterUsageOptionsBottomSheetFragment.show(getSupportFragmentManager(), postFilterUsageOptionsBottomSheetFragment.getTag());
+ });
+ recyclerView.setAdapter(adapter);
+
+ postFilterUsageViewModel = new ViewModelProvider(this,
+ new PostFilterUsageViewModel.Factory(redditDataRoomDatabase, postFilter.name)).get(PostFilterUsageViewModel.class);
+
+ postFilterUsageViewModel.getPostFilterUsageListLiveData().observe(this, postFilterUsages -> adapter.setPostFilterUsages(postFilterUsages));
+ }
+
+ public void newPostFilterUsage(int type) {
+ switch (type) {
+ case PostFilterUsage.HOME_TYPE:
+ case PostFilterUsage.SEARCH_TYPE:
+ PostFilterUsage postFilterUsage = new PostFilterUsage(postFilter.name, type, PostFilterUsage.NO_USAGE);
+ SavePostFilterUsage.savePostFilterUsage(redditDataRoomDatabase, executor, postFilterUsage);
+ break;
+ case PostFilterUsage.SUBREDDIT_TYPE:
+ case PostFilterUsage.USER_TYPE:
+ case PostFilterUsage.MULTIREDDIT_TYPE:
+ editAndPostFilterUsageNameOfUsage(type, null);
+ break;
+ }
+ }
+
+ private void editAndPostFilterUsageNameOfUsage(int type, String nameOfUsage) {
+ View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_post_filter_name_of_usage, null);
+ TextInputLayout textInputLayout = dialogView.findViewById(R.id.text_input_layout_edit_post_filter_name_of_usage_dialog);
+ TextInputEditText textInputEditText = dialogView.findViewById(R.id.text_input_edit_text_edit_post_filter_name_of_usage_dialog);
+ int primaryTextColor = customThemeWrapper.getPrimaryTextColor();
+ textInputLayout.setBoxStrokeColor(primaryTextColor);
+ textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
+ textInputEditText.setTextColor(primaryTextColor);
+ if (nameOfUsage != null && !nameOfUsage.equals(PostFilterUsage.NO_USAGE)) {
+ textInputEditText.setText(nameOfUsage);
+ }
+ textInputEditText.requestFocus();
+ switch (type) {
+ case PostFilterUsage.SUBREDDIT_TYPE:
+ textInputEditText.setHint(R.string.settings_tab_subreddit_name);
+ break;
+ case PostFilterUsage.USER_TYPE:
+ textInputEditText.setHint(R.string.settings_tab_username);
+ break;
+ case PostFilterUsage.MULTIREDDIT_TYPE:
+ textInputEditText.setHint(R.string.settings_tab_multi_reddit_name);
+ break;
+ }
+
+ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (imm != null) {
+ imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
+ }
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.edit_post_filter_name_of_usage_info)
+ .setView(dialogView)
+ .setPositiveButton(R.string.ok, (editTextDialogInterface, i1)
+ -> {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(textInputEditText.getWindowToken(), 0);
+ }
+
+ PostFilterUsage postFilterUsage;
+ if (textInputEditText.getText().toString().equals("")) {
+ postFilterUsage = new PostFilterUsage(postFilter.name, type, PostFilterUsage.NO_USAGE);
+ } else {
+ postFilterUsage = new PostFilterUsage(postFilter.name, type, textInputEditText.getText().toString());
+ }
+
+ SavePostFilterUsage.savePostFilterUsage(redditDataRoomDatabase, executor, postFilterUsage);
+ })
+ .setNegativeButton(R.string.cancel, null)
+ .setOnDismissListener(editTextDialogInterface -> {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(textInputEditText.getWindowToken(), 0);
+ }
+ })
+ .show();
+ }
+
+ public void editPostFilterUsage(PostFilterUsage postFilterUsage) {
+ editAndPostFilterUsageNameOfUsage(postFilterUsage.usage, postFilterUsage.nameOfUsage);
+ }
+
+ public void deletePostFilterUsage(PostFilterUsage postFilterUsage) {
+ DeletePostFilterUsage.deletePostFilterUsage(redditDataRoomDatabase, executor, postFilterUsage);
+ }
+
+ @Override
+ protected SharedPreferences getDefaultSharedPreferences() {
+ return sharedPreferences;
+ }
+
+ @Override
+ protected CustomThemeWrapper getCustomThemeWrapper() {
+ return customThemeWrapper;
+ }
+
+ @Override
+ protected void applyCustomTheme() {
+ applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java
index d41d318b..37af8c46 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java
@@ -88,7 +88,7 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((ThemeNameItemViewHolder) holder).themeNameTextView.setText(themeName);
holder.itemView.setOnClickListener(view -> {
View dialogView = activity.getLayoutInflater().inflate(R.layout.dialog_edit_name, null);
- EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_name_dialog);
+ EditText themeNameEditText = dialogView.findViewById(R.id.name_edit_text_edit_name_dialog);
themeNameEditText.setText(themeName);
themeNameEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java
new file mode 100644
index 00000000..d6d4c938
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java
@@ -0,0 +1,93 @@
+package ml.docilealligator.infinityforreddit.adapters;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.List;
+
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
+
+public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+ private List<PostFilterUsage> postFilterUsages;
+ private OnItemClickListener onItemClickListener;
+ private Context context;
+
+ public interface OnItemClickListener {
+ void onClick(PostFilterUsage postFilterUsage);
+ }
+
+ public PostFilterUsageRecyclerViewAdapter(Context context,
+ OnItemClickListener onItemClickListener) {
+ this.context = context;
+ this.onItemClickListener = onItemClickListener;
+ }
+
+ @NonNull
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ return new PostFilterUsageViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_filter_usage, parent, false));
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
+ PostFilterUsage postFilterUsage = postFilterUsages.get(position);
+ switch (postFilterUsage.usage) {
+ case PostFilterUsage.HOME_TYPE:
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_home);
+ break;
+ case PostFilterUsage.SUBREDDIT_TYPE:
+ if (postFilterUsage.nameOfUsage.equals(PostFilterUsage.NO_USAGE)) {
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_subreddit_all);
+ } else {
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(context.getString(R.string.post_filter_usage_subreddit, postFilterUsage.nameOfUsage));
+ }
+ break;
+ case PostFilterUsage.USER_TYPE:
+ if (postFilterUsage.nameOfUsage.equals(PostFilterUsage.NO_USAGE)) {
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_user_all);
+ } else {
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(context.getString(R.string.post_filter_usage_user, postFilterUsage.nameOfUsage));
+ }
+ break;
+ case PostFilterUsage.MULTIREDDIT_TYPE:
+ if (postFilterUsage.nameOfUsage.equals(PostFilterUsage.NO_USAGE)) {
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_multireddit_all);
+ } else {
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(context.getString(R.string.post_filter_usage_multireddit, postFilterUsage.nameOfUsage));
+ }
+ break;
+ case PostFilterUsage.SEARCH_TYPE:
+ ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_search);
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return postFilterUsages == null ? 0 : postFilterUsages.size();
+ }
+
+ public void setPostFilterUsages(List<PostFilterUsage> postFilterUsages) {
+ this.postFilterUsages = postFilterUsages;
+ notifyDataSetChanged();
+ }
+
+ private class PostFilterUsageViewHolder extends RecyclerView.ViewHolder {
+ TextView usageTextView;
+
+ public PostFilterUsageViewHolder(@NonNull View itemView) {
+ super(itemView);
+ usageTextView = (TextView) itemView;
+
+ usageTextView.setOnClickListener(view -> {
+ onItemClickListener.onClick(postFilterUsages.get(getAdapterPosition()));
+ });
+ }
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java
new file mode 100644
index 00000000..fed822c4
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java
@@ -0,0 +1,79 @@
+package ml.docilealligator.infinityforreddit.bottomsheetfragments;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+
+import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity;
+import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
+
+public class NewPostFilterUsageBottomSheetFragment extends RoundedBottomSheetDialogFragment {
+
+ @BindView(R.id.home_text_view_new_post_filter_usage_bottom_sheet_fragment)
+ TextView homeTextView;
+ @BindView(R.id.subreddit_text_view_new_post_filter_usage_bottom_sheet_fragment)
+ TextView subredditTextView;
+ @BindView(R.id.user_text_view_new_post_filter_usage_bottom_sheet_fragment)
+ TextView userTextView;
+ @BindView(R.id.multireddit_text_view_new_post_filter_usage_bottom_sheet_fragment)
+ TextView multiRedditTextView;
+ @BindView(R.id.search_text_view_new_post_filter_usage_bottom_sheet_fragment)
+ TextView searchTextView;
+ private PostFilterUsageListingActivity activity;
+
+ public NewPostFilterUsageBottomSheetFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View rootView = inflater.inflate(R.layout.fragment_new_post_filter_usage_bottom_sheet, container, false);
+
+ ButterKnife.bind(this, rootView);
+
+ homeTextView.setOnClickListener(view -> {
+ activity.newPostFilterUsage(PostFilterUsage.HOME_TYPE);
+ dismiss();
+ });
+
+ subredditTextView.setOnClickListener(view -> {
+ activity.newPostFilterUsage(PostFilterUsage.SUBREDDIT_TYPE);
+ dismiss();
+ });
+
+ userTextView.setOnClickListener(view -> {
+ activity.newPostFilterUsage(PostFilterUsage.USER_TYPE);
+ dismiss();
+ });
+
+ multiRedditTextView.setOnClickListener(view -> {
+ activity.newPostFilterUsage(PostFilterUsage.MULTIREDDIT_TYPE);
+ dismiss();
+ });
+
+ searchTextView.setOnClickListener(view -> {
+ activity.newPostFilterUsage(PostFilterUsage.SEARCH_TYPE);
+ dismiss();
+ });
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (PostFilterUsageListingActivity) context;
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java
new file mode 100644
index 00000000..6e9ccd15
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java
@@ -0,0 +1,66 @@
+package ml.docilealligator.infinityforreddit.bottomsheetfragments;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+
+import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity;
+import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
+
+public class PostFilterUsageOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment {
+
+ public static final String EXTRA_POST_FILTER_USAGE = "EPFU";
+
+ @BindView(R.id.edit_text_view_post_filter_usage_options_bottom_sheet_fragment)
+ TextView editTextView;
+ @BindView(R.id.delete_text_view_post_filter_usage_options_bottom_sheet_fragment)
+ TextView deleteTextView;
+ private PostFilterUsageListingActivity activity;
+
+ public PostFilterUsageOptionsBottomSheetFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View rootView = inflater.inflate(R.layout.fragment_post_filter_usage_options_bottom_sheet, container, false);
+
+ ButterKnife.bind(this, rootView);
+
+ PostFilterUsage postFilterUsage = getArguments().getParcelable(EXTRA_POST_FILTER_USAGE);
+
+ if (postFilterUsage.usage == PostFilterUsage.HOME_TYPE || postFilterUsage.usage == PostFilterUsage.SEARCH_TYPE) {
+ editTextView.setVisibility(View.GONE);
+ } else {
+ editTextView.setOnClickListener(view -> {
+ activity.editPostFilterUsage(postFilterUsage);
+ dismiss();
+ });
+ }
+
+ deleteTextView.setOnClickListener(view -> {
+ activity.deletePostFilterUsage(postFilterUsage);
+ dismiss();
+ });
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (PostFilterUsageListingActivity) context;
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java
new file mode 100644
index 00000000..468c0498
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java
@@ -0,0 +1,16 @@
+package ml.docilealligator.infinityforreddit.postfilter;
+
+import java.util.concurrent.Executor;
+
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+
+public class DeletePostFilter {
+ public static void deletePostFilter(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, PostFilter postFilter) {
+ executor.execute(new Runnable() {
+ @Override
+ public void run() {
+ redditDataRoomDatabase.postFilterDao().deletePostFilter(postFilter);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java
new file mode 100644
index 00000000..5e465afc
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java
@@ -0,0 +1,12 @@
+package ml.docilealligator.infinityforreddit.postfilter;
+
+import java.util.concurrent.Executor;
+
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+
+public class DeletePostFilterUsage {
+ public static void deletePostFilterUsage(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor,
+ PostFilterUsage postFilterUsage) {
+ executor.execute(() -> redditDataRoomDatabase.postFilterUsageDao().deletePostFilterUsage(postFilterUsage));
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java
index 05cf05cc..558abeeb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java
@@ -1,5 +1,8 @@
package ml.docilealligator.infinityforreddit.postfilter;
+import android.os.Parcel;
+import android.os.Parcelable;
+
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
@@ -8,7 +11,14 @@ import androidx.room.ForeignKey;
@Entity(tableName = "post_filter_usage", primaryKeys = {"name", "usage", "name_of_usage"},
foreignKeys = @ForeignKey(entity = PostFilter.class, parentColumns = "name",
childColumns = "name", onDelete = ForeignKey.CASCADE))
-public class PostFilterUsage {
+public class PostFilterUsage implements Parcelable {
+ public static final int HOME_TYPE = 1;
+ public static final int SUBREDDIT_TYPE = 2;
+ public static final int USER_TYPE = 3;
+ public static final int MULTIREDDIT_TYPE = 4;
+ public static final int SEARCH_TYPE = 5;
+ public static final String NO_USAGE = "--";
+
@NonNull
@ColumnInfo(name = "name")
public String name;
@@ -21,6 +31,40 @@ public class PostFilterUsage {
public PostFilterUsage(@NonNull String name, int usage, String nameOfUsage) {
this.name = name;
this.usage = usage;
- this.nameOfUsage = nameOfUsage;
+ if (nameOfUsage == null || nameOfUsage.equals("")) {
+ this.nameOfUsage = NO_USAGE;
+ } else {
+ this.nameOfUsage = nameOfUsage;
+ }
+ }
+
+ protected PostFilterUsage(Parcel in) {
+ name = in.readString();
+ usage = in.readInt();
+ nameOfUsage = in.readString();
+ }
+
+ public static final Creator<PostFilterUsage> CREATOR = new Creator<PostFilterUsage>() {
+ @Override
+ public PostFilterUsage createFromParcel(Parcel in) {
+ return new PostFilterUsage(in);
+ }
+
+ @Override
+ public PostFilterUsage[] newArray(int size) {
+ return new PostFilterUsage[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int i) {
+ parcel.writeString(name);
+ parcel.writeInt(usage);
+ parcel.writeString(nameOfUsage);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java
index 165df55a..a0ba8843 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java
@@ -1,7 +1,22 @@
package ml.docilealligator.infinityforreddit.postfilter;
+import androidx.lifecycle.LiveData;
import androidx.room.Dao;
+import androidx.room.Delete;
+import androidx.room.Insert;
+import androidx.room.OnConflictStrategy;
+import androidx.room.Query;
+
+import java.util.List;
@Dao
public interface PostFilterUsageDao {
+ @Query("SELECT * FROM post_filter_usage WHERE name = :name")
+ LiveData<List<PostFilterUsage>> getAllPostFilterUsageLiveData(String name);
+
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ void insertPostFilterUsage(PostFilterUsage postFilterUsage);
+
+ @Delete
+ void deletePostFilterUsage(PostFilterUsage postFilterUsage);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java
new file mode 100644
index 00000000..f63ed46a
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java
@@ -0,0 +1,38 @@
+package ml.docilealligator.infinityforreddit.postfilter;
+
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.ViewModel;
+import androidx.lifecycle.ViewModelProvider;
+
+import java.util.List;
+
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+
+public class PostFilterUsageViewModel extends ViewModel {
+ private LiveData<List<PostFilterUsage>> mPostFilterUsageListLiveData;
+
+ public PostFilterUsageViewModel(RedditDataRoomDatabase redditDataRoomDatabase, String name) {
+ mPostFilterUsageListLiveData = redditDataRoomDatabase.postFilterUsageDao().getAllPostFilterUsageLiveData(name);
+ }
+
+ public LiveData<List<PostFilterUsage>> getPostFilterUsageListLiveData() {
+ return mPostFilterUsageListLiveData;
+ }
+
+ public static class Factory extends ViewModelProvider.NewInstanceFactory {
+
+ private final RedditDataRoomDatabase mRedditDataRoomDatabase;
+ private final String mName;
+
+ public Factory(RedditDataRoomDatabase redditDataRoomDatabase, String name) {
+ mRedditDataRoomDatabase = redditDataRoomDatabase;
+ mName = name;
+ }
+
+ @Override
+ public <T extends ViewModel> T create(Class<T> modelClass) {
+ //noinspection unchecked
+ return (T) new PostFilterUsageViewModel(mRedditDataRoomDatabase, mName);
+ }
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java
new file mode 100644
index 00000000..567da3b1
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java
@@ -0,0 +1,12 @@
+package ml.docilealligator.infinityforreddit.postfilter;
+
+import java.util.concurrent.Executor;
+
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+
+public class SavePostFilterUsage {
+ public static void savePostFilterUsage(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor,
+ PostFilterUsage postFilterUsage) {
+ executor.execute(() -> redditDataRoomDatabase.postFilterUsageDao().insertPostFilterUsage(postFilterUsage));
+ }
+}
diff --git a/app/src/main/res/layout/activity_post_filter_application.xml b/app/src/main/res/layout/activity_post_filter_application.xml
new file mode 100644
index 00000000..6708bb4e
--- /dev/null
+++ b/app/src/main/res/layout/activity_post_filter_application.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/coordinator_layout_post_filter_application_activity"
+ tools:context=".activities.PostFilterUsageListingActivity">
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:id="@+id/appbar_layout_post_filter_application_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:theme="@style/AppTheme.AppBarOverlay">
+
+ <com.google.android.material.appbar.CollapsingToolbarLayout
+ android:id="@+id/collapsing_toolbar_layout_post_filter_application_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layout_scrollFlags="scroll|enterAlways"
+ app:titleEnabled="false"
+ app:toolbarId="@+id/toolbar_post_filter_application_activity">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar_post_filter_application_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?attr/actionBarSize"
+ app:popupTheme="@style/AppTheme.PopupOverlay"
+ app:navigationIcon="?attr/homeAsUpIndicator" />
+
+ </com.google.android.material.appbar.CollapsingToolbarLayout>
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/recycler_view_post_filter_application_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/fab_post_filter_application_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/fab_margin"
+ android:layout_gravity="bottom|end"
+ app:backgroundTint="?attr/colorPrimaryLightTheme"
+ app:srcCompat="@drawable/ic_add_day_night_24dp"
+ app:tint="@android:color/white" />
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_edit_name.xml b/app/src/main/res/layout/dialog_edit_name.xml
index bfd0cc8c..747d2d32 100644
--- a/app/src/main/res/layout/dialog_edit_name.xml
+++ b/app/src/main/res/layout/dialog_edit_name.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/theme_name_edit_text_edit_name_dialog"
+ android:id="@+id/name_edit_text_edit_name_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="24dp"
diff --git a/app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml b/app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml
new file mode 100644
index 00000000..0b6ffc3f
--- /dev/null
+++ b/app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
+ android:text="@string/edit_post_filter_name_of_usage_info"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/text_input_layout_edit_post_filter_name_of_usage_dialog"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/text_input_edit_text_edit_post_filter_name_of_usage_dialog"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml b/app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml
new file mode 100644
index 00000000..11515ec4
--- /dev/null
+++ b/app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:paddingBottom="8dp"
+ android:overScrollMode="never">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/home_text_view_new_post_filter_usage_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/home"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_home_black_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/subreddit_text_view_new_post_filter_usage_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/subreddit"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_subreddit_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/user_text_view_new_post_filter_usage_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/user"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_user_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/multireddit_text_view_new_post_filter_usage_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/multi_reddit"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_multi_reddit_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/search_text_view_new_post_filter_usage_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/search"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_search_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ </LinearLayout>
+
+</androidx.core.widget.NestedScrollView> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml
new file mode 100644
index 00000000..e4a68585
--- /dev/null
+++ b/app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:paddingBottom="8dp"
+ android:overScrollMode="never">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/edit_text_view_post_filter_usage_options_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/edit"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_edit_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/delete_text_view_post_filter_usage_options_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/delete"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ app:drawableStartCompat="@drawable/ic_delete_24dp"
+ android:drawablePadding="48dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ </LinearLayout>
+
+</androidx.core.widget.NestedScrollView> \ No newline at end of file
diff --git a/app/src/main/res/layout/item_post_filter_usage.xml b/app/src/main/res/layout/item_post_filter_usage.xml
new file mode 100644
index 00000000..62a5e886
--- /dev/null
+++ b/app/src/main/res/layout/item_post_filter_usage.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="72dp"
+ android:paddingEnd="16dp"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_16"
+ android:fontFamily="?attr/font_family"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" /> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4d50431b..008e99e3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -979,5 +979,16 @@
<string name="post_filter_name_hint">Post Filter Name</string>
<string name="post_filter_requires_a_name">What is the name of this post filter?</string>
<string name="apply_post_filter_to">Apply to</string>
+ <string name="post_filter_usage_home">Home</string>
+ <string name="post_filter_usage_subreddit">Subreddit: %1$s</string>
+ <string name="post_filter_usage_subreddit_all">Subreddit</string>
+ <string name="post_filter_usage_user">User: %1$s</string>
+ <string name="post_filter_usage_user_all">User</string>
+ <string name="post_filter_usage_multireddit">MultiReddit: %1$s</string>
+ <string name="post_filter_usage_multireddit_all">MultiReddit</string>
+ <string name="post_filter_usage_search">Search</string>
+ <string name="subreddit">Subreddit</string>
+ <string name="user">User</string>
+ <string name="edit_post_filter_name_of_usage_info">Leave it blank to apply this post filter to all the subreddits / users / multireddits</string>
</resources>