mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-18 18:25:03 +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(
|
||||
pollCreateOptionItem: PollCreateOptionItem,
|
||||
itemsListener: PollCreateOptionsItemListener,
|
||||
position: Int
|
||||
position: Int,
|
||||
focus: Boolean
|
||||
) {
|
||||
|
||||
textListener?.let {
|
||||
@ -47,6 +48,10 @@ class PollCreateOptionViewHolder(
|
||||
|
||||
binding.pollOptionText.setText(pollCreateOptionItem.pollOption)
|
||||
|
||||
if (focus) {
|
||||
binding.pollOptionText.requestFocus()
|
||||
}
|
||||
|
||||
binding.pollOptionDelete.setOnClickListener {
|
||||
itemsListener.onRemoveOptionsItemClick(pollCreateOptionItem, position)
|
||||
}
|
||||
|
@ -39,7 +39,13 @@ class PollCreateOptionsAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: PollCreateOptionViewHolder, position: Int) {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user