remove dead code

compliance with IDE suggestion
This commit is contained in:
jacques 2021-11-07 22:18:21 +01:00
parent 682af77f97
commit d2489d1f25

View file

@ -93,14 +93,6 @@ public class DrugListActivity extends AppCompatActivity {
private SimpleItemRecyclerViewAdapter mAdapter; private SimpleItemRecyclerViewAdapter mAdapter;
public int getCount() {
return drugs.size();
}
public Drug getItem(int position) {
return drugs.get(position);
}
public void constructDrugsList() public void constructDrugsList()
{ {
dbHelper = new DBHelper(getApplicationContext()); dbHelper = new DBHelper(getApplicationContext());
@ -413,8 +405,6 @@ public class DrugListActivity extends AppCompatActivity {
public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> { public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> {
private final List<Drug> mValues; private final List<Drug> mValues;
private int position;
SimpleItemRecyclerViewAdapter(List<Drug> items) { SimpleItemRecyclerViewAdapter(List<Drug> items) {
mValues = items; mValues = items;
} }
@ -422,10 +412,11 @@ public class DrugListActivity extends AppCompatActivity {
void addItem(Drug scannedDrug) { void addItem(Drug scannedDrug) {
if (!dbHelper.isDrugExist(scannedDrug.getCip13())) { if (!dbHelper.isDrugExist(scannedDrug.getCip13())) {
mValues.add(scannedDrug); mValues.add(scannedDrug);
notifyDataSetChanged(); //notifyDataSetChanged();
notifyItemInserted(mValues.size());
dbHelper.addDrug(scannedDrug); dbHelper.addDrug(scannedDrug);
} else { } else {
Toast.makeText(getApplicationContext(), "already in the database", Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "already in the database", Toast.LENGTH_LONG).show();
} }
} }
@ -494,7 +485,6 @@ public class DrugListActivity extends AppCompatActivity {
class ViewHolder extends RecyclerView.ViewHolder { class ViewHolder extends RecyclerView.ViewHolder {
final View mView; final View mView;
// final TextView mIDView;
final TextView mContentView; final TextView mContentView;
final TextView mEndOfStock; final TextView mEndOfStock;
final ImageView mIconView; final ImageView mIconView;
@ -504,7 +494,6 @@ public class DrugListActivity extends AppCompatActivity {
ViewHolder(View view) { ViewHolder(View view) {
super(view); super(view);
mView = view; mView = view;
// mIDView = view.findViewById(R.id.cip13);
mContentView = view.findViewById(R.id.value); mContentView = view.findViewById(R.id.value);
mEndOfStock = view.findViewById(R.id.endOfStock); mEndOfStock = view.findViewById(R.id.endOfStock);
mIconView = view.findViewById(R.id.list_image); mIconView = view.findViewById(R.id.list_image);