mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Optimize layout and make it accessible
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
14d827c88a
commit
09ddc86c40
@ -24,6 +24,7 @@ import android.annotation.SuppressLint
|
|||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.databinding.PollCreateOptionsItemBinding
|
import com.nextcloud.talk.databinding.PollCreateOptionsItemBinding
|
||||||
import com.nextcloud.talk.utils.EmojiTextInputEditText
|
import com.nextcloud.talk.utils.EmojiTextInputEditText
|
||||||
|
|
||||||
@ -43,13 +44,13 @@ class PollCreateOptionViewHolder(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
textListener?.let {
|
textListener?.let {
|
||||||
binding.pollOptionText.removeTextChangedListener(it)
|
binding.pollOptionTextEdit.removeTextChangedListener(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.pollOptionText.setText(pollCreateOptionItem.pollOption)
|
binding.pollOptionTextEdit.setText(pollCreateOptionItem.pollOption)
|
||||||
|
|
||||||
if (focus) {
|
if (focus) {
|
||||||
itemsListener.requestFocus(binding.pollOptionText)
|
itemsListener.requestFocus(binding.pollOptionTextEdit)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.pollOptionDelete.setOnClickListener {
|
binding.pollOptionDelete.setOnClickListener {
|
||||||
@ -57,7 +58,16 @@ class PollCreateOptionViewHolder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
textListener = getTextWatcher(pollCreateOptionItem, itemsListener)
|
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(
|
private fun getTextWatcher(
|
||||||
|
@ -29,7 +29,7 @@ class PollCreateOptionsAdapter(
|
|||||||
private val clickListener: PollCreateOptionsItemListener
|
private val clickListener: PollCreateOptionsItemListener
|
||||||
) : RecyclerView.Adapter<PollCreateOptionViewHolder>() {
|
) : RecyclerView.Adapter<PollCreateOptionViewHolder>() {
|
||||||
|
|
||||||
internal var list: ArrayList<PollCreateOptionItem> = ArrayList<PollCreateOptionItem>()
|
internal var list: ArrayList<PollCreateOptionItem> = ArrayList()
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PollCreateOptionViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PollCreateOptionViewHolder {
|
||||||
val itemBinding = PollCreateOptionsItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
val itemBinding = PollCreateOptionsItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||||
|
@ -102,7 +102,7 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
|||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.pollCreateQuestion.addTextChangedListener(object : TextWatcher {
|
binding.pollCreateQuestionTextEdit.addTextChangedListener(object : TextWatcher {
|
||||||
override fun afterTextChanged(s: Editable) {
|
override fun afterTextChanged(s: Editable) {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
@ -161,8 +161,8 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun requestFocus(textField: EditText) {
|
override fun requestFocus(textField: EditText) {
|
||||||
if (binding.pollCreateQuestion.text.isBlank()) {
|
if (binding.pollCreateQuestionTextEdit.text?.isBlank() == true) {
|
||||||
binding.pollCreateQuestion.requestFocus()
|
binding.pollCreateQuestionTextEdit.requestFocus()
|
||||||
} else {
|
} else {
|
||||||
textField.requestFocus()
|
textField.requestFocus()
|
||||||
}
|
}
|
||||||
|
@ -32,33 +32,51 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="@dimen/dialog_padding">
|
android:paddingTop="@dimen/dialog_padding_top_bottom">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="@dimen/dialog_padding"
|
android:paddingStart="@dimen/dialog_padding"
|
||||||
android:paddingEnd="@dimen/dialog_padding"
|
android:paddingEnd="@dimen/dialog_padding"
|
||||||
|
android:paddingBottom="@dimen/standard_half_padding"
|
||||||
android:text="@string/polls_question"
|
android:text="@string/polls_question"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/poll_create_question"
|
android:id="@+id/poll_create_question_text_input_layout"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/dialog_padding"
|
android:layout_marginStart="@dimen/dialog_padding"
|
||||||
android:layout_marginEnd="@dimen/dialog_padding"
|
android:layout_marginEnd="@dimen/dialog_padding"
|
||||||
android:inputType="textMultiLine"
|
android:hint="@string/polls_question_hint"
|
||||||
tools:ignore="Autofill,LabelFor">
|
android:minHeight="@dimen/min_size_clickable_area"
|
||||||
|
app:boxStrokeColor="@color/colorPrimary"
|
||||||
|
app:errorTextAppearance="@style/ErrorAppearance"
|
||||||
|
app:hintTextColor="@color/colorPrimary">
|
||||||
|
|
||||||
<requestFocus />
|
<com.nextcloud.talk.utils.EmojiTextInputEditText
|
||||||
</EditText>
|
android:id="@+id/poll_create_question_text_edit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAlignment="viewStart">
|
||||||
|
|
||||||
|
<requestFocus />
|
||||||
|
|
||||||
|
</com.nextcloud.talk.utils.EmojiTextInputEditText>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/standard_margin"
|
android:paddingTop="@dimen/standard_padding"
|
||||||
|
android:paddingBottom="@dimen/standard_half_padding"
|
||||||
android:paddingStart="@dimen/dialog_padding"
|
android:paddingStart="@dimen/dialog_padding"
|
||||||
android:paddingEnd="@dimen/dialog_padding"
|
android:paddingEnd="@dimen/dialog_padding"
|
||||||
android:text="@string/polls_options"
|
android:text="@string/polls_options"
|
||||||
@ -77,19 +95,16 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/dialog_padding"
|
android:layout_marginStart="@dimen/dialog_padding"
|
||||||
android:layout_marginTop="@dimen/standard_half_margin"
|
|
||||||
android:layout_marginEnd="@dimen/dialog_padding"
|
android:layout_marginEnd="@dimen/dialog_padding"
|
||||||
android:minHeight="@dimen/min_size_clickable_area"
|
android:minHeight="@dimen/min_size_clickable_area"
|
||||||
android:text="@string/polls_add_option"
|
android:text="@string/polls_add_option"
|
||||||
app:cornerRadius="@dimen/button_corner_radius"
|
app:cornerRadius="@dimen/button_corner_radius"
|
||||||
app:icon="@drawable/ic_add_grey600_24px"
|
app:icon="@drawable/ic_add_grey600_24px" />
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/standard_margin"
|
android:layout_marginTop="@dimen/standard_margin"
|
||||||
android:layout_marginBottom="@dimen/standard_half_margin"
|
|
||||||
android:paddingStart="@dimen/dialog_padding"
|
android:paddingStart="@dimen/dialog_padding"
|
||||||
android:paddingEnd="@dimen/dialog_padding"
|
android:paddingEnd="@dimen/dialog_padding"
|
||||||
android:text="@string/polls_settings"
|
android:text="@string/polls_settings"
|
||||||
@ -119,12 +134,12 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/standard_margin"
|
android:layout_marginTop="@dimen/standard_half_margin"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingStart="@dimen/dialog_padding"
|
android:paddingStart="@dimen/dialog_padding"
|
||||||
android:paddingEnd="@dimen/dialog_padding"
|
android:paddingEnd="@dimen/dialog_padding"
|
||||||
android:paddingBottom="@dimen/standard_padding">
|
android:paddingBottom="@dimen/dialog_padding_top_bottom">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/poll_dismiss"
|
android:id="@+id/poll_dismiss"
|
||||||
|
@ -28,17 +28,32 @@
|
|||||||
android:minHeight="@dimen/min_size_clickable_area"
|
android:minHeight="@dimen/min_size_clickable_area"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingStart="@dimen/dialog_padding"
|
android:paddingStart="@dimen/dialog_padding"
|
||||||
|
android:paddingBottom="@dimen/standard_half_margin"
|
||||||
android:paddingEnd="@dimen/zero"
|
android:paddingEnd="@dimen/zero"
|
||||||
tools:background="@color/white">
|
tools:background="@color/white">
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/poll_option_text"
|
android:id="@+id/poll_option_text_input_layout"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="@dimen/min_size_clickable_area"
|
||||||
|
android:layout_marginEnd="@dimen/standard_half_margin"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:inputType="text"
|
app:boxStrokeColor="@color/colorPrimary"
|
||||||
android:singleLine="true"
|
app:errorTextAppearance="@style/ErrorAppearance"
|
||||||
tools:ignore="Autofill,LabelFor" />
|
app:hintTextColor="@color/colorPrimary">
|
||||||
|
|
||||||
|
<com.nextcloud.talk.utils.EmojiTextInputEditText
|
||||||
|
android:id="@+id/poll_option_text_edit"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="text"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAlignment="viewStart" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/poll_option_delete"
|
android:id="@+id/poll_option_delete"
|
||||||
@ -46,7 +61,7 @@
|
|||||||
android:layout_width="@dimen/min_size_clickable_area"
|
android:layout_width="@dimen/min_size_clickable_area"
|
||||||
android:layout_height="@dimen/min_size_clickable_area"
|
android:layout_height="@dimen/min_size_clickable_area"
|
||||||
android:layout_marginEnd="@dimen/standard_half_margin"
|
android:layout_marginEnd="@dimen/standard_half_margin"
|
||||||
android:contentDescription="@string/nc_action_open_main_menu"
|
android:contentDescription="@string/polls_option_delete"
|
||||||
app:cornerRadius="@dimen/button_corner_radius"
|
app:cornerRadius="@dimen/button_corner_radius"
|
||||||
app:icon="@drawable/ic_baseline_close_24"
|
app:icon="@drawable/ic_baseline_close_24"
|
||||||
app:iconTint="@color/fontAppbar" />
|
app:iconTint="@color/fontAppbar" />
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
<dimen name="standard_half_margin">8dp</dimen>
|
<dimen name="standard_half_margin">8dp</dimen>
|
||||||
<dimen name="default_login_width">400dp</dimen>
|
<dimen name="default_login_width">400dp</dimen>
|
||||||
<dimen name="dialog_padding">24dp</dimen>
|
<dimen name="dialog_padding">24dp</dimen>
|
||||||
|
<dimen name="dialog_padding_top_bottom">18dp</dimen>
|
||||||
|
|
||||||
<dimen name="call_grid_item_min_height">180dp</dimen>
|
<dimen name="call_grid_item_min_height">180dp</dimen>
|
||||||
<dimen name="call_controls_height">110dp</dimen>
|
<dimen name="call_controls_height">110dp</dimen>
|
||||||
|
@ -543,7 +543,10 @@
|
|||||||
<string name="polls_max_votes_reached">You can\'t vote with more options for this poll.</string>
|
<string name="polls_max_votes_reached">You can\'t vote with more options for this poll.</string>
|
||||||
<string name="polls_results_subtitle">Results</string>
|
<string name="polls_results_subtitle">Results</string>
|
||||||
<string name="polls_question">Question</string>
|
<string name="polls_question">Question</string>
|
||||||
|
<string name="polls_question_hint">Your question</string>
|
||||||
<string name="polls_options">Options</string>
|
<string name="polls_options">Options</string>
|
||||||
|
<string name="polls_option_hint">Option %1$s</string>
|
||||||
|
<string name="polls_option_delete">Delete option %1$s</string>
|
||||||
<string name="polls_settings">Settings</string>
|
<string name="polls_settings">Settings</string>
|
||||||
<string name="polls_private_poll">Private poll</string>
|
<string name="polls_private_poll">Private poll</string>
|
||||||
<string name="polls_multiple_answers">Multiple answers</string>
|
<string name="polls_multiple_answers">Multiple answers</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user