@@ -53,11 +53,11 @@ public class Breakfast extends AppCompatActivity implements CommonClickListener{
53
53
private List <CommonModel > breakfastModelList ;
54
54
private List <IngredientsModel > inputBreakfast ;
55
55
private ImageButton sbutton ;
56
- String finalList ;
56
+ // String finalList;
57
57
private EditText editText ;
58
58
private Toolbar btoolbar ;
59
- ListIterator listIterator ;
60
- static IngredientsModel d0 ,d1 ,d2 ,d3 ,d4 ,d5 ,d6 ,d7 ,d8 ,d9 ,d10 ;
59
+ // ListIterator listIterator;
60
+ // static IngredientsModel d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10;
61
61
@ Override
62
62
protected void onCreate (Bundle savedInstanceState ) {
63
63
super .onCreate (savedInstanceState );
@@ -85,7 +85,7 @@ protected void onCreate(Bundle savedInstanceState) {
85
85
sbutton .setClickable (false );
86
86
breakfastModelList =new ArrayList <>();
87
87
inputBreakfast = new ArrayList <>();
88
- listIterator = inputBreakfast .listIterator ();
88
+ // listIterator= inputBreakfast.listIterator();
89
89
90
90
breakfastAdapter = new CommonAdapter (this ,breakfastModelList );
91
91
breakfastAdapter .setClickListener (this );
@@ -211,10 +211,10 @@ public void buttonClicked(View view, int position) {
211
211
String text2 =drinkModel1 .getName ();
212
212
String text = text1 +text2 +", " ;
213
213
editText .setText (text );
214
- d0 =new IngredientsModel (text2 );
214
+ IngredientsModel d0 =new IngredientsModel (text2 );
215
215
inputBreakfast .add (d0 );
216
216
if (count ==0 ){
217
- inputBreakfast .remove (d0 );
217
+ // inputBreakfast.remove(d0);
218
218
text =text .replace (text2 +", " ,"" );
219
219
editText .setText (text );
220
220
@@ -233,10 +233,10 @@ public void buttonClicked(View view, int position) {
233
233
String text2 =drinkModel2 .getName ();
234
234
String text = text1 +text2 +", " ;
235
235
editText .setText (text );
236
- d1 =new IngredientsModel (text2 );
236
+ IngredientsModel d1 =new IngredientsModel (text2 );
237
237
inputBreakfast .add (d1 );
238
238
if (count ==0 ){
239
- inputBreakfast .remove (d1 );
239
+ // inputBreakfast.remove(d1);
240
240
text =text .replace (text2 +", " ,"" );
241
241
editText .setText (text );
242
242
@@ -253,10 +253,10 @@ public void buttonClicked(View view, int position) {
253
253
String text2 =drinkModel3 .getName ();
254
254
String text = text1 +text2 +", " ;
255
255
editText .setText (text );
256
- d2 =new IngredientsModel (text2 );
256
+ IngredientsModel d2 =new IngredientsModel (text2 );
257
257
inputBreakfast .add (d2 );
258
258
if (count ==0 ){
259
- inputBreakfast .remove (d2 );
259
+ // inputBreakfast.remove(d2);
260
260
text =text .replace (text2 +", " ,"" );
261
261
editText .setText (text );
262
262
@@ -272,11 +272,10 @@ public void buttonClicked(View view, int position) {
272
272
String text2 =drinkModel4 .getName ();
273
273
String text = text1 +text2 +", " ;
274
274
editText .setText (text );
275
- d3 =new IngredientsModel (text2 );
275
+ IngredientsModel d3 =new IngredientsModel (text2 );
276
276
inputBreakfast .add (d3 );
277
277
if (count ==0 ){
278
- listIterator .next ();
279
- listIterator .remove ();
278
+
280
279
text =text .replace (text2 +", " ,"" );
281
280
editText .setText (text );
282
281
@@ -293,10 +292,10 @@ public void buttonClicked(View view, int position) {
293
292
String text2 =drinkModel5 .getName ();
294
293
String text = text1 +text2 +", " ;
295
294
editText .setText (text );
296
- d4 =new IngredientsModel (text2 );
295
+ IngredientsModel d4 =new IngredientsModel (text2 );
297
296
inputBreakfast .add (d4 );
298
297
if (count ==0 ){
299
- inputBreakfast . remove ( d4 );
298
+
300
299
text =text .replace (text2 +", " ,"" );
301
300
editText .setText (text );
302
301
@@ -312,8 +311,8 @@ public void buttonClicked(View view, int position) {
312
311
String text2 =drinkModel6 .getName ();
313
312
String text = text1 +text2 +", " ;
314
313
editText .setText (text );
315
- IngredientsModel d =new IngredientsModel (text2 );
316
- inputBreakfast .add (d );
314
+ IngredientsModel d5 =new IngredientsModel (text2 );
315
+ inputBreakfast .add (d5 );
317
316
if (count ==0 ){
318
317
text =text .replace (text2 +", " ,"" );
319
318
editText .setText (text );
@@ -331,8 +330,8 @@ public void buttonClicked(View view, int position) {
331
330
String text2 =drinkModel7 .getName ();
332
331
String text = text1 +text2 +", " ;
333
332
editText .setText (text );
334
- IngredientsModel d =new IngredientsModel (text2 );
335
- inputBreakfast .add (d );
333
+ IngredientsModel d6 =new IngredientsModel (text2 );
334
+ inputBreakfast .add (d6 );
336
335
if (count ==0 ){
337
336
text =text .replace (text2 +", " ,"" );
338
337
editText .setText (text );
@@ -350,8 +349,8 @@ public void buttonClicked(View view, int position) {
350
349
String text2 =drinkModel8 .getName ();
351
350
String text = text1 +text2 +", " ;
352
351
editText .setText (text );
353
- IngredientsModel d =new IngredientsModel (text2 );
354
- inputBreakfast .add (d );
352
+ IngredientsModel d7 =new IngredientsModel (text2 );
353
+ inputBreakfast .add (d7 );
355
354
if (count ==0 ){
356
355
text =text .replace (text2 +", " ,"" );
357
356
editText .setText (text );
@@ -367,8 +366,8 @@ public void buttonClicked(View view, int position) {
367
366
String text2 =drinkModel9 .getName ();
368
367
String text = text1 +text2 +", " ;
369
368
editText .setText (text );
370
- IngredientsModel d =new IngredientsModel (text2 );
371
- inputBreakfast .add (d );
369
+ IngredientsModel d8 =new IngredientsModel (text2 );
370
+ inputBreakfast .add (d8 );
372
371
if (count ==0 ){
373
372
text =text .replace (text2 +", " ,"" );
374
373
editText .setText (text );
@@ -385,8 +384,8 @@ public void buttonClicked(View view, int position) {
385
384
String text2 =drinkModel10 .getName ();
386
385
String text = text1 +text2 +", " ;
387
386
editText .setText (text );
388
- IngredientsModel d =new IngredientsModel (text2 );
389
- inputBreakfast .add (d );
387
+ IngredientsModel d9 =new IngredientsModel (text2 );
388
+ inputBreakfast .add (d9 );
390
389
if (count ==0 ){
391
390
text =text .replace (text2 +", " ,"" );
392
391
editText .setText (text );
@@ -403,8 +402,8 @@ public void buttonClicked(View view, int position) {
403
402
String text2 =drinkModel11 .getName ();
404
403
String text = text1 +text2 +", " ;
405
404
editText .setText (text );
406
- IngredientsModel d =new IngredientsModel (text2 );
407
- inputBreakfast .add (d );
405
+ IngredientsModel d10 =new IngredientsModel (text2 );
406
+ inputBreakfast .add (d10 );
408
407
if (count ==0 ){
409
408
text =text .replace (text2 +", " ,"" );
410
409
editText .setText (text );
@@ -422,8 +421,8 @@ public void buttonClicked(View view, int position) {
422
421
String text2 =drinkModel12 .getName ();
423
422
String text = text1 +text2 +", " ;
424
423
editText .setText (text );
425
- IngredientsModel d =new IngredientsModel (text2 );
426
- inputBreakfast .add (d );
424
+ IngredientsModel d11 =new IngredientsModel (text2 );
425
+ inputBreakfast .add (d11 );
427
426
if (count ==0 ){
428
427
text =text .replace (text2 +", " ,"" );
429
428
editText .setText (text );
@@ -440,8 +439,8 @@ public void buttonClicked(View view, int position) {
440
439
String text2 =drinkModel13 .getName ();
441
440
String text = text1 +text2 +", " ;
442
441
editText .setText (text );
443
- IngredientsModel d =new IngredientsModel (text2 );
444
- inputBreakfast .add (d );
442
+ IngredientsModel d12 =new IngredientsModel (text2 );
443
+ inputBreakfast .add (d12 );
445
444
if (count ==0 ){
446
445
text =text .replace (text2 +", " ,"" );
447
446
editText .setText (text );
@@ -682,14 +681,13 @@ public void buttonClicked(View view, int position) {
682
681
public void onClick (View view ) {
683
682
if (isNetworkAvailable ()) {
684
683
685
- if (editText .length () == 0 || inputBreakfast .size () < 2 || inputBreakfast . size () > 8 ) {
684
+ if (editText .length () == 0 || inputBreakfast .size () < 2 ) {
686
685
if (editText .length () == 0 ) {
687
686
688
687
Toast .makeText (Breakfast .this , "Please select two or more ingredients" , Toast .LENGTH_SHORT ).show ();
689
688
} else if (inputBreakfast .size () < 2 ) {
690
689
Toast .makeText (Breakfast .this , "Please select two or more ingredients" , Toast .LENGTH_SHORT ).show ();
691
- } else if (inputBreakfast .size () > 8 ) {
692
- Toast .makeText (Breakfast .this , " Too many ingredients.Select less than eight" , Toast .LENGTH_SHORT ).show ();
690
+
693
691
}
694
692
} else {
695
693
sbutton .setClickable (true );
0 commit comments