mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-20 11:15:02 +01:00
always focus new empty poll option in poll create dialog
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
40f20c56d6
commit
a8afb61745
@ -38,7 +38,8 @@ class PollCreateOptionViewHolder(
|
|||||||
fun bind(
|
fun bind(
|
||||||
pollCreateOptionItem: PollCreateOptionItem,
|
pollCreateOptionItem: PollCreateOptionItem,
|
||||||
itemsListener: PollCreateOptionsItemListener,
|
itemsListener: PollCreateOptionsItemListener,
|
||||||
position: Int
|
position: Int,
|
||||||
|
focus: Boolean
|
||||||
) {
|
) {
|
||||||
|
|
||||||
textListener?.let {
|
textListener?.let {
|
||||||
@ -47,6 +48,10 @@ class PollCreateOptionViewHolder(
|
|||||||
|
|
||||||
binding.pollOptionText.setText(pollCreateOptionItem.pollOption)
|
binding.pollOptionText.setText(pollCreateOptionItem.pollOption)
|
||||||
|
|
||||||
|
if (focus) {
|
||||||
|
binding.pollOptionText.requestFocus()
|
||||||
|
}
|
||||||
|
|
||||||
binding.pollOptionDelete.setOnClickListener {
|
binding.pollOptionDelete.setOnClickListener {
|
||||||
itemsListener.onRemoveOptionsItemClick(pollCreateOptionItem, position)
|
itemsListener.onRemoveOptionsItemClick(pollCreateOptionItem, position)
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,13 @@ class PollCreateOptionsAdapter(
|
|||||||
|
|
||||||
override fun onBindViewHolder(holder: PollCreateOptionViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: PollCreateOptionViewHolder, position: Int) {
|
||||||
val currentItem = list[position]
|
val currentItem = list[position]
|
||||||
holder.bind(currentItem, clickListener, position)
|
var focus = false
|
||||||
|
|
||||||
|
if (list.size - 1 == position && currentItem.pollOption.isBlank()) {
|
||||||
|
focus = true
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.bind(currentItem, clickListener, position, focus)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
|
Loading…
Reference in New Issue
Block a user