diff options
author | stefan-niedermann <info@niedermann.it> | 2019-10-13 16:47:44 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-10-13 16:47:44 +0300 |
commit | 134b7ad346577fbd326afb18a3f1e6693d0badb2 (patch) | |
tree | d11c1788065914cb2d5320bb4e71a5c6e359e20c /app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java | |
parent | 44e9f7bd77233de7b045a898036909d8e69209f1 (diff) |
#52 Suggest user and labels in autocomplete when clicking on the EditText
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java index e17311dd2..cf2a6b100 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java @@ -36,17 +36,19 @@ public class LabelAutoCompleteAdapter extends BaseAdapter implements Filterable private SyncManager syncManager; private long accountId; private long boardId; + private long cardId; private LifecycleOwner owner; private Label createLabel; private String createLabelText; private String lastFilterText; private boolean canManage = false; - public LabelAutoCompleteAdapter(@NonNull LifecycleOwner owner, Activity activity, long accountId, long boardId) { + public LabelAutoCompleteAdapter(@NonNull LifecycleOwner owner, Activity activity, long accountId, long boardId, long cardId) { this.owner = owner; this.context = activity; this.accountId = accountId; this.boardId = boardId; + this.cardId = cardId; syncManager = new SyncManager(activity); syncManager.getFullBoardById(accountId, boardId).observe(owner, (fullBoard) -> { if (fullBoard.getBoard().isPermissionManage()) { @@ -111,7 +113,7 @@ public class LabelAutoCompleteAdapter extends BaseAdapter implements Filterable Objects.requireNonNull(((Fragment) owner).getActivity()).runOnUiThread(() -> { LiveData<List<Label>> liveData = constraint.length() > 0 ? syncManager.searchLabelByTitle(accountId, boardId, constraint.toString()) - : syncManager.getLabelSuggestions(accountId, boardId); + : syncManager.findProposalsForLabelsToAssign(accountId, boardId, cardId, 3); observeOnce(liveData, owner, labels -> { if (canManage && constraint.length() > 0) { createLabel.setTitle(String.format(createLabelText, constraint)); |