From 679820b96ebae991b667c0bfd845eae6d6e27e48 Mon Sep 17 00:00:00 2001
From: Docile-Alligator <chineseperson5@gmail.com>
Date: Mon, 21 Feb 2022 22:52:22 +0800
Subject: Submitting poll posts is available.

---
 app/src/main/res/drawable-night/ic_poll_24dp.xml   |   9 +
 app/src/main/res/drawable/ic_poll_24dp.xml         |   9 +
 app/src/main/res/layout/activity_post_poll.xml     | 326 +++++++++++++++++++++
 .../res/layout/fragment_post_type_bottom_sheet.xml |  19 ++
 app/src/main/res/menu/post_poll_activity.xml       |  10 +
 app/src/main/res/values/strings.xml                |  11 +
 6 files changed, 384 insertions(+)
 create mode 100644 app/src/main/res/drawable-night/ic_poll_24dp.xml
 create mode 100644 app/src/main/res/drawable/ic_poll_24dp.xml
 create mode 100644 app/src/main/res/layout/activity_post_poll.xml
 create mode 100644 app/src/main/res/menu/post_poll_activity.xml

(limited to 'app/src/main/res')

diff --git a/app/src/main/res/drawable-night/ic_poll_24dp.xml b/app/src/main/res/drawable-night/ic_poll_24dp.xml
new file mode 100644
index 00000000..fa199daf
--- /dev/null
+++ b/app/src/main/res/drawable-night/ic_poll_24dp.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:fillColor="#FFFFFF"
+      android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,5h14v14zM7,10h2v7L7,17zM11,7h2v10h-2zM15,13h2v4h-2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_poll_24dp.xml b/app/src/main/res/drawable/ic_poll_24dp.xml
new file mode 100644
index 00000000..c4033782
--- /dev/null
+++ b/app/src/main/res/drawable/ic_poll_24dp.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:fillColor="#000000"
+      android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,5h14v14zM7,10h2v7L7,17zM11,7h2v10h-2zM15,13h2v4h-2z"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_post_poll.xml b/app/src/main/res/layout/activity_post_poll.xml
new file mode 100644
index 00000000..3d12d616
--- /dev/null
+++ b/app/src/main/res/layout/activity_post_poll.xml
@@ -0,0 +1,326 @@
+<?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:id="@+id/coordinator_layout_post_poll_activity"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:application=".PostPollActivity">
+
+    <com.google.android.material.appbar.AppBarLayout
+        android:id="@+id/appbar_layout_post_poll_activity"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:theme="@style/AppTheme.AppBarOverlay">
+
+        <androidx.appcompat.widget.Toolbar
+            android:id="@+id/toolbar_post_poll_activity"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:minHeight="?attr/actionBarSize"
+            app:navigationIcon="?attr/homeAsUpIndicator"
+            app:popupTheme="@style/AppTheme.PopupOverlay" />
+
+    </com.google.android.material.appbar.AppBarLayout>
+
+    <androidx.core.widget.NestedScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        app:layout_behavior="@string/appbar_scrolling_view_behavior">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingTop="8dp"
+                android:paddingBottom="8dp">
+
+                <pl.droidsonroids.gif.GifImageView
+                    android:id="@+id/subreddit_icon_gif_image_view_post_poll_activity"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp"
+                    android:layout_alignParentStart="true"
+                    android:layout_centerVertical="true"
+                    android:layout_marginStart="16dp" />
+
+                <TextView
+                    android:id="@+id/subreddit_name_text_view_post_poll_activity"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerVertical="true"
+                    android:layout_marginStart="32dp"
+                    android:layout_toStartOf="@id/rules_button_post_poll_activity"
+                    android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_poll_activity"
+                    android:text="@string/choose_a_subreddit"
+                    android:textSize="?attr/font_default"
+                    android:fontFamily="?attr/font_family" />
+
+                <com.google.android.material.button.MaterialButton
+                    android:id="@+id/rules_button_post_poll_activity"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentEnd="true"
+                    android:layout_centerVertical="true"
+                    android:layout_marginStart="16dp"
+                    android:layout_marginEnd="16dp"
+                    android:text="@string/rules"
+                    android:textSize="?attr/font_default"
+                    android:fontFamily="?attr/font_family" />
+
+            </RelativeLayout>
+
+            <com.google.android.material.divider.MaterialDivider
+                android:id="@+id/divider_1_post_poll_activity"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <com.libRG.CustomTextView
+                    android:id="@+id/flair_custom_text_view_post_poll_activity"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="16dp"
+                    android:padding="4dp"
+                    android:text="@string/flair"
+                    android:textColor="?attr/primaryTextColor"
+                    android:textSize="?attr/font_default"
+                    android:fontFamily="?attr/font_family"
+                    android:visibility="gone"
+                    app:lib_setRadius="6dp"
+                    app:lib_setRoundedView="true"
+                    app:lib_setShape="rectangle" />
+
+                <com.libRG.CustomTextView
+                    android:id="@+id/spoiler_custom_text_view_post_poll_activity"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="16dp"
+                    android:padding="4dp"
+                    android:text="@string/spoiler"
+                    android:textColor="?attr/primaryTextColor"
+                    android:textSize="?attr/font_default"
+                    android:fontFamily="?attr/font_family"
+                    app:lib_setRadius="6dp"
+                    app:lib_setRoundedView="true"
+                    app:lib_setShape="rectangle" />
+
+                <com.libRG.CustomTextView
+                    android:id="@+id/nsfw_custom_text_view_post_poll_activity"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="16dp"
+                    android:padding="4dp"
+                    android:text="@string/nsfw"
+                    android:textColor="?attr/primaryTextColor"
+                    android:textSize="?attr/font_default"
+                    android:fontFamily="?attr/font_family"
+                    app:lib_setRadius="6dp"
+                    app:lib_setRoundedView="true"
+                    app:lib_setShape="rectangle" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/receive_post_reply_notifications_linear_layout_post_poll_activity"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                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_poll_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_poll_activity"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center_vertical"
+                    android:checked="true" />
+
+            </LinearLayout>
+
+            <com.google.android.material.divider.MaterialDivider
+                android:id="@+id/divider_2_post_poll_activity"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
+
+            <EditText
+                android:id="@+id/post_title_edit_text_post_poll_activity"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="#00000000"
+                android:gravity="top"
+                android:hint="@string/post_title_hint"
+                android:inputType="textCapSentences|textMultiLine"
+                android:padding="16dp"
+                android:textColor="?attr/primaryTextColor"
+                android:textSize="?attr/title_font_18"
+                android:fontFamily="?attr/title_font_family" />
+
+            <com.google.android.material.divider.MaterialDivider
+                android:id="@+id/divider_3_post_poll_activity"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
+
+            <TextView
+                android:id="@+id/voting_length_text_view_post_poll_activity"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:padding="16dp"
+                android:textSize="?attr/font_default"
+                android:fontFamily="?attr/font_family" />
+
+            <com.google.android.material.slider.Slider
+                android:id="@+id/voting_length_seek_bar_post_poll_activity"
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:padding="16dp"
+                android:valueFrom="1"
+                android:valueTo="7"
+                android:stepSize="1"
+                android:value="3" />
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/option_1_text_input_layout_post_poll_activity"
+                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/option_1_text_input_layout_edit_text_post_poll_activity"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:fontFamily="?attr/font_family"
+                    android:textSize="?attr/font_default"
+                    android:hint="@string/option_1_hint" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/option_2_text_input_layout_post_poll_activity"
+                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/option_2_text_input_layout_edit_text_post_poll_activity"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:fontFamily="?attr/font_family"
+                    android:textSize="?attr/font_default"
+                    android:hint="@string/option_2_hint" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/option_3_text_input_layout_post_poll_activity"
+                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/option_3_text_input_layout_edit_text_post_poll_activity"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:fontFamily="?attr/font_family"
+                    android:textSize="?attr/font_default"
+                    android:hint="@string/option_3_hint" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/option_4_text_input_layout_post_poll_activity"
+                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/option_4_text_input_layout_edit_text_post_poll_activity"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:fontFamily="?attr/font_family"
+                    android:textSize="?attr/font_default"
+                    android:hint="@string/option_4_hint" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/option_5_text_input_layout_post_poll_activity"
+                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/option_5_text_input_layout_edit_text_post_poll_activity"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:fontFamily="?attr/font_family"
+                    android:textSize="?attr/font_default"
+                    android:hint="@string/option_5_hint" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/option_6_text_input_layout_post_poll_activity"
+                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/option_6_text_input_layout_edit_text_post_poll_activity"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:fontFamily="?attr/font_family"
+                    android:textSize="?attr/font_default"
+                    android:hint="@string/option_6_hint" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+        </LinearLayout>
+
+    </androidx.core.widget.NestedScrollView>
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml
index 7138d814..a597db67 100644
--- a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml
+++ b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml
@@ -105,6 +105,25 @@
             android:focusable="true"
             android:background="?attr/selectableItemBackground" />
 
+        <TextView
+            android:id="@+id/poll_type_linear_layout_post_type_bottom_sheet_fragment"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:paddingTop="16dp"
+            android:paddingBottom="16dp"
+            android:paddingStart="32dp"
+            android:paddingEnd="32dp"
+            android:text="@string/bottom_sheet_post_poll"
+            android:textColor="?attr/primaryTextColor"
+            android:textSize="?attr/font_default"
+            android:fontFamily="?attr/font_family"
+            android:drawableStart="@drawable/ic_poll_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/menu/post_poll_activity.xml b/app/src/main/res/menu/post_poll_activity.xml
new file mode 100644
index 00000000..e497c4e5
--- /dev/null
+++ b/app/src/main/res/menu/post_poll_activity.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+    <item
+        android:id="@+id/action_send_post_poll_activity"
+        android:orderInCategory="1"
+        android:title="@string/action_send"
+        android:icon="@drawable/ic_send_toolbar_24dp"
+        app:showAsAction="ifRoom" />
+</menu>
\ 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 5c384e11..e0a00dca 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -44,6 +44,7 @@
     <string name="trending_activity_label">Trending</string>
     <string name="wiki_activity_label">Wiki</string>
     <string name="edit_profile_activity_label">Edit Profile</string>
+    <string name="post_poll_activity_label">Poll Post</string>
 
     <string name="navigation_drawer_open">Open navigation drawer</string>
     <string name="navigation_drawer_close">Close navigation drawer</string>
@@ -197,10 +198,12 @@
     <string name="title_required">The post needs a good title</string>
     <string name="link_required">Hey where is the link?</string>
     <string name="select_an_image">Please select an image first</string>
+    <string name="voting_length">Voting length: %1$d days</string>
     <string name="posting">Posting</string>
     <string name="post_failed">Could not post it</string>
     <string name="error_processing_image">Error processing image</string>
     <string name="error_processing_video">Error processing video</string>
+    <string name="two_options_required">A good poll needs two or more options!</string>
 
     <string name="download_started">Download Started. Check the notification for progress.</string>
 
@@ -229,6 +232,7 @@
     <string name="bottom_sheet_post_image">Image</string>
     <string name="bottom_sheet_post_video">Video</string>
     <string name="bottom_sheet_post_gallery">Gallery</string>
+    <string name="bottom_sheet_post_poll">Poll</string>
     <string name="post_type_gif">Gif</string>
     <string name="post_type_gallery">Gallery</string>
 
@@ -1271,5 +1275,12 @@
     <string name="user_agreement_message">You need to agree to Reddit User Agreement (%1$s) and Infinity for Reddit\'s Privacy Policy (%2$s) before logging in.</string>
     <string name="agree">Agree</string>
     <string name="do_not_agree">Don\'t Agree</string>
+    
+    <string name="option_1_hint">Option 1 (Required)</string>
+    <string name="option_2_hint">Option 2 (Required)</string>
+    <string name="option_3_hint">Option 3</string>
+    <string name="option_4_hint">Option 4</string>
+    <string name="option_5_hint">Option 5</string>
+    <string name="option_6_hint">Option 6</string>
 
 </resources>
-- 
cgit v1.2.3