mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
initially add 2 option fields and focus question field
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
ca0c045e8d
commit
ba6cc7170b
@ -49,7 +49,7 @@ class PollCreateOptionViewHolder(
|
||||
binding.pollOptionText.setText(pollCreateOptionItem.pollOption)
|
||||
|
||||
if (focus) {
|
||||
binding.pollOptionText.requestFocus()
|
||||
itemsListener.requestFocus(binding.pollOptionText)
|
||||
}
|
||||
|
||||
binding.pollOptionDelete.setOnClickListener {
|
||||
|
@ -20,9 +20,13 @@
|
||||
|
||||
package com.nextcloud.talk.polls.adapters
|
||||
|
||||
import android.widget.EditText
|
||||
|
||||
interface PollCreateOptionsItemListener {
|
||||
|
||||
fun onRemoveOptionsItemClick(pollCreateOptionItem: PollCreateOptionItem, position: Int)
|
||||
|
||||
fun onOptionsItemTextChanged(pollCreateOptionItem: PollCreateOptionItem)
|
||||
|
||||
fun requestFocus(textField: EditText)
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
@ -89,6 +90,9 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
||||
|
||||
setupListeners()
|
||||
setupStateObserver()
|
||||
|
||||
viewModel.addOption()
|
||||
viewModel.addOption()
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
@ -159,6 +163,14 @@ class PollCreateDialogFragment : DialogFragment(), PollCreateOptionsItemListener
|
||||
viewModel.optionsItemTextChanged()
|
||||
}
|
||||
|
||||
override fun requestFocus(textField: EditText) {
|
||||
if (binding.pollCreateQuestion.text.isBlank()) {
|
||||
binding.pollCreateQuestion.requestFocus()
|
||||
} else {
|
||||
textField.requestFocus()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fragment creator
|
||||
*/
|
||||
|
@ -113,7 +113,7 @@ class PollCreateViewModel @Inject constructor(private val repository: PollReposi
|
||||
roomToken, _question, _options.value!!.map { it.pollOption }, resultMode,
|
||||
maxVotes
|
||||
)
|
||||
?.doOnSubscribe { disposable = it }
|
||||
.doOnSubscribe { disposable = it }
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(PollObserver())
|
||||
|
@ -33,10 +33,12 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/polls_question" />
|
||||
|
||||
<com.nextcloud.talk.utils.EmojiTextInputEditText
|
||||
<EditText
|
||||
android:id="@+id/poll_create_question"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"
|
||||
tools:ignore="Autofill,LabelFor"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user