mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
インタフェースの変更に追従
This commit is contained in:
parent
4f3c79564b
commit
04bd081d99
|
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import one.nem.lacerta.model.ListItem;
|
import one.nem.lacerta.model.ListItem;
|
||||||
|
import one.nem.lacerta.model.ListItemType;
|
||||||
|
|
||||||
public class SelectDirDialogItemAdapter extends RecyclerView.Adapter<SelectDirDialogItemAdapter.SelectDirDialogItemViewHolder> {
|
public class SelectDirDialogItemAdapter extends RecyclerView.Adapter<SelectDirDialogItemAdapter.SelectDirDialogItemViewHolder> {
|
||||||
|
|
||||||
|
@ -22,7 +23,10 @@ public class SelectDirDialogItemAdapter extends RecyclerView.Adapter<SelectDirDi
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListItems(ArrayList<ListItem> listItems) {
|
public void setListItems(ArrayList<ListItem> listItems) {
|
||||||
this.listItems = listItems;
|
// 戻るアクションを追加
|
||||||
|
this.listItems.add(0, new ListItem("戻る", " ", ListItemType.ITEM_TYPE_ACTION_BACK, null));
|
||||||
|
|
||||||
|
this.listItems.addAll(listItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -37,9 +41,11 @@ public class SelectDirDialogItemAdapter extends RecyclerView.Adapter<SelectDirDi
|
||||||
ListItem listItem = listItems.get(position);
|
ListItem listItem = listItems.get(position);
|
||||||
holder.title.setText(listItem.getTitle());
|
holder.title.setText(listItem.getTitle());
|
||||||
holder.description.setText(listItem.getDescription());
|
holder.description.setText(listItem.getDescription());
|
||||||
holder.itemView.setOnClickListener(v -> {
|
if(listItem.getItemType() == ListItemType.ITEM_TYPE_ACTION_BACK) {
|
||||||
listener.onDirSelected(listItem.getTitle(), listItem.getItemId());
|
holder.itemView.setOnClickListener(v -> listener.onBackSelected());
|
||||||
});
|
} else {
|
||||||
|
holder.itemView.setOnClickListener(v -> listener.onDirSelected(listItem.getTitle(), listItem.getItemId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user