From 9978b26ace5596c63aa16d5a86cc8bb30a409aee Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 11:27:25 +0900 Subject: [PATCH] =?UTF-8?q?Base=E3=82=92=E7=B6=99=E6=89=BF=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=82=A2=E3=83=80=E3=83=97=E3=82=BF=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../picker/LacertaFilePickerAdapter.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaFilePickerAdapter.java diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaFilePickerAdapter.java b/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaFilePickerAdapter.java new file mode 100644 index 00000000..fa0163d2 --- /dev/null +++ b/component/common/src/main/java/one/nem/lacerta/component/common/picker/LacertaFilePickerAdapter.java @@ -0,0 +1,33 @@ +package one.nem.lacerta.component.common.picker; + +import one.nem.lacerta.component.common.picker.base.LacertaFilePickerAdapterBase; +import one.nem.lacerta.model.ListItem; +import one.nem.lacerta.model.ListItemType; + +public class LacertaFilePickerAdapter extends LacertaFilePickerAdapterBase { + + // Listener + public interface LacertaFilePickerAdapterListener extends LacertaFilePickerAdapterBase.LacertaFilePickerAdapterListener { + void onDocumentSelected(String documentId); + } + + // Variables + LacertaFilePickerAdapterListener listener; + + // Setter + public LacertaFilePickerAdapter setListener(LacertaFilePickerAdapterListener listener) { + this.listener = listener; + return this; + } + + @Override + public void onBindViewHolder(LacertaFilePickerViewHolder holder, int position) { + super.onBindViewHolder(holder, position); + if (libraryItemPage.getListItems().get(position).getItemType() == ListItemType.ITEM_TYPE_DOCUMENT) { + holder.itemView.setOnClickListener(v -> { + ListItem listItem = libraryItemPage.getListItems().get(position); + listener.onDocumentSelected(listItem.getItemId()); + }); + } + } +}