diff options
author | stefan-niedermann <info@niedermann.it> | 2019-10-13 16:54:36 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-10-13 16:54:36 +0300 |
commit | e1a18fe2b761f4de3bac8871ccc9b86bae238936 (patch) | |
tree | 5ecd2e47ea067387f34e31d90fa736ad1d2b108d /app/src/main/java/it/niedermann/nextcloud/deck/ui/card/LabelAutoCompleteAdapter.java | |
parent | 30c8d0525b6014248e8dbc9fe4087f039b96b94a (diff) |
Use max labels and users suggested from a resource file
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 | 4 |
1 files changed, 3 insertions, 1 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 cf2a6b100..3215b1041 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 @@ -42,6 +42,7 @@ public class LabelAutoCompleteAdapter extends BaseAdapter implements Filterable private String createLabelText; private String lastFilterText; private boolean canManage = false; + private int maxLabelsSuggested; public LabelAutoCompleteAdapter(@NonNull LifecycleOwner owner, Activity activity, long accountId, long boardId, long cardId) { this.owner = owner; @@ -49,6 +50,7 @@ public class LabelAutoCompleteAdapter extends BaseAdapter implements Filterable this.accountId = accountId; this.boardId = boardId; this.cardId = cardId; + this.maxLabelsSuggested = activity.getResources().getInteger(R.integer.max_labels_suggested); syncManager = new SyncManager(activity); syncManager.getFullBoardById(accountId, boardId).observe(owner, (fullBoard) -> { if (fullBoard.getBoard().isPermissionManage()) { @@ -113,7 +115,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.findProposalsForLabelsToAssign(accountId, boardId, cardId, 3); + : syncManager.findProposalsForLabelsToAssign(accountId, boardId, cardId, maxLabelsSuggested); observeOnce(liveData, owner, labels -> { if (canManage && constraint.length() > 0) { createLabel.setTitle(String.format(createLabelText, constraint)); |