Skip to content

Commit

Permalink
[nrf noup] Fix issue with spawning multiple DNS-SD queries
Browse files Browse the repository at this point in the history
In some Android SDK versions spawning a DNS-SD query when
a previous one is still in progress results in an error.
Change the device address update condition so that two
identical queries are not sent on entering the sensor
clusters screen, not to generate a failure.
  • Loading branch information
Damian-Nordic committed Sep 10, 2021
1 parent a68983a commit a523f2f
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Toast
Expand Down Expand Up @@ -42,15 +43,11 @@ class SensorClientFragment : Fragment() {
savedInstanceState: Bundle?
): View {
return inflater.inflate(R.layout.sensor_client_fragment, container, false).apply {
deviceIdEd.addTextChangedListener(object : TextWatcher {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty())
return
updateAddress(s.toString())
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit
override fun afterTextChanged(s: Editable?) = Unit
})
deviceIdEd.setOnEditorActionListener { textView, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE)
updateAddress(textView.text.toString())
actionId == EditorInfo.IME_ACTION_DONE
}
clusterNameSpinner.adapter = makeClusterNamesAdapter()
clusterNameSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) = Unit
Expand Down

0 comments on commit a523f2f

Please sign in to comment.