Skip to content

Commit

Permalink
Show dropdown once answer is cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
FikriMilano committed Jan 28, 2025
1 parent fcf841e commit 814b8ac
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import android.widget.ArrayAdapter
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.doOnLayout
import androidx.core.view.doOnNextLayout
import androidx.lifecycle.lifecycleScope
import com.google.android.fhir.datacapture.R
import com.google.android.fhir.datacapture.extensions.displayString
Expand All @@ -44,8 +46,11 @@ import com.google.android.fhir.datacapture.views.HeaderView
import com.google.android.fhir.datacapture.views.QuestionnaireViewItem
import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.textfield.TextInputLayout
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.hl7.fhir.r4.model.QuestionnaireResponse
import timber.log.Timber

Expand Down Expand Up @@ -75,6 +80,7 @@ internal object DropDownViewHolderFactory :
context.lifecycleScope.launch {
delay(200) // to show ripple effect on the icon before clearing the answer
questionnaireViewItem.clearAnswer()
autoCompleteTextView.doOnNextLayout { autoCompleteTextView.showDropDown() }
}
}
}
Expand Down

0 comments on commit 814b8ac

Please sign in to comment.