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