EMMA Coverage Report (generated Thu Apr 06 01:25:04 CEST 2017)
[all classes][net.mandaria.tippytipper.activities]

COVERAGE SUMMARY FOR SOURCE FILE [TippyTipper.java]

nameclass, %method, %block, %line, %
TippyTipper.java100% (16/16)100% (46/46)100% (540/542)99%  (145/146)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TippyTipper100% (1/1)100% (16/16)99%  (342/344)99%  (86/87)
onOptionsItemSelected (MenuItem): boolean 100% (1/1)93%  (25/27)88%  (7/8)
TippyTipper (): void 100% (1/1)100% (3/3)100% (1/1)
access$000 (TippyTipper, String): void 100% (1/1)100% (4/4)100% (1/1)
access$100 (TippyTipper): void 100% (1/1)100% (3/3)100% (1/1)
access$200 (TippyTipper): void 100% (1/1)100% (3/3)100% (1/1)
access$300 (TippyTipper): void 100% (1/1)100% (3/3)100% (1/1)
addBillAmount (String): void 100% (1/1)100% (11/11)100% (4/4)
bindData (): void 100% (1/1)100% (15/15)100% (4/4)
calcualteTipWithDefaultTipPercentage (): void 100% (1/1)100% (58/58)100% (13/13)
clearBillAmount (): void 100% (1/1)100% (10/10)100% (4/4)
onCreate (Bundle): void 100% (1/1)100% (151/151)100% (32/32)
onCreateOptionsMenu (Menu): boolean 100% (1/1)100% (15/15)100% (5/5)
onDestroy (): void 100% (1/1)100% (3/3)100% (2/2)
onStart (): void 100% (1/1)100% (23/23)100% (7/7)
onStop (): void 100% (1/1)100% (5/5)100% (3/3)
removeBillAmount (): void 100% (1/1)100% (10/10)100% (4/4)
     
class TippyTipper$1100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$1 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$10100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$10 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$11100% (1/1)100% (2/2)100% (12/12)100% (4/4)
TippyTipper$11 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (6/6)100% (3/3)
     
class TippyTipper$12100% (1/1)100% (2/2)100% (11/11)100% (3/3)
TippyTipper$12 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onLongClick (View): boolean 100% (1/1)100% (5/5)100% (2/2)
     
class TippyTipper$13100% (1/1)100% (2/2)100% (12/12)100% (4/4)
TippyTipper$13 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (6/6)100% (3/3)
     
class TippyTipper$14100% (1/1)100% (2/2)100% (11/11)100% (3/3)
TippyTipper$14 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onLongClick (View): boolean 100% (1/1)100% (5/5)100% (2/2)
     
class TippyTipper$15100% (1/1)100% (2/2)100% (22/22)100% (5/5)
TippyTipper$15 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (16/16)100% (4/4)
     
class TippyTipper$2100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$2 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$3100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$3 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$4100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$4 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$5100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$5 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$6100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$6 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$7100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$7 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$8100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$8 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)
     
class TippyTipper$9100% (1/1)100% (2/2)100% (13/13)100% (4/4)
TippyTipper$9 (TippyTipper): void 100% (1/1)100% (6/6)100% (1/1)
onClick (View): void 100% (1/1)100% (7/7)100% (3/3)

1package net.mandaria.tippytipper.activities;
2 
3import java.util.HashMap;
4import java.util.Map;
5 
6import com.flurry.android.FlurryAgent;
7 
8import net.mandaria.tippytipper.R;
9import net.mandaria.tippytipper.TippyTipperApplication;
10import android.app.Activity;
11import android.content.Intent;
12import android.os.Bundle;
13import android.view.View;
14import android.view.View.OnClickListener;
15import android.widget.EditText;
16import android.view.Menu;
17import android.view.MenuInflater;
18import android.view.MenuItem;
19import android.view.View.OnLongClickListener;
20 
21public class TippyTipper extends Activity  {
22        
23    /** Called when the activity is first created. */
24    @Override
25    public void onCreate(Bundle savedInstanceState) {
26        super.onCreate(savedInstanceState);
27        setContentView(R.layout.main);  
28     
29        bindData();
30        
31        // Setup click listeners for buttons
32        View btn_one = findViewById(R.id.btn_one);
33        btn_one.setOnClickListener(new OnClickListener() 
34                {
35                    public void onClick(View v) 
36                    {
37                            addBillAmount("1");
38                            FlurryAgent.onEvent("1 Button");
39                    }
40            });
41        View btn_two = findViewById(R.id.btn_two);
42        btn_two.setOnClickListener(new OnClickListener() 
43                {
44                    public void onClick(View v) 
45                    {
46                            addBillAmount("2");
47                            FlurryAgent.onEvent("2 Button");
48                    }
49            });
50        View btn_three = findViewById(R.id.btn_three);
51        btn_three.setOnClickListener(new OnClickListener() 
52                {
53                    public void onClick(View v) 
54                    {
55                            addBillAmount("3");
56                            FlurryAgent.onEvent("3 Button");
57                    }
58            });
59        View btn_four = findViewById(R.id.btn_four);
60        btn_four.setOnClickListener(new OnClickListener() 
61                {
62                    public void onClick(View v) 
63                    {
64                            addBillAmount("4");
65                            FlurryAgent.onEvent("4 Button");
66                    }
67            });
68        View btn_five = findViewById(R.id.btn_five);
69        btn_five.setOnClickListener(new OnClickListener() 
70                {
71                    public void onClick(View v) 
72                    {
73                            addBillAmount("5");
74                            FlurryAgent.onEvent("5 Button");
75                    }
76            });
77        View btn_six = findViewById(R.id.btn_six);
78        btn_six.setOnClickListener(new OnClickListener() 
79                {
80                    public void onClick(View v) 
81                    {
82                            addBillAmount("6");
83                            FlurryAgent.onEvent("6 Button");
84                    }
85            });
86        View btn_seven = findViewById(R.id.btn_seven);
87        btn_seven.setOnClickListener(new OnClickListener() 
88                {
89                    public void onClick(View v) 
90                    {
91                            addBillAmount("7");
92                            FlurryAgent.onEvent("7 Button");
93                    }
94            });
95        View btn_eight = findViewById(R.id.btn_eight);
96        btn_eight.setOnClickListener(new OnClickListener() 
97                {
98                    public void onClick(View v) 
99                    {
100                            addBillAmount("8");
101                            FlurryAgent.onEvent("8 Button");
102                    }
103            });
104        View btn_nine = findViewById(R.id.btn_nine);
105        btn_nine.setOnClickListener(new OnClickListener() 
106                {
107                    public void onClick(View v) 
108                    {
109                            addBillAmount("9");
110                            FlurryAgent.onEvent("9 Button");
111                    }
112            });
113        View btn_zero = findViewById(R.id.btn_zero);
114        btn_zero.setOnClickListener(new OnClickListener() 
115                {
116                        public void onClick(View v) 
117                        {
118                                addBillAmount("0");
119                                FlurryAgent.onEvent("0 Button");
120                        }
121                });
122        View btn_delete = findViewById(R.id.btn_delete);
123        btn_delete.setOnClickListener(new OnClickListener() 
124                {
125                    public void onClick(View v) 
126                    {
127                            removeBillAmount();
128                            FlurryAgent.onEvent("Delete Button");
129                    }
130            });
131        
132        btn_delete.setOnLongClickListener(new OnLongClickListener()
133                        {
134                                public boolean onLongClick(View v)
135                                {
136                                        clearBillAmount();
137                                        return true;
138                                }
139                        });
140        
141        // Added Clear Button -- Maintained the Long-Click Delete -- SPDJR
142        View btn_clear = findViewById(R.id.btn_clear);
143        btn_clear.setOnClickListener(new OnClickListener() 
144                {
145                    public void onClick(View v) 
146                    {
147                            clearBillAmount();
148                            FlurryAgent.onEvent("Clear Button");
149                    }
150            });
151        
152        btn_clear.setOnLongClickListener(new OnLongClickListener()
153                        {
154                                public boolean onLongClick(View v)
155                                {
156                                        clearBillAmount();
157                                        return true;
158                                }
159                        });
160        
161        
162//        Drawable d_delete = findViewById(R.id.btn_delete).getBackground();
163//        int red = Color.parseColor("#8E1609");
164//        PorterDuffColorFilter filter_red = new PorterDuffColorFilter(red, PorterDuff.Mode.SRC_ATOP);
165//        d_delete.setColorFilter(filter_red);
166 
167        View btn_ok = findViewById(R.id.btn_ok);
168        btn_ok.setOnClickListener(new OnClickListener() 
169                {
170                    public void onClick(View v) 
171                    {
172                            calcualteTipWithDefaultTipPercentage();
173                            
174                            Intent i = new Intent(getBaseContext(), Total.class);//new Intent(this, Total.class);
175                            startActivity(i);
176                    }
177            });
178//        Drawable d_ok = findViewById(R.id.btn_ok).getBackground();
179//        int green = Color.parseColor("#216C2A");
180//        PorterDuffColorFilter filter_green = new PorterDuffColorFilter(green, PorterDuff.Mode.SRC_ATOP);
181//        d_ok.setColorFilter(filter_green);
182    }
183    
184    @Override
185        public void onStart()
186    {
187       super.onStart();
188       boolean enableErrorLogging = Settings.getEnableErrorLogging(getBaseContext());
189       String API = getString(R.string.flurrykey);
190       if(!API.equals("") && enableErrorLogging == true)
191       {
192               FlurryAgent.setContinueSessionMillis(30000);
193               FlurryAgent.onStartSession(this, API);
194       }
195    }
196    
197    @Override
198        public void onStop()
199    {
200       super.onStop();
201      
202       FlurryAgent.onEndSession(this);
203    }
204    
205    @Override
206    public void onDestroy()
207    {
208            super.onDestroy();
209    }
210    
211    @Override
212          public boolean onCreateOptionsMenu(Menu menu)
213          {
214                  super.onCreateOptionsMenu(menu);
215                  MenuInflater inflater = getMenuInflater();
216                  inflater.inflate(R.menu.menu, menu);
217                  FlurryAgent.onEvent("Menu Button");
218                  return true;
219          }
220 
221          @Override
222          public boolean onOptionsItemSelected(MenuItem item)
223          {
224                  switch(item.getItemId())
225                  {
226                          case R.id.settings:
227                                  startActivity(new Intent(this, Settings.class));
228                                  FlurryAgent.onEvent("Settings Button");
229                                  return true;
230                          case R.id.about:
231                                  startActivity(new Intent(this, About.class));
232                                  FlurryAgent.onEvent("About Button");
233                                return true;
234                  }
235                  return false;
236          }
237          
238          private void calcualteTipWithDefaultTipPercentage()
239          {
240                  TippyTipperApplication appState = ((TippyTipperApplication)this.getApplication());
241                double defaultTipPercentage = Settings.getDefaultTipPercentage(getBaseContext());
242                float excludeTaxRate = Settings.getExcludeTaxRate(getBaseContext());
243                boolean enableExcludeTaxRate = Settings.getEnableExcludeTaxRate(getBaseContext());
244                if(enableExcludeTaxRate == false)
245                        excludeTaxRate = 0;
246                
247                Map<String, String> params = new HashMap<String, String>();
248                params.put("Default Tip Percentage", String.valueOf(defaultTipPercentage));
249                params.put("Exclude Tax Rate", String.valueOf(excludeTaxRate));
250                params.put("Bill Amount", appState.service.getBillAmount());
251                FlurryAgent.onEvent("OK Button", params);
252                
253                appState.service.calculateTip(defaultTipPercentage/100.0, excludeTaxRate/100.0);
254          }
255    
256    private void addBillAmount(String number)
257    {
258            TippyTipperApplication appState = ((TippyTipperApplication)this.getApplication());
259            appState.service.appendNumberToBillAmount(number);
260            
261                bindData();
262    }
263    
264    private void removeBillAmount()
265    {
266            TippyTipperApplication appState = ((TippyTipperApplication)this.getApplication());
267            appState.service.removeEndNumberFromBillAmount();
268            
269            bindData();
270    }
271    
272    private void clearBillAmount()
273    {
274            TippyTipperApplication appState = ((TippyTipperApplication)this.getApplication());
275            appState.service.clearBillAmount();
276            
277            bindData();
278    }
279    
280    private void bindData()
281    {
282            TippyTipperApplication appState = ((TippyTipperApplication)this.getApplication());
283   
284            EditText txt_amount = (EditText)findViewById(R.id.txt_amount);
285                txt_amount.setText(appState.service.getBillAmount());
286    }
287 
288}

[all classes][net.mandaria.tippytipper.activities]
EMMA 2.0.5312 (C) Vladimir Roubtsov