Change SimpleItemRecyclerView into RecyclerView

This commit is contained in:
jacques 2022-05-22 18:49:10 +02:00
parent 54a79b2514
commit d78c4f13ef

View file

@ -22,6 +22,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -73,7 +74,7 @@ public class DrugListActivity extends AppCompatActivity {
private List<Prescription> prescriptionList; // used for prescriptions private List<Prescription> prescriptionList; // used for prescriptions
private SimpleItemRecyclerViewAdapter mAdapter; private RecyclerViewAdapter mAdapter;
@Override @Override
public void onStart() { public void onStart() {
@ -463,19 +464,19 @@ public class DrugListActivity extends AppCompatActivity {
*/ */
private void setupRecyclerView(@NonNull RecyclerView recyclerView) { private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext())); recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext()));
mAdapter = new SimpleItemRecyclerViewAdapter(prescriptionList); mAdapter = new RecyclerViewAdapter(prescriptionList);
recyclerView.setAdapter(mAdapter); recyclerView.setAdapter(mAdapter);
} }
/** /**
* SimpleItemRecyclerViewAdapter * SimpleItemRecyclerViewAdapter
*/ */
public class SimpleItemRecyclerViewAdapter extends public class RecyclerViewAdapter extends
RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> { RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {
private final List<Prescription> mValues; private final List<Prescription> mValues;
SimpleItemRecyclerViewAdapter(List<Prescription> items) { RecyclerViewAdapter(List<Prescription> items) {
mValues = items; mValues = items;
} }