mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 14:05:40 +03: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
2 changed files with 13 additions and 2 deletions
|
@ -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 a new issue