From 04bd081d997552a610415a26e14d9fa819d936a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 14:17:25 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=BF=E3=83=95=E3=82=A7?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=AB=E8=BF=BD?= =?UTF-8?q?=E5=BE=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/SelectDirDialogItemAdapter.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/SelectDirDialogItemAdapter.java b/component/common/src/main/java/one/nem/lacerta/component/common/SelectDirDialogItemAdapter.java index b9bfddaa..1a34fa22 100644 --- a/component/common/src/main/java/one/nem/lacerta/component/common/SelectDirDialogItemAdapter.java +++ b/component/common/src/main/java/one/nem/lacerta/component/common/SelectDirDialogItemAdapter.java @@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import one.nem.lacerta.model.ListItem; +import one.nem.lacerta.model.ListItemType; public class SelectDirDialogItemAdapter extends RecyclerView.Adapter { @@ -22,7 +23,10 @@ public class SelectDirDialogItemAdapter extends RecyclerView.Adapter listItems) { - this.listItems = listItems; + // 戻るアクションを追加 + this.listItems.add(0, new ListItem("戻る", " ", ListItemType.ITEM_TYPE_ACTION_BACK, null)); + + this.listItems.addAll(listItems); } @NonNull @@ -37,9 +41,11 @@ public class SelectDirDialogItemAdapter extends RecyclerView.Adapter { - listener.onDirSelected(listItem.getTitle(), listItem.getItemId()); - }); + if(listItem.getItemType() == ListItemType.ITEM_TYPE_ACTION_BACK) { + holder.itemView.setOnClickListener(v -> listener.onBackSelected()); + } else { + holder.itemView.setOnClickListener(v -> listener.onDirSelected(listItem.getTitle(), listItem.getItemId())); + } } @Override