From 60792d1b4b927f380eadf740877830a0104d2618 Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 17 Sep 2021 14:42:16 +0200 Subject: [PATCH] remove cip13 in DrugListActivityist --- .../net/foucry/pilldroid/DrugDetailActivity.java | 2 +- .../net/foucry/pilldroid/DrugListActivity.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java index e66fb6d..40a4ebb 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailActivity.java @@ -66,7 +66,7 @@ public class DrugDetailActivity extends AppCompatActivity { // Show the Up button in the action bar. ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { - actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setTitle(drug.getName()); } diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java index 83bad89..1ee3f41 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java @@ -426,10 +426,10 @@ public class DrugListActivity extends AppCompatActivity { /** * SimpleItemRecyclerViewAdapter */ - public class SimpleItemRecyclerViewAdapter - extends RecyclerView.Adapter { + public class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter { private final List mValues; + private int position; SimpleItemRecyclerViewAdapter(List items) { mValues = items; @@ -454,7 +454,8 @@ public class DrugListActivity extends AppCompatActivity { } @Override - public void onBindViewHolder(final ViewHolder holder, final int position) { + public void onBindViewHolder(final ViewHolder holder, int dummy) { + final int position = holder.getBindingAdapterPosition(); SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE d MMMM yyyy", Locale.getDefault()); String dateEndOfStock = date2String(mValues.get(position).getDateEndOfStock(), dateFormat); @@ -466,10 +467,11 @@ public class DrugListActivity extends AppCompatActivity { Log.d(TAG, "alert == " + mValues.get(position).getAlertThreshold()); holder.mItem = mValues.get(position); - holder.mIDView.setText(mValues.get(position).getCip13()); +// holder.mIDView.setText(mValues.get(position).getCip13()); holder.mContentView.setText(mValues.get(position).getName()); holder.mEndOfStock.setText(dateEndOfStock); + // Test to change background programmatically if (mValues.get(position).getTake() == 0) { holder.mView.setBackgroundResource(R.drawable.gradient_bg); @@ -510,7 +512,7 @@ public class DrugListActivity extends AppCompatActivity { class ViewHolder extends RecyclerView.ViewHolder { final View mView; - final TextView mIDView; +// final TextView mIDView; final TextView mContentView; final TextView mEndOfStock; final ImageView mIconView; @@ -520,7 +522,7 @@ public class DrugListActivity extends AppCompatActivity { ViewHolder(View view) { super(view); mView = view; - mIDView = view.findViewById(R.id.cip13); +// mIDView = view.findViewById(R.id.cip13); mContentView = view.findViewById(R.id.value); mEndOfStock = view.findViewById(R.id.endOfStock); mIconView = view.findViewById(R.id.list_image);