Modification calcul de la couleur du fond de la cellule

This commit is contained in:
Jacques Foucry 2016-05-23 22:32:14 +02:00
parent a06cf1a474
commit 801d9e1049
2 changed files with 5 additions and 5 deletions

View file

@ -3,9 +3,8 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.10" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View file

@ -183,11 +183,12 @@ public class MedicamentListActivity extends AppCompatActivity {
if (mValues.get(position).getPrise() == 0) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg);
} else {
if (mValues.get(position).getStock() <= mValues.get(position).getAlertThreshold()) {
int remainingStock = (int) Math.floor(mValues.get(position).getStock()/mValues.get(position).getPrise());
if (remainingStock <= mValues.get(position).getAlertThreshold()) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg_alert);
holder.mIconView.setImageResource(R.drawable.stock_alert);
} else if ((mValues.get(position).getStock() > mValues.get(position).getAlertThreshold()) &&
(mValues.get(position).getStock() <= (mValues.get(position).getWarnThreshold() * mValues.get(position).getPrise()))) {
} else if ((remainingStock > mValues.get(position).getAlertThreshold()) &&
(remainingStock <= (mValues.get(position).getWarnThreshold()))) {
holder.mView.setBackgroundResource(R.drawable.gradient_bg_warning);
holder.mIconView.setImageResource(R.drawable.stock_warn);
} else {