Kyou/layout #4
|
@ -18,15 +18,14 @@ public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ItemVi
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public RecyclerAdapter(ArrayList<String[]> deviceList) {
|
public RecyclerAdapter(ArrayList<String[]> deviceList) {
|
||||||
Log.d("RecyclerAdapter", "Constructor");
|
|
||||||
// Init
|
// Init
|
||||||
|
Log.d("RecyclerAdapter", "Constructor called");
|
||||||
this.deviceList = deviceList;
|
this.deviceList = deviceList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public RecyclerAdapter.ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public RecyclerAdapter.ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
Log.d("RecyclerAdapter", "onCreateViewHolder");
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||||
View itemView = inflater.inflate(R.layout.recycler_row, parent, false);
|
View itemView = inflater.inflate(R.layout.recycler_row, parent, false);
|
||||||
return new ItemViewHolder(itemView);
|
return new ItemViewHolder(itemView);
|
||||||
|
@ -34,7 +33,6 @@ public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ItemVi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
|
||||||
Log.d("RecyclerAdapter", "onBindViewHolder");
|
|
||||||
holder.textView.setText(deviceList.get(position)[0]);
|
holder.textView.setText(deviceList.get(position)[0]);
|
||||||
holder.textView.setOnClickListener( v -> {
|
holder.textView.setOnClickListener( v -> {
|
||||||
Toast.makeText(v.getContext(), deviceList.get(position)[1], Toast.LENGTH_SHORT).show();
|
Toast.makeText(v.getContext(), deviceList.get(position)[1], Toast.LENGTH_SHORT).show();
|
||||||
|
@ -43,7 +41,6 @@ public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ItemVi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
Log.d("RecyclerAdapter", "getItemCount");
|
|
||||||
return deviceList.size();
|
return deviceList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user