aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-14 14:31:54 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-14 14:31:54 +0000
commit9d87277ad89fdb90682723ebc1a05e9540e7493b (patch)
tree366a22226dd1cafb6fa8133359de697695744062
parentd31d348788677288b5e334a4e2b33aa775497ae6 (diff)
downloadinfinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.tar
infinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.tar.gz
infinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.tar.bz2
infinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.tar.lz
infinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.tar.xz
infinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.tar.zst
infinity-for-reddit-9d87277ad89fdb90682723ebc1a05e9540e7493b.zip
Choose whether receiving post reply notifications or not in PostImageActivity.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java23
-rw-r--r--app/src/main/res/layout/activity_post_image.xml39
2 files changed, 58 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java
index cbab1914..50118777 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java
@@ -16,6 +16,7 @@ import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -33,6 +34,7 @@ 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.snackbar.Snackbar;
+import com.google.android.material.switchmaterial.SwitchMaterial;
import com.libRG.CustomTextView;
import org.greenrobot.eventbus.EventBus;
@@ -104,10 +106,18 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
CustomTextView nsfwTextView;
@BindView(R.id.divider_2_post_image_activity)
View divider2;
- @BindView(R.id.post_title_edit_text_post_image_activity)
- EditText titleEditText;
+ @BindView(R.id.receive_post_reply_notifications_linear_layout_post_image_activity)
+ LinearLayout receivePostReplyNotificationsLinearLayout;
+ @BindView(R.id.receive_post_reply_notifications_text_view_post_image_activity)
+ TextView receivePostReplyNotificationsTextView;
+ @BindView(R.id.receive_post_reply_notifications_switch_material_post_image_activity)
+ SwitchMaterial receivePostReplyNotificationsSwitchMaterial;
@BindView(R.id.divider_3_post_image_activity)
View divider3;
+ @BindView(R.id.post_title_edit_text_post_image_activity)
+ EditText titleEditText;
+ @BindView(R.id.divider_4_post_image_activity)
+ View divider4;
@BindView(R.id.select_image_constraint_layout_post_image_activity)
ConstraintLayout constraintLayout;
@BindView(R.id.capture_fab_post_image_activity)
@@ -331,6 +341,10 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
}
});
+ receivePostReplyNotificationsLinearLayout.setOnClickListener(view -> {
+ receivePostReplyNotificationsSwitchMaterial.performClick();
+ });
+
captureFab.setOnClickListener(view -> {
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (pictureIntent.resolveActivity(getPackageManager()) != null) {
@@ -381,11 +395,13 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
subredditNameTextView.setTextColor(secondaryTextColor);
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme()));
+ primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
+ receivePostReplyNotificationsTextView.setTextColor(primaryTextColor);
int dividerColor = mCustomThemeWrapper.getDividerColor();
divider1.setBackgroundColor(dividerColor);
divider2.setBackgroundColor(dividerColor);
divider3.setBackgroundColor(dividerColor);
- primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
+ divider4.setBackgroundColor(dividerColor);
flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor();
flairTextColor = mCustomThemeWrapper.getFlairTextColor();
spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor();
@@ -506,6 +522,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);
intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);
intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);
+ intent.putExtra(SubmitPostService.EXTRA_RECEIVE_POST_REPLY_NOTIFICATIONS, receivePostReplyNotificationsSwitchMaterial.isChecked());
String mimeType = getContentResolver().getType(imageUri);
if (mimeType != null && mimeType.contains("gif")) {
intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_VIDEO);
diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml
index cacfd04c..e8ec15e1 100644
--- a/app/src/main/res/layout/activity_post_image.xml
+++ b/app/src/main/res/layout/activity_post_image.xml
@@ -132,6 +132,43 @@
android:layout_width="match_parent"
android:layout_height="1dp" />
+ <LinearLayout
+ android:id="@+id/receive_post_reply_notifications_linear_layout_post_image_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground">
+
+ <TextView
+ android:id="@+id/receive_post_reply_notifications_text_view_post_image_activity"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_gravity="center_vertical"
+ android:layout_marginEnd="16dp"
+ android:text="@string/receive_post_reply_notifications"
+ android:textSize="?attr/font_default"
+ android:fontFamily="?attr/font_family" />
+
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/receive_post_reply_notifications_switch_material_post_image_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:checked="true" />
+
+ </LinearLayout>
+
+ <View
+ android:id="@+id/divider_3_post_image_activity"
+ android:layout_width="match_parent"
+ android:layout_height="1dp" />
+
<EditText
android:id="@+id/post_title_edit_text_post_image_activity"
android:layout_width="match_parent"
@@ -146,7 +183,7 @@
android:fontFamily="?attr/title_font_family" />
<View
- android:id="@+id/divider_3_post_image_activity"
+ android:id="@+id/divider_4_post_image_activity"
android:layout_width="match_parent"
android:layout_height="1dp" />