Clover Coverage Report - WhatYouEat Coverage Report
Coverage timestamp: sab gen 3 2015 15:14:15 EST
../../../img/srcFileCovDistChart8.png 60% of files have more coverage
44   120   13   14,67
18   82   0,3   3
3     4,33  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  KeywordScroller       Line # 10 44 13 72,3% 0.72307694
 
No Tests
 
1    package co.harlequinmettle.healthfoodconcepts;
2   
3    import java.util.ArrayList;
4   
5    import android.content.Context;
6    import android.graphics.PorterDuff;
7    import android.view.View;
8    import android.widget.Button;
9   
 
10    public class KeywordScroller extends SubScroll implements FG2_I {
11    int group;
12    // added to food group title buttons from method titlebutton in menuscroller
13    public View.OnClickListener foodGroupDisplayKeywordsListener = new View.OnClickListener() {
 
14  2 toggle public void onClick(View view) {
15  2 int id = view.getId();
16  2 int[] groupIDS = new int[(FOODGROUPS[group].length)];
17  191 for (int i = 0; i < groupIDS.length; i++)
18  189 groupIDS[i] = group;
19    // add rest of searchword buttons and add linearlayout:instanceChild
20    // to scrollview
21  2 if(!scrollinflated[group]){
22  2 addScrollingButtons(FOODGROUPS[group], groupIDS,
23    foodGroupSearchListener, BUTTON_COLORS[SEARCHWORDS]);
24  2 scrollinflated[group] = true;
25    }
26   
27    }
28    };
29   
30    // uses button title to search food descriptions
31    // displays results as a new subsroll with foods description
32    View.OnClickListener foodGroupSearchListener = new View.OnClickListener() {
33    // added to keyword buttons ~2000
 
34  2 toggle public void onClick(View view) {
35  2 int id = view.getId();
36  2 currentFoodGroup = group;
37    // introGraphicsCounter = 1;
38    // id of food group to search
39  2 Button b = (Button) view;
40  2 b.getBackground().setColorFilter(0xff999999,
41    PorterDuff.Mode.MULTIPLY);
42  2 String searchWord = b.getText().toString();
43   
44  2 index = ((View) view.getParent()).getId() + 1;
45   
46  2 if (index <= lastFoodsId || lastFoodsId == 0) {
47  1 WhatYouEat.application.scrollBy((int) (MAX_BUTTON_WIDTH * 0.9),
48    0);
49    } else {
50  1 if (showingNutrients) {
51  0 WhatYouEat.application.scrollBy(-MAX_BUTTON_WIDTH, 0);
52    }
53  1 if (showingResults) {
54  1 WhatYouEat.application.scrollBy(-MAX_BUTTON_WIDTH, 0);
55    }
56  1 if (showingStats) {
57  0 WhatYouEat.application.scrollBy((int) (-2
58    * MAX_BUTTON_WIDTH * 0.9), 0);
59    }
60    }
61  2 if (showingResults) {
62  1 WhatYouEat.appAccess.removeView(WhatYouEat.appAccess
63    .findViewById(FOOD_RESULTS_ID));
64  1 showingResults = false;
65    }
66  2 if (showingNutrients) {
67  0 WhatYouEat.appAccess.removeView(WhatYouEat.appAccess
68    .findViewById(FOOD_NUTRIENT_ID));
69  0 showingNutrients = false;
70    }
71  2 if (showingStats) {
72  0 WhatYouEat.appAccess.removeView(WhatYouEat.appAccess
73    .findViewById(STATVIEW_ID));
74  0 showingStats = false;
75    }
76    // WhatYouEat.appAccess.refreshDrawableState();
77   
78   
79   
80  2 WhatYouEat.setSearchResultsFrom(searchWord, id);
81   
82    // WhatYouEat.searchResults;//food description
83    // WhatYouEat.foodCodeResults; //food code
84  2 FoodDescriptionsScroller results = new FoodDescriptionsScroller(
85    context,true);
86   
87   
88    // get index of parent subscroll for view insertion
89   
90  2 WhatYouEat.appAccess.addView(results, index);
91   
92  2 lastFoodsId = index;
93   
94  2 showingResults = true;
95    }
96    };
97   
 
98  55 toggle KeywordScroller(Context c, int group) {
99    // BUILD INDIVIDUAL FOOD CATEGORY WORD LIST FROM INTERFACE
100  55 super(c);
101   
102  55 this.group = group;// food group //22~Spices and Herbs
103   
104  55 if (false) {// just not quite ready to throw this away
105    // add button with label
106  0 Button label = simpleButton();
107  0 label.setText(WhatYouEat.foodGroups[group]);
108  0 label.setId(group);
109  0 label.setOnClickListener(foodGroupDisplayKeywordsListener);
110  0 label.getBackground().setColorFilter(FOOD_GROUP_LABEL_COLOR,
111    PorterDuff.Mode.MULTIPLY);
112   
113  0 instanceChild.addView(label);
114    }
115    // set all subsequent buttons to group so when searching description
116    // search is limited to group
117   
118    }
119   
120    }