mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
アダプタ実装WIP
This commit is contained in:
parent
f8a1aa1e77
commit
17c7b5b675
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user