onBindViewHolder実装

This commit is contained in:
r-ca 2023-12-18 01:36:45 +09:00
parent c9dbefbe38
commit 24632351ed
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -3,6 +3,7 @@ package one.nem.lacerta.feature.debug.common.adapter;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -28,7 +29,18 @@ public class DebugMenuDocumentListItemAdapter extends RecyclerView.Adapter<Debug
@Override @Override
public void onBindViewHolder(@NonNull DebugMenuDocumentListItemAdapter.DebugMenuDocumentListItemViewHolder holder, int position) { public void onBindViewHolder(@NonNull DebugMenuDocumentListItemAdapter.DebugMenuDocumentListItemViewHolder holder, int position) {
DebugMenuDocumentListItem item = debugMenuDocumentListItems.get(position);
// Set title
holder.title.setText(item.getTitle());
// Set description
holder.description.setText(item.getDescription());
// Set updated at
holder.updatedAt.setText("Updated at: " + item.getUpdatedAt());
holder.itemView.setOnClickListener(v -> {
Toast.makeText(v.getContext(), "Clicked on " + item.getTitle(), Toast.LENGTH_SHORT).show(); // Debug
});
} }
@Override @Override