From bb425ef759b8cceb9e0caa774eeba5fb1987fccc Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 19:22:31 +0200 Subject: [PATCH 01/10] improve poll creating element sizes Signed-off-by: Andy Scherzinger --- .../main/res/layout/dialog_poll_create.xml | 69 ++++++++++++------- .../res/layout/poll_create_options_item.xml | 11 ++- app/src/main/res/values/dimens.xml | 2 + 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/app/src/main/res/layout/dialog_poll_create.xml b/app/src/main/res/layout/dialog_poll_create.xml index 9106aa53c..66f3307d6 100644 --- a/app/src/main/res/layout/dialog_poll_create.xml +++ b/app/src/main/res/layout/dialog_poll_create.xml @@ -1,7 +1,9 @@ + android:orientation="vertical" + tools:background="@color/white"> diff --git a/app/src/main/res/layout/dialog_poll_vote.xml b/app/src/main/res/layout/dialog_poll_vote.xml index c69f0a946..fa1494076 100644 --- a/app/src/main/res/layout/dialog_poll_vote.xml +++ b/app/src/main/res/layout/dialog_poll_vote.xml @@ -59,28 +59,31 @@ + tools:visibility="visible" /> From e767d08755eb83fe5012bf6feeab20c19b685b71 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 19:31:19 +0200 Subject: [PATCH 03/10] make "End poll" a tertiary-action styled button Signed-off-by: Andy Scherzinger --- app/src/main/res/layout/dialog_poll_results.xml | 2 +- app/src/main/res/layout/dialog_poll_vote.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/dialog_poll_results.xml b/app/src/main/res/layout/dialog_poll_results.xml index 6388761fb..e76662d56 100644 --- a/app/src/main/res/layout/dialog_poll_results.xml +++ b/app/src/main/res/layout/dialog_poll_results.xml @@ -46,7 +46,7 @@ Date: Thu, 28 Jul 2022 19:32:50 +0200 Subject: [PATCH 04/10] Bar color should be primary instead of muted different tone Signed-off-by: Andy Scherzinger --- app/src/main/res/layout/poll_result_header_item.xml | 2 +- app/src/main/res/values/colors.xml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/res/layout/poll_result_header_item.xml b/app/src/main/res/layout/poll_result_header_item.xml index 44bfbf364..ed7b9d8c0 100644 --- a/app/src/main/res/layout/poll_result_header_item.xml +++ b/app/src/main/res/layout/poll_result_header_item.xml @@ -48,7 +48,7 @@ android:layout_height="wrap_content" android:layout_marginTop="4dp" android:indeterminate="false" - app:indicatorColor="@color/poll_bar_color" + app:indicatorColor="@color/colorPrimary" app:layout_constraintStart_toStartOf="@+id/poll_option_text" app:layout_constraintTop_toBottomOf="@+id/poll_option_text" app:trackColor="@color/dialog_background" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 2a0d69148..0d5bf97ad 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -106,9 +106,6 @@ #eeeeee #EEEEEE - - #8dd4f6 - #FFFFFF From a70ef7b5723984821d3337ad005a905787f2b9c1 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 19:33:57 +0200 Subject: [PATCH 05/10] Question field should be focused directly Signed-off-by: Andy Scherzinger --- app/src/main/res/layout/dialog_poll_create.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/dialog_poll_create.xml b/app/src/main/res/layout/dialog_poll_create.xml index 66f3307d6..5d9e150c5 100644 --- a/app/src/main/res/layout/dialog_poll_create.xml +++ b/app/src/main/res/layout/dialog_poll_create.xml @@ -49,7 +49,10 @@ android:layout_marginStart="@dimen/standard_margin" android:layout_marginEnd="@dimen/standard_margin" android:inputType="textMultiLine" - tools:ignore="Autofill,LabelFor" /> + tools:ignore="Autofill,LabelFor"> + + + Date: Thu, 28 Jul 2022 19:43:30 +0200 Subject: [PATCH 06/10] Dialogs have a 24dp outer spacing Signed-off-by: Andy Scherzinger --- .../main/res/layout/dialog_poll_create.xml | 27 ++++++++++--------- .../res/layout/poll_create_options_item.xml | 4 +-- app/src/main/res/values/dimens.xml | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/res/layout/dialog_poll_create.xml b/app/src/main/res/layout/dialog_poll_create.xml index 5d9e150c5..f48baaa2a 100644 --- a/app/src/main/res/layout/dialog_poll_create.xml +++ b/app/src/main/res/layout/dialog_poll_create.xml @@ -31,13 +31,14 @@ + android:orientation="vertical" + android:paddingTop="@dimen/dialog_padding"> @@ -46,8 +47,8 @@ android:id="@+id/poll_create_question" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/standard_margin" - android:layout_marginEnd="@dimen/standard_margin" + android:layout_marginStart="@dimen/dialog_padding" + android:layout_marginEnd="@dimen/dialog_padding" android:inputType="textMultiLine" tools:ignore="Autofill,LabelFor"> @@ -58,8 +59,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/standard_margin" - android:paddingStart="@dimen/standard_padding" - android:paddingEnd="@dimen/standard_padding" + android:paddingStart="@dimen/dialog_padding" + android:paddingEnd="@dimen/dialog_padding" android:text="@string/polls_options" android:textColor="@color/colorPrimary" android:textStyle="bold" /> @@ -75,9 +76,9 @@ style="@style/OutlinedButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/standard_margin" + android:layout_marginStart="@dimen/dialog_padding" android:layout_marginTop="@dimen/standard_half_margin" - android:layout_marginEnd="@dimen/standard_margin" + android:layout_marginEnd="@dimen/dialog_padding" android:minHeight="@dimen/min_size_clickable_area" android:text="@string/polls_add_option" app:cornerRadius="@dimen/button_corner_radius" @@ -89,8 +90,8 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/standard_margin" android:layout_marginBottom="@dimen/standard_half_margin" - android:paddingStart="@dimen/standard_padding" - android:paddingEnd="@dimen/standard_padding" + android:paddingStart="@dimen/dialog_padding" + android:paddingEnd="@dimen/dialog_padding" android:text="@string/polls_settings" android:textColor="@color/colorPrimary" android:textStyle="bold" /> @@ -121,8 +122,8 @@ android:layout_marginTop="@dimen/standard_margin" android:gravity="end" android:orientation="horizontal" - android:paddingStart="@dimen/standard_padding" - android:paddingEnd="@dimen/standard_padding" + android:paddingStart="@dimen/dialog_padding" + android:paddingEnd="@dimen/dialog_padding" android:paddingBottom="@dimen/standard_padding"> @@ -45,7 +45,7 @@ style="@style/Widget.AppTheme.Button.IconButton" android:layout_width="@dimen/min_size_clickable_area" android:layout_height="@dimen/min_size_clickable_area" - android:layout_marginStart="5dp" + android:layout_marginEnd="@dimen/standard_half_margin" android:contentDescription="@string/nc_action_open_main_menu" app:cornerRadius="@dimen/button_corner_radius" app:icon="@drawable/ic_baseline_close_24" diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 9b286236b..9962226da 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -59,6 +59,7 @@ 8dp 8dp 400dp + 24dp 180dp 110dp @@ -71,7 +72,7 @@ 40dp 2dp - 10dp + 18dp 50dp From 09ddc86c40dba65995f64b5ec2f6123daea5e25c Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 22:22:51 +0200 Subject: [PATCH 07/10] Optimize layout and make it accessible Signed-off-by: Andy Scherzinger --- .../adapters/PollCreateOptionViewHolder.kt | 18 ++++++-- .../adapters/PollCreateOptionsAdapter.kt | 2 +- .../talk/polls/ui/PollCreateDialogFragment.kt | 6 +-- .../main/res/layout/dialog_poll_create.xml | 43 +++++++++++++------ .../res/layout/poll_create_options_item.xml | 27 +++++++++--- app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/strings.xml | 3 ++ 7 files changed, 72 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt index 6d40969dc..91afdd16c 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionViewHolder.kt @@ -24,6 +24,7 @@ import android.annotation.SuppressLint import android.text.Editable import android.text.TextWatcher import androidx.recyclerview.widget.RecyclerView +import com.nextcloud.talk.R import com.nextcloud.talk.databinding.PollCreateOptionsItemBinding import com.nextcloud.talk.utils.EmojiTextInputEditText @@ -43,13 +44,13 @@ class PollCreateOptionViewHolder( ) { textListener?.let { - binding.pollOptionText.removeTextChangedListener(it) + binding.pollOptionTextEdit.removeTextChangedListener(it) } - binding.pollOptionText.setText(pollCreateOptionItem.pollOption) + binding.pollOptionTextEdit.setText(pollCreateOptionItem.pollOption) if (focus) { - itemsListener.requestFocus(binding.pollOptionText) + itemsListener.requestFocus(binding.pollOptionTextEdit) } binding.pollOptionDelete.setOnClickListener { @@ -57,7 +58,16 @@ class PollCreateOptionViewHolder( } textListener = getTextWatcher(pollCreateOptionItem, itemsListener) - binding.pollOptionText.addTextChangedListener(textListener) + binding.pollOptionTextEdit.addTextChangedListener(textListener) + binding.pollOptionTextInputLayout.hint = String.format( + binding.pollOptionTextInputLayout.resources.getString(R.string.polls_option_hint), + position + 1 + ) + + binding.pollOptionDelete.contentDescription = String.format( + binding.pollOptionTextInputLayout.resources.getString(R.string.polls_option_delete), + position + 1 + ) } private fun getTextWatcher( diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionsAdapter.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionsAdapter.kt index 39c8f7d7f..e827a56a6 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionsAdapter.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollCreateOptionsAdapter.kt @@ -29,7 +29,7 @@ class PollCreateOptionsAdapter( private val clickListener: PollCreateOptionsItemListener ) : RecyclerView.Adapter() { - internal var list: ArrayList = ArrayList() + internal var list: ArrayList = ArrayList() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PollCreateOptionViewHolder { val itemBinding = PollCreateOptionsItemBinding.inflate(LayoutInflater.from(parent.context), parent, false) diff --git a/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt index cdaa8fa58..e94f1e750 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/ui/PollCreateDialogFragment.kt @@ -102,7 +102,7 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener dismiss() } - binding.pollCreateQuestion.addTextChangedListener(object : TextWatcher { + binding.pollCreateQuestionTextEdit.addTextChangedListener(object : TextWatcher { override fun afterTextChanged(s: Editable) { // unused atm } @@ -161,8 +161,8 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener } override fun requestFocus(textField: EditText) { - if (binding.pollCreateQuestion.text.isBlank()) { - binding.pollCreateQuestion.requestFocus() + if (binding.pollCreateQuestionTextEdit.text?.isBlank() == true) { + binding.pollCreateQuestionTextEdit.requestFocus() } else { textField.requestFocus() } diff --git a/app/src/main/res/layout/dialog_poll_create.xml b/app/src/main/res/layout/dialog_poll_create.xml index f48baaa2a..da0fe5f7f 100644 --- a/app/src/main/res/layout/dialog_poll_create.xml +++ b/app/src/main/res/layout/dialog_poll_create.xml @@ -32,33 +32,51 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingTop="@dimen/dialog_padding"> + android:paddingTop="@dimen/dialog_padding_top_bottom"> - + android:hint="@string/polls_question_hint" + android:minHeight="@dimen/min_size_clickable_area" + app:boxStrokeColor="@color/colorPrimary" + app:errorTextAppearance="@style/ErrorAppearance" + app:hintTextColor="@color/colorPrimary"> - - + + + + + + + + app:icon="@drawable/ic_add_grey600_24px" /> + android:paddingBottom="@dimen/dialog_padding_top_bottom"> - + app:boxStrokeColor="@color/colorPrimary" + app:errorTextAppearance="@style/ErrorAppearance" + app:hintTextColor="@color/colorPrimary"> + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 9962226da..9f4ad1f17 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -60,6 +60,7 @@ 8dp 400dp 24dp + 18dp 180dp 110dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ec961c518..bffdd4c13 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -543,7 +543,10 @@ You can\'t vote with more options for this poll. Results Question + Your question Options + Option %1$s + Delete option %1$s Settings Private poll Multiple answers From bb822aa1a472a59ac0478a304568c445a33c67d0 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 23:14:46 +0200 Subject: [PATCH 08/10] Change vote submitting string Signed-off-by: Andy Scherzinger --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bffdd4c13..e67af0332 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -537,7 +537,7 @@ Add option Edit vote Vote - Successfully voted + Vote submitted End poll Do you really want to end this poll? This can\'t be undone. You can\'t vote with more options for this poll. From 0a3e0230c9fa0554b5babf25815f411d5815f6c8 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 23:15:18 +0200 Subject: [PATCH 09/10] fix avatar voter border Signed-off-by: Andy Scherzinger --- .../polls/adapters/PollResultVotersOverviewViewHolder.kt | 6 +++--- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt index c3805afe1..d071cc76b 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/adapters/PollResultVotersOverviewViewHolder.kt @@ -72,10 +72,10 @@ class PollResultVotersOverviewViewHolder( roundingParams.roundAsCircle = true roundingParams.borderColor = ResourcesCompat.getColor( itemView.context.resources!!, - R.color.colorPrimary, + R.color.vote_dialog_background, null ) - roundingParams.borderWidth = 2.0f + roundingParams.borderWidth = DisplayUtils.convertDpToPixel(2.0f, itemView.context) avatar.hierarchy.roundingParams = roundingParams avatar.controller = getAvatarDraweeController(pollDetails) @@ -134,7 +134,7 @@ class PollResultVotersOverviewViewHolder( const val AVATAR_SIZE = 60 const val AVATAR_RADIUS = 5f const val MAX_AVATARS = 10 - const val AVATAR_OFFSET = AVATAR_SIZE - 10 + const val AVATAR_OFFSET = AVATAR_SIZE - 20 const val DOTS_OFFSET = 70 const val DOTS_TEXT = "…" } diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 6c2a769c8..86f4044a5 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -75,4 +75,5 @@ #818181 #353535 + #424242 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0d5bf97ad..2993412c9 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -109,5 +109,6 @@ #FFFFFF + #FFFFFF From ba83552be836c975d703c213a0023ff5fd8c1ee6 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Thu, 28 Jul 2022 23:15:42 +0200 Subject: [PATCH 10/10] fix button positioning Signed-off-by: Andy Scherzinger --- app/src/main/res/layout/dialog_poll_vote.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/dialog_poll_vote.xml b/app/src/main/res/layout/dialog_poll_vote.xml index 25b11683b..2ce6d32e3 100644 --- a/app/src/main/res/layout/dialog_poll_vote.xml +++ b/app/src/main/res/layout/dialog_poll_vote.xml @@ -55,6 +55,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/standard_margin" + android:layout_marginEnd="4dp" android:gravity="end">