From 2aab94acb40878460dea267b69affffea896dc09 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 15 Nov 2021 14:11:15 +0100
Subject: [PATCH 1/4] Create dedicated file for TextInputLayout styles And
 follow naming convention

---
 .../src/main/res/values/styles_edit_text.xml    | 13 -------------
 .../res/values/styles_text_input_layout.xml     | 17 +++++++++++++++++
 .../main/res/layout/item_form_text_input.xml    |  2 +-
 .../layout/item_form_text_input_with_delete.xml |  2 +-
 4 files changed, 19 insertions(+), 15 deletions(-)
 create mode 100644 library/ui-styles/src/main/res/values/styles_text_input_layout.xml

diff --git a/library/ui-styles/src/main/res/values/styles_edit_text.xml b/library/ui-styles/src/main/res/values/styles_edit_text.xml
index a1a9f6a7e85..8de548dd035 100644
--- a/library/ui-styles/src/main/res/values/styles_edit_text.xml
+++ b/library/ui-styles/src/main/res/values/styles_edit_text.xml
@@ -1,14 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <!-- Default style for TextInputLayout -->
-    <style name="Widget.Vector.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox" />
-
-    <style name="Widget.Vector.TextInputLayout.Password">
-        <item name="endIconMode">password_toggle</item>
-        <item name="endIconTint">?vctr_content_secondary</item>
-    </style>
-
     <style name="Widget.Vector.EditText.Composer" parent="Widget.AppCompat.EditText">
         <item name="android:background">@android:color/transparent</item>
         <item name="android:inputType">textCapSentences|textMultiLine</item>
@@ -19,9 +11,4 @@
         <item name="android:textColor">?vctr_message_text_color</item>
     </style>
 
-    <style name="Widget.Vector.EditText.Form" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
-        <item name="boxStrokeColor">@color/form_edit_text_stroke_color_selector</item>
-        <item name="android:textColorHint">@color/form_edit_text_hint_color_selector</item>
-    </style>
-
 </resources>
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values/styles_text_input_layout.xml b/library/ui-styles/src/main/res/values/styles_text_input_layout.xml
new file mode 100644
index 00000000000..95a406ea5cb
--- /dev/null
+++ b/library/ui-styles/src/main/res/values/styles_text_input_layout.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <!-- Default style for TextInputLayout -->
+    <style name="Widget.Vector.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox" />
+
+    <style name="Widget.Vector.TextInputLayout.Password">
+        <item name="endIconMode">password_toggle</item>
+        <item name="endIconTint">?vctr_content_secondary</item>
+    </style>
+
+    <style name="Widget.Vector.TextInputLayout.Form">
+        <item name="boxStrokeColor">@color/form_edit_text_stroke_color_selector</item>
+        <item name="android:textColorHint">@color/form_edit_text_hint_color_selector</item>
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/vector/src/main/res/layout/item_form_text_input.xml b/vector/src/main/res/layout/item_form_text_input.xml
index a9e76bd68d7..9a8d0357582 100644
--- a/vector/src/main/res/layout/item_form_text_input.xml
+++ b/vector/src/main/res/layout/item_form_text_input.xml
@@ -9,7 +9,7 @@
 
     <com.google.android.material.textfield.TextInputLayout
         android:id="@+id/formTextInputTextInputLayout"
-        style="@style/Widget.Vector.EditText.Form"
+        style="@style/Widget.Vector.TextInputLayout.Form"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginStart="@dimen/layout_horizontal_margin"
diff --git a/vector/src/main/res/layout/item_form_text_input_with_delete.xml b/vector/src/main/res/layout/item_form_text_input_with_delete.xml
index e41dbbf50ba..ba19db4b46e 100644
--- a/vector/src/main/res/layout/item_form_text_input_with_delete.xml
+++ b/vector/src/main/res/layout/item_form_text_input_with_delete.xml
@@ -9,7 +9,7 @@
 
     <com.google.android.material.textfield.TextInputLayout
         android:id="@+id/formTextInputTextInputLayout"
-        style="@style/Widget.Vector.EditText.Form"
+        style="@style/Widget.Vector.TextInputLayout.Form"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginStart="@dimen/layout_horizontal_margin"

From 223b33fa65dde8c2b60fc80a7567d2c6ca3c0d14 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 15 Nov 2021 14:16:22 +0100
Subject: [PATCH 2/4] Create CallToAction button style

---
 .../ui-styles/src/main/res/values/styles_buttons.xml   |  5 +++++
 library/ui-styles/src/main/res/values/styles_polls.xml | 10 ----------
 vector/src/main/res/layout/fragment_create_poll.xml    |  2 +-
 3 files changed, 6 insertions(+), 11 deletions(-)
 delete mode 100644 library/ui-styles/src/main/res/values/styles_polls.xml

diff --git a/library/ui-styles/src/main/res/values/styles_buttons.xml b/library/ui-styles/src/main/res/values/styles_buttons.xml
index ad90469a528..d09d0a399db 100644
--- a/library/ui-styles/src/main/res/values/styles_buttons.xml
+++ b/library/ui-styles/src/main/res/values/styles_buttons.xml
@@ -10,6 +10,11 @@
         <item name="lineHeight">24sp</item>
     </style>
 
+    <style name="Widget.Vector.Button.CallToAction" parent="Widget.Vector.Button">
+        <item name="android:backgroundTint">@color/button_background_tint_selector</item>
+        <item name="android:textColor">@android:color/white</item>
+    </style>
+
     <style name="Widget.Vector.Button.Destructive">
         <item name="android:minWidth">94dp</item>
         <item name="materialThemeOverlay">@style/VectorMaterialThemeOverlayDestructive</item>
diff --git a/library/ui-styles/src/main/res/values/styles_polls.xml b/library/ui-styles/src/main/res/values/styles_polls.xml
deleted file mode 100644
index ac99a6514b2..00000000000
--- a/library/ui-styles/src/main/res/values/styles_polls.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
-   <style name="Widget.Vector.Button.CreatePoll" parent="Widget.Vector.Button">
-       <item name="android:backgroundTint">@color/button_background_tint_selector</item>
-       <item name="android:textAppearance">@style/TextAppearance.Vector.Button</item>
-       <item name="android:textColor">@android:color/white</item>
-   </style>
-
-</resources>
diff --git a/vector/src/main/res/layout/fragment_create_poll.xml b/vector/src/main/res/layout/fragment_create_poll.xml
index 1911aaefc98..ee7dd752eec 100644
--- a/vector/src/main/res/layout/fragment_create_poll.xml
+++ b/vector/src/main/res/layout/fragment_create_poll.xml
@@ -73,7 +73,7 @@
 
     <Button
         android:id="@+id/createPollButton"
-        style="@style/Widget.Vector.Button.CreatePoll"
+        style="@style/Widget.Vector.Button.CallToAction"
         android:layout_width="match_parent"
         android:layout_height="56dp"
         android:layout_margin="16dp"

From 6f13fb1634e3077f749ccb84a647398150b4f0ac Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 15 Nov 2021 14:23:32 +0100
Subject: [PATCH 3/4] Create file for Toast style (more generic) And improve
 fragment_create_poll.xml preview rendering

---
 library/ui-styles/src/main/res/values/colors.xml  |  6 +++---
 .../src/main/res/values/styles_toast.xml          | 15 +++++++++++++++
 .../src/main/res/values/styles_voice_message.xml  | 11 -----------
 .../ui-styles/src/main/res/values/theme_dark.xml  |  3 +--
 .../ui-styles/src/main/res/values/theme_light.xml |  3 +--
 .../src/main/res/layout/fragment_create_poll.xml  |  4 ++--
 6 files changed, 22 insertions(+), 20 deletions(-)
 create mode 100644 library/ui-styles/src/main/res/values/styles_toast.xml

diff --git a/library/ui-styles/src/main/res/values/colors.xml b/library/ui-styles/src/main/res/values/colors.xml
index 03d1ff69db5..9df2794a1a4 100644
--- a/library/ui-styles/src/main/res/values/colors.xml
+++ b/library/ui-styles/src/main/res/values/colors.xml
@@ -129,9 +129,9 @@
     <color name="vctr_chat_effect_snow_background_light">@color/black_alpha</color>
     <color name="vctr_chat_effect_snow_background_dark">@android:color/transparent</color>
 
-    <attr name="vctr_voice_message_toast_background" format="color" />
-    <color name="vctr_voice_message_toast_background_light">@color/palette_black_900</color>
-    <color name="vctr_voice_message_toast_background_dark">@color/palette_gray_400</color>
+    <attr name="vctr_toast_background" format="color" />
+    <color name="vctr_toast_background_light">@color/palette_black_900</color>
+    <color name="vctr_toast_background_dark">@color/palette_gray_400</color>
 
     <!-- Presence Indicator colors -->
     <attr name="vctr_presence_indicator_offline" format="color" />
diff --git a/library/ui-styles/src/main/res/values/styles_toast.xml b/library/ui-styles/src/main/res/values/styles_toast.xml
new file mode 100644
index 00000000000..22f4da7ac0e
--- /dev/null
+++ b/library/ui-styles/src/main/res/values/styles_toast.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <style name="Widget.Vector.TextView.Caption.Toast">
+        <item name="android:paddingTop">8dp</item>
+        <item name="android:paddingBottom">8dp</item>
+        <item name="android:paddingStart">12dp</item>
+        <item name="android:paddingEnd">12dp</item>
+        <item name="android:background">@drawable/bg_round_corner_8dp</item>
+        <item name="android:backgroundTint">?vctr_toast_background</item>
+        <item name="android:textColor">@color/palette_white</item>
+        <item name="android:gravity">center</item>
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values/styles_voice_message.xml b/library/ui-styles/src/main/res/values/styles_voice_message.xml
index 59fea750742..2e87353303d 100644
--- a/library/ui-styles/src/main/res/values/styles_voice_message.xml
+++ b/library/ui-styles/src/main/res/values/styles_voice_message.xml
@@ -12,15 +12,4 @@
         <item name="direction">rightToLeft</item>
     </style>
 
-    <style name="Widget.Vector.TextView.Caption.Toast">
-        <item name="android:paddingTop">8dp</item>
-        <item name="android:paddingBottom">8dp</item>
-        <item name="android:paddingStart">12dp</item>
-        <item name="android:paddingEnd">12dp</item>
-        <item name="android:background">@drawable/bg_round_corner_8dp</item>
-        <item name="android:backgroundTint">?vctr_voice_message_toast_background</item>
-        <item name="android:textColor">@color/palette_white</item>
-        <item name="android:gravity">center</item>
-    </style>
-
 </resources>
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values/theme_dark.xml b/library/ui-styles/src/main/res/values/theme_dark.xml
index d07e3c5297e..4d525f7eee8 100644
--- a/library/ui-styles/src/main/res/values/theme_dark.xml
+++ b/library/ui-styles/src/main/res/values/theme_dark.xml
@@ -140,8 +140,7 @@
         <!-- Keywords -->
         <item name="vctr_keyword_style">@style/Widget.Vector.Keyword</item>
 
-        <!-- Voice Message -->
-        <item name="vctr_voice_message_toast_background">@color/vctr_voice_message_toast_background_dark</item>
+        <item name="vctr_toast_background">@color/vctr_toast_background_dark</item>
     </style>
 
     <style name="Theme.Vector.Dark" parent="Base.Theme.Vector.Dark" />
diff --git a/library/ui-styles/src/main/res/values/theme_light.xml b/library/ui-styles/src/main/res/values/theme_light.xml
index 14ec372f289..790a0bfc7c2 100644
--- a/library/ui-styles/src/main/res/values/theme_light.xml
+++ b/library/ui-styles/src/main/res/values/theme_light.xml
@@ -143,8 +143,7 @@
         <!-- Keywords -->
         <item name="vctr_keyword_style">@style/Widget.Vector.Keyword</item>
 
-        <!-- Voice Message -->
-        <item name="vctr_voice_message_toast_background">@color/vctr_voice_message_toast_background_light</item>
+        <item name="vctr_toast_background">@color/vctr_toast_background_light</item>
     </style>
 
     <style name="Theme.Vector.Light" parent="Base.Theme.Vector.Light" />
diff --git a/vector/src/main/res/layout/fragment_create_poll.xml b/vector/src/main/res/layout/fragment_create_poll.xml
index ee7dd752eec..b82342558c6 100644
--- a/vector/src/main/res/layout/fragment_create_poll.xml
+++ b/vector/src/main/res/layout/fragment_create_poll.xml
@@ -69,7 +69,7 @@
         app:layout_behavior="@string/appbar_scrolling_view_behavior"
         app:layout_constraintBottom_toTopOf="@id/createPollButton"
         app:layout_constraintTop_toBottomOf="@+id/appBarLayout"
-        tools:listitem="@layout/item_profile_action" />
+        tools:listitem="@layout/item_form_text_input_with_delete" />
 
     <Button
         android:id="@+id/createPollButton"
@@ -92,7 +92,7 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        tools:text="@string/voice_message_release_to_send_toast"
+        tools:text="@string/create_poll_empty_question_error"
         tools:visibility="visible" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file

From b58c91b28d52503ab5db45c11ac8b2a8dbd1b0e3 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 15 Nov 2021 14:26:15 +0100
Subject: [PATCH 4/4] Update changelog, since the feature is not visible yet.

---
 changelog.d/4367.feature | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/changelog.d/4367.feature b/changelog.d/4367.feature
index 04db0bd6be2..c001cc778fd 100644
--- a/changelog.d/4367.feature
+++ b/changelog.d/4367.feature
@@ -1 +1 @@
-Poll Feature - Create Poll Screen
\ No newline at end of file
+Poll Feature - Create Poll Screen (Disabled for now)
\ No newline at end of file