Baseを継承したアダプタを作成

This commit is contained in:
r-ca 2024-01-28 11:27:25 +09:00
parent f3afb68b18
commit 9978b26ace
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -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());
});
}
}
}