From 55d3e8b9036abb5486552881cc0c6dbd682beaec Mon Sep 17 00:00:00 2001 From: Jacques Foucry Date: Thu, 19 May 2016 17:14:58 +0200 Subject: [PATCH] Mise en place du look PillStock --- .../pilldroid/MedicamentListActivity.java | 28 +++++--- app/src/main/res/drawable/arrow.png | Bin 0 -> 550 bytes .../res/layout/medicament_list_content.xml | 65 +++++++++++++++--- 3 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 app/src/main/res/drawable/arrow.png diff --git a/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java b/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java index d9dae41..c069750 100644 --- a/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java @@ -13,9 +13,11 @@ import android.support.design.widget.Snackbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.SimpleCursorAdapter; import android.widget.TextView; - +import net.foucry.pilldroid.Medicament; import net.foucry.pilldroid.dummy.DummyContent; import java.util.List; @@ -43,11 +45,16 @@ public class MedicamentListActivity extends AppCompatActivity { String TAG = "nef.foucry.pilldroid"; } + private static DBHelper dbHelper; + private SimpleCursorAdapter drugAdapter; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_medicament_list); + dbHelper = new DBHelper(this); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setTitle(getTitle()); @@ -97,7 +104,7 @@ public class MedicamentListActivity extends AppCompatActivity { @Override public void onBindViewHolder(final ViewHolder holder, int position) { holder.mItem = mValues.get(position); - holder.mIdView.setText(mValues.get(position).id); + holder.mIDView.setText(mValues.get(position).id); holder.mContentView.setText(mValues.get(position).content); holder.mView.setOnClickListener(new View.OnClickListener() { @@ -105,7 +112,7 @@ public class MedicamentListActivity extends AppCompatActivity { public void onClick(View v) { if (mTwoPane) { Bundle arguments = new Bundle(); - arguments.putString(MedicamentDetailFragment.ARG_ITEM_ID, holder.mItem.id); + arguments.putString(MedicamentDetailFragment.ARG_ITEM_ID, holder.mItem.getCip13()); MedicamentDetailFragment fragment = new MedicamentDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction() @@ -114,7 +121,7 @@ public class MedicamentListActivity extends AppCompatActivity { } else { Context context = v.getContext(); Intent intent = new Intent(context, MedicamentDetailActivity.class); - intent.putExtra(MedicamentDetailFragment.ARG_ITEM_ID, holder.mItem.id); + intent.putExtra(MedicamentDetailFragment.ARG_ITEM_ID, holder.mItem.getCip13()); context.startActivity(intent); } @@ -129,15 +136,20 @@ public class MedicamentListActivity extends AppCompatActivity { public class ViewHolder extends RecyclerView.ViewHolder { public final View mView; - public final TextView mIdView; + public final TextView mIDView; public final TextView mContentView; - public DummyContent.DummyItem mItem; + public final TextView mEndOfStock; + public final ImageView mIconView; + + public Medicament mItem; public ViewHolder(View view) { super(view); mView = view; - mIdView = (TextView) view.findViewById(R.id.id); - mContentView = (TextView) view.findViewById(R.id.content); + mIDView = (TextView) view.findViewById(R.id.cip13); + mContentView = (TextView) view.findViewById(R.id.valeur); + mEndOfStock = (TextView) view.findViewById(R.id.endOfStock); + mIconView = (ImageView) view.findViewById(R.id.list_image); } @Override diff --git a/app/src/main/res/drawable/arrow.png b/app/src/main/res/drawable/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..86e693693cf135260f009e743ce8fc14768fd21f GIT binary patch literal 550 zcmV+>0@?kEP)T}A!9l(! zetiGt#mmF{URqk3K~7GNL0n9%$lcwumnZ{3AS^8C#GgOEo%#9spUKF`GJvp zgVS`P3;=i6&841fOq zVfg#^Z{NMwW=%mcX###Xitam`oPoF*Q$EO(# ouw~K0!lJC? - - + android:padding="3dip" + android:layout_alignParentLeft="true" + android:background="@android:color/transparent" + android:layout_marginRight="5sp"> + + + - \ No newline at end of file + android:layout_alignTop="@+id/thumbnail" + android:layout_toRightOf="@+id/thumbnail" + android:text="Nom Médicament" + android:textColor="#040404" + android:typeface="sans" + android:textSize="14sp" + android:textStyle="bold"/> + + + + + + + + + + \ No newline at end of file