アダプタ実装WIP

This commit is contained in:
r-ca 2023-12-17 13:20:59 +09:00
parent f8a1aa1e77
commit 17c7b5b675
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -0,0 +1,46 @@
package one.nem.lacerta.feature.debug;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import one.nem.lacerta.feature.debug.common.model.SettingMenuItem;
public class DebugDocumentMenuAdapter extends RecyclerView.Adapter<DebugDocumentMenuAdapter.ViewHolder> {
private List<SettingMenuItem> menuItems;
public DebugDocumentMenuAdapter(List<SettingMenuItem> menuItems) {
this.menuItems = menuItems;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
SettingMenuItem menuItem = menuItems.get(position);
holder.itemView.setOnClickListener( v -> {
Navigation.findNavController(v).navigate(menuItem.getDestinationId());
});
}
@Override
public int getItemCount() {
return menuItems.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}