aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java44
-rw-r--r--app/src/main/res/layout/activity_customize_post_filter.xml73
-rw-r--r--app/src/main/res/values/strings.xml1
3 files changed, 74 insertions, 44 deletions
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 959fad63..2432cc09 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java
@@ -101,27 +101,27 @@ public class CustomizePostFilterActivity extends BaseActivity {
fromSettings = getIntent().getBooleanExtra(EXTRA_FROM_SETTINGS, false);
binding.postTypeTextLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
- binding.postTypeTextCheckBoxCustomizePostFilterActivity.performClick();
+ binding.postTypeTextSwitchCustomizePostFilterActivity.performClick();
});
binding.postTypeLinkLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
- binding.postTypeLinkCheckBoxCustomizePostFilterActivity.performClick();
+ binding.postTypeLinkSwitchCustomizePostFilterActivity.performClick();
});
binding.postTypeImageLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
- binding.postTypeImageCheckBoxCustomizePostFilterActivity.performClick();
+ binding.postTypeImageSwitchCustomizePostFilterActivity.performClick();
});
binding.postTypeGifLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
- binding.postTypeGifCheckBoxCustomizePostFilterActivity.performClick();
+ binding.postTypeGifSwitchCustomizePostFilterActivity.performClick();
});
binding.postTypeVideoLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
- binding.postTypeVideoCheckBoxCustomizePostFilterActivity.performClick();
+ binding.postTypeVideoSwitchCustomizePostFilterActivity.performClick();
});
binding.postTypeGalleryLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
- binding.postTypeGalleryCheckBoxCustomizePostFilterActivity.performClick();
+ binding.postTypeGallerySwitchCustomizePostFilterActivity.performClick();
});
binding.onlyNsfwLinearLayoutCustomizePostFilterActivity.setOnClickListener(view -> {
@@ -172,12 +172,12 @@ public class CustomizePostFilterActivity extends BaseActivity {
private void bindView() {
binding.nameTextInputEditTextCustomizePostFilterActivity.setText(postFilter.name);
- binding.postTypeTextCheckBoxCustomizePostFilterActivity.setChecked(postFilter.containTextType);
- binding.postTypeLinkCheckBoxCustomizePostFilterActivity.setChecked(postFilter.containLinkType);
- binding.postTypeImageCheckBoxCustomizePostFilterActivity.setChecked(postFilter.containImageType);
- binding.postTypeGifCheckBoxCustomizePostFilterActivity.setChecked(postFilter.containGifType);
- binding.postTypeVideoCheckBoxCustomizePostFilterActivity.setChecked(postFilter.containVideoType);
- binding.postTypeGalleryCheckBoxCustomizePostFilterActivity.setChecked(postFilter.containGalleryType);
+ binding.postTypeTextSwitchCustomizePostFilterActivity.setChecked(postFilter.containTextType);
+ binding.postTypeLinkSwitchCustomizePostFilterActivity.setChecked(postFilter.containLinkType);
+ binding.postTypeImageSwitchCustomizePostFilterActivity.setChecked(postFilter.containImageType);
+ binding.postTypeGifSwitchCustomizePostFilterActivity.setChecked(postFilter.containGifType);
+ binding.postTypeVideoSwitchCustomizePostFilterActivity.setChecked(postFilter.containVideoType);
+ binding.postTypeGallerySwitchCustomizePostFilterActivity.setChecked(postFilter.containGalleryType);
binding.onlyNsfwSwitchCustomizePostFilterActivity.setChecked(postFilter.onlyNSFW);
binding.onlySpoilerSwitchCustomizePostFilterActivity.setChecked(postFilter.onlySpoiler);
binding.titleExcludesStringsTextInputEditTextCustomizePostFilterActivity.setText(postFilter.postTitleExcludesStrings);
@@ -266,13 +266,21 @@ public class CustomizePostFilterActivity extends BaseActivity {
binding.nameTextInputLayoutCustomizePostFilterActivity.setBoxStrokeColor(primaryTextColor);
binding.nameTextInputLayoutCustomizePostFilterActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
binding.nameTextInputEditTextCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.postTypeTextTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_text_24dp, primaryIconColor), null, null, null);
binding.postTypeTextTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.postTypeLinkTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_link, primaryIconColor), null, null, null);
binding.postTypeLinkTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.postTypeImageTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_image_24dp, primaryIconColor), null, null, null);
binding.postTypeImageTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.postTypeGifTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_image_24dp, primaryIconColor), null, null, null);
binding.postTypeGifTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.postTypeVideoTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_outline_video_24dp, primaryIconColor), null, null, null);
binding.postTypeVideoTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.postTypeGalleryTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_gallery_24dp, primaryIconColor), null, null, null);
binding.postTypeGalleryTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.onlyNsfwTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_nsfw_on_24dp, primaryIconColor), null, null, null);
binding.onlyNsfwTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
+ binding.onlySpoilerTextViewCustomizePostFilterActivity.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(this, R.drawable.ic_spoiler_black_24dp, primaryIconColor), null, null, null);
binding.onlySpoilerTextViewCustomizePostFilterActivity.setTextColor(primaryTextColor);
binding.titleExcludesStringsTextInputLayoutCustomizePostFilterActivity.setBoxStrokeColor(primaryTextColor);
binding.titleExcludesStringsTextInputLayoutCustomizePostFilterActivity.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor));
@@ -523,12 +531,12 @@ public class CustomizePostFilterActivity extends BaseActivity {
postFilter.containFlairs = binding.containsFlairsTextInputEditTextCustomizePostFilterActivity.getText().toString();
postFilter.excludeDomains = binding.excludeDomainsTextInputEditTextCustomizePostFilterActivity.getText().toString();
postFilter.containDomains = binding.containDomainsTextInputEditTextCustomizePostFilterActivity.getText().toString();
- postFilter.containTextType = binding.postTypeTextCheckBoxCustomizePostFilterActivity.isChecked();
- postFilter.containLinkType = binding.postTypeLinkCheckBoxCustomizePostFilterActivity.isChecked();
- postFilter.containImageType = binding.postTypeImageCheckBoxCustomizePostFilterActivity.isChecked();
- postFilter.containGifType = binding.postTypeGifCheckBoxCustomizePostFilterActivity.isChecked();
- postFilter.containVideoType = binding.postTypeVideoCheckBoxCustomizePostFilterActivity.isChecked();
- postFilter.containGalleryType = binding.postTypeGalleryCheckBoxCustomizePostFilterActivity.isChecked();
+ postFilter.containTextType = binding.postTypeTextSwitchCustomizePostFilterActivity.isChecked();
+ postFilter.containLinkType = binding.postTypeLinkSwitchCustomizePostFilterActivity.isChecked();
+ postFilter.containImageType = binding.postTypeImageSwitchCustomizePostFilterActivity.isChecked();
+ postFilter.containGifType = binding.postTypeGifSwitchCustomizePostFilterActivity.isChecked();
+ postFilter.containVideoType = binding.postTypeVideoSwitchCustomizePostFilterActivity.isChecked();
+ postFilter.containGalleryType = binding.postTypeGallerySwitchCustomizePostFilterActivity.isChecked();
postFilter.onlyNSFW = binding.onlyNsfwSwitchCustomizePostFilterActivity.isChecked();
postFilter.onlySpoiler = binding.onlySpoilerSwitchCustomizePostFilterActivity.isChecked();
}
diff --git a/app/src/main/res/layout/activity_customize_post_filter.xml b/app/src/main/res/layout/activity_customize_post_filter.xml
index 5a78b003..e41d0643 100644
--- a/app/src/main/res/layout/activity_customize_post_filter.xml
+++ b/app/src/main/res/layout/activity_customize_post_filter.xml
@@ -64,14 +64,27 @@
</com.google.android.material.textfield.TextInputLayout>
+ <TextView
+ android:id="@+id/post_type_explanation_text_view_customize_post_filter_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:text="@string/post_filter_post_type_explanation"
+ android:textSize="?attr/font_default"
+ android:textColor="?attr/primaryTextColor"
+ android:fontFamily="?attr/font_family" />
+
<LinearLayout
android:id="@+id/post_type_text_linear_layout_customize_post_filter_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
- android:paddingEnd="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -82,12 +95,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/bottom_sheet_post_text"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
- <com.google.android.material.checkbox.MaterialCheckBox
- android:id="@+id/post_type_text_check_box_customize_post_filter_activity"
+ <com.google.android.material.materialswitch.MaterialSwitch
+ android:id="@+id/post_type_text_switch_customize_post_filter_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
@@ -100,8 +114,8 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
- android:paddingEnd="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -112,12 +126,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/bottom_sheet_post_link"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
- <com.google.android.material.checkbox.MaterialCheckBox
- android:id="@+id/post_type_link_check_box_customize_post_filter_activity"
+ <com.google.android.material.materialswitch.MaterialSwitch
+ android:id="@+id/post_type_link_switch_customize_post_filter_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
@@ -130,8 +145,8 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
- android:paddingEnd="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -142,12 +157,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/bottom_sheet_post_image"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
- <com.google.android.material.checkbox.MaterialCheckBox
- android:id="@+id/post_type_image_check_box_customize_post_filter_activity"
+ <com.google.android.material.materialswitch.MaterialSwitch
+ android:id="@+id/post_type_image_switch_customize_post_filter_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
@@ -160,8 +176,8 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
- android:paddingEnd="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -172,12 +188,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/post_type_gif"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
- <com.google.android.material.checkbox.MaterialCheckBox
- android:id="@+id/post_type_gif_check_box_customize_post_filter_activity"
+ <com.google.android.material.materialswitch.MaterialSwitch
+ android:id="@+id/post_type_gif_switch_customize_post_filter_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
@@ -190,8 +207,8 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
- android:paddingEnd="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -202,12 +219,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/bottom_sheet_post_video"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
- <com.google.android.material.checkbox.MaterialCheckBox
- android:id="@+id/post_type_video_check_box_customize_post_filter_activity"
+ <com.google.android.material.materialswitch.MaterialSwitch
+ android:id="@+id/post_type_video_switch_customize_post_filter_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
@@ -220,8 +238,8 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
- android:paddingEnd="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground">
@@ -232,12 +250,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/post_type_gallery"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
- <com.google.android.material.checkbox.MaterialCheckBox
- android:id="@+id/post_type_gallery_check_box_customize_post_filter_activity"
+ <com.google.android.material.materialswitch.MaterialSwitch
+ android:id="@+id/post_type_gallery_switch_customize_post_filter_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
@@ -250,7 +269,7 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
+ android:paddingStart="16dp"
android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
@@ -262,6 +281,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/only_nsfw"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
@@ -280,7 +300,7 @@
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
- android:paddingStart="32dp"
+ android:paddingStart="16dp"
android:paddingEnd="16dp"
android:clickable="true"
android:focusable="true"
@@ -292,6 +312,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
+ android:drawablePadding="32dp"
android:text="@string/only_spoiler"
android:fontFamily="?attr/font_default"
android:textSize="?attr/font_default" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b8575b0c..97086400 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1153,6 +1153,7 @@
<string name="edit_post_filter_name_of_usage_info">Leave it blank to apply this post filter to all the subreddits / users / multireddits</string>
<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="post_filter_post_type_explanation">To see certain types of posts, please turn on the switch corresponding to the types.</string>
<string name="excludes_strings_hint">Exclude keywords (key1,key2)</string>
<string name="comment_filter_name_hint">Comment Filter Name</string>