@@ -70,7 +70,7 @@ public void onItemAdded(ShoppingCart list, Product product) {
7070
7171 @ Override
7272 public void onQuantityChanged (ShoppingCart list , Product product ) {
73- onCartUpdated ();
73+
7474 }
7575
7676 @ Override
@@ -214,18 +214,20 @@ public void onSwiped(final RecyclerView.ViewHolder viewHolder, int direction) {
214214 final Product product = cart .getProduct (pos );
215215 final String scannedCode = cart .getScannedCode (pos );
216216 final int quantity = cart .getQuantity (pos );
217+ final boolean isZeroAmountProduct = cart .isZeroAmountProduct (pos );
217218
218219 cart .removeAll (pos );
219220 Telemetry .event (Telemetry .Event .DeletedFromCart , product );
220221 recyclerView .getAdapter ().notifyItemRemoved (pos );
222+ update ();
221223
222224 snackbar = UIUtils .snackbar (coordinatorLayout ,
223225 R .string .Snabble_Shoppingcart_articleRemoved , UIUtils .SNACKBAR_LENGTH_VERY_LONG );
224226 snackbar .setAction (R .string .Snabble_undo , new OnClickListener () {
225227 @ Override
226228 public void onClick (View v ) {
227229 ScannableCode parsedCode = ScannableCode .parse (SnabbleUI .getProject (), scannedCode );
228- cart .insert (product , pos , quantity , parsedCode );
230+ cart .insert (product , pos , quantity , parsedCode , isZeroAmountProduct );
229231 recyclerView .getAdapter ().notifyDataSetChanged ();
230232 Telemetry .event (Telemetry .Event .UndoDeleteFromCart , product );
231233 }
@@ -276,12 +278,16 @@ private void updatePayText() {
276278 }
277279
278280 private void onCartUpdated () {
281+ update ();
282+
283+ recyclerViewAdapter .notifyDataSetChanged ();
284+ }
285+
286+ private void update () {
279287 updatePayText ();
280288 updateEmptyState ();
281289 scanForImages ();
282290
283- recyclerViewAdapter .notifyDataSetChanged ();
284-
285291 if (snackbar != null ) {
286292 snackbar .dismiss ();
287293 }
@@ -473,6 +479,7 @@ public void onClick(View v) {
473479 }
474480
475481 recyclerViewAdapter .notifyItemChanged (getAdapterPosition ());
482+ update ();
476483 }
477484 });
478485
@@ -495,6 +502,7 @@ public void onClick(View v) {
495502 public void onClick (DialogInterface dialog , int which ) {
496503 cart .removeAll (getAdapterPosition ());
497504 recyclerViewAdapter .notifyItemChanged (getAdapterPosition ());
505+ update ();
498506 Telemetry .event (Telemetry .Event .DeletedFromCart , product );
499507 }
500508 })
@@ -511,6 +519,7 @@ public void onClick(DialogInterface dialog, int which) {
511519 }
512520
513521 recyclerViewAdapter .notifyItemChanged (getAdapterPosition ());
522+ update ();
514523 }
515524 }
516525 });
@@ -521,6 +530,7 @@ public void click() {
521530 int pos = getAdapterPosition ();
522531 cart .setQuantity (pos , getQuantityEditValue ());
523532 recyclerViewAdapter .notifyItemChanged (pos );
533+ update ();
524534
525535 hideInput ();
526536 }
0 commit comments