diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2019-03-11 20:29:18 +0300 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2019-03-11 20:29:18 +0300 |
commit | 785143550b3486007d46da88f9a8477aee8589a9 (patch) | |
tree | 643ea77c2ab5bf8afcd72eacf62cd0597d80df96 /app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java | |
parent | 5efef3a31ad620657efca1ff5268d434418d2438 (diff) |
fix yet another LiveData UI Thread
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java index 541ff5672..b86fbea1b 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/UserAutoCompleteAdapter.java @@ -1,5 +1,6 @@ package it.niedermann.nextcloud.deck.ui.card; +import androidx.fragment.app.Fragment; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LiveData; import android.content.Context; @@ -97,15 +98,17 @@ public class UserAutoCompleteAdapter extends BaseAdapter implements Filterable { protected FilterResults performFiltering(CharSequence constraint) { FilterResults filterResults = new FilterResults(); if (constraint != null) { - LiveDataHelper.onlyIfChanged( - syncManager.searchUserByUidOrDisplayName(accountId, constraint.toString()) - ) - .observe(owner, (List<User> users) -> { - if (users != null) { - filterResults.values = users; - filterResults.count = users.size(); - } - }); + ((Fragment)owner).getActivity().runOnUiThread(() -> { + LiveDataHelper.onlyIfChanged( + syncManager.searchUserByUidOrDisplayName(accountId, constraint.toString()) + ) + .observe(owner, (List<User> users) -> { + if (users != null) { + filterResults.values = users; + filterResults.count = users.size(); + } + }); + }); } return filterResults; } |