Clover Coverage Report - SaveApp Coverage Report
Coverage timestamp: mar dic 23 2014 15:53:11 EST
../../../../img/srcFileCovDistChart8.png 32% of files have more coverage
89   197   21   7,42
12   161   0,24   12
12     1,75  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  OutlayDetailActivity       Line # 17 89 21 80,5% 0.8053097
 
No Tests
 
1    package com.loopback.androidapps.saveapp;
2   
3    import android.app.Activity;
4    import android.app.AlertDialog;
5    import android.content.DialogInterface;
6    import android.content.Intent;
7    import android.os.Bundle;
8    import android.util.Log;
9    import android.view.Menu;
10    import android.view.MenuInflater;
11    import android.view.MenuItem;
12    import android.view.View;
13    import android.widget.ImageButton;
14    import android.widget.TextView;
15    import android.widget.Toast;
16   
 
17    public class OutlayDetailActivity extends Activity implements
18    View.OnClickListener {
19   
20    private ImageButton btnPhoto, btnNotes, btnFile;
21    TextView txtAccount, txtChargeValue, txtItemValue, txtPlaceValue,
22    txtAddressValue, txtDateValue;
23    private Outlay outlay;
24    private String note;
25    public boolean isEuropeanCalendar = true;
26    private int outlayId;
27    public SaveApp saveApp;
28    /*------------------------------------------------------------------------------------------------
29    *--------------------------------------ONCREATE--------------------------------------------------
30    *------------------------------------------------------------------------------------------------ */
31   
 
32  9 toggle public void onCreate(Bundle savedInstanceState) {
33  9 Log.i("OEA", "Init");
34  9 super.onCreate(savedInstanceState);
35  9 setContentView(R.layout.outlaydetail);
36   
37  9 loadActivity();
38    }
39    /*------------------------------------------------------------------------------------------------
40    *--------------------------------------LOAD--------------------------------------------------
41    *------------------------------------------------------------------------------------------------ */
42   
 
43  9 toggle public void loadActivity() {
44  9 Log.i("ODA", "Loading...");
45  9 saveApp = ((SaveApp) getApplicationContext());
46   
47  9 Bundle bundle = this.getIntent().getExtras();
48  9 outlayId = bundle.getInt("Id");
49   
50  9 outlay = new Outlay(outlayId);
51   
52  9 note = null;
53  9 btnPhoto = (ImageButton) findViewById(R.id.btnPhoto);
54  9 btnNotes = (ImageButton) findViewById(R.id.btnNotes);
55  9 btnFile = (ImageButton) findViewById(R.id.btnFile);
56  9 txtChargeValue = (TextView) findViewById(R.id.txtChargeValue);
57  9 txtItemValue = (TextView) findViewById(R.id.txtItemValue);
58  9 txtPlaceValue = (TextView) findViewById(R.id.txtPlaceValue);
59  9 txtAddressValue = (TextView) findViewById(R.id.txtAddress);
60  9 txtDateValue = (TextView) findViewById(R.id.txtDate);
61  9 txtAccount = (TextView) findViewById(R.id.txtAccount);
62   
63  9 btnNotes.setOnClickListener(this);
64  9 btnFile.setOnClickListener(this);
65  9 btnPhoto.setOnClickListener(this);
66   
67  9 Log.i("ODA", "Loading...");
68  9 txtChargeValue.setText(String.valueOf((outlay.getCharge())
69    + saveApp.getCurrencySymbol()));
70  9 txtItemValue.setText(outlay.getItemDesc());
71  9 txtPlaceValue.setText(outlay.getPlaceDesc());
72  9 txtAddressValue.setText((outlay.getAddressDesc() == null) ? "No data"
73    : outlay.getAddressDesc());
74  9 txtDateValue.setText(Utilities.printDate(outlay.getDate()));
75   
76  9 txtAccount.setText(getString(R.string.strAccount) + ": "
77    + saveApp.getAccountDesc());
78   
79  9 Log.i("ODA", "Loaded");
80    }
81   
 
82  1 toggle public void delete(){
83  1 Outlay outlayToDelete = new Outlay(outlayId);
84  1 outlayToDelete.delete();
85  1 Intent intent = new Intent(this.getApplicationContext(),
86    OutlaysListActivity.class);
87  1 Log.i("ODA", "Starting Activity Outlay List");
88  1 startActivity(intent);
89    }
 
90  4 toggle public void onBackPressed() {
91  4 Log.i("ODA", "Back Pressed...");
92  4 Intent intent = new Intent(this.getApplicationContext(),
93    OutlaysListActivity.class);
94  4 Log.i("ODA", "Starting Activity Outlay List");
95  4 startActivity(intent);
96    }
97   
 
98  1 toggle public void onClick(View v) {
99  1 if (v == btnNotes) {
100  1 if (outlay.getNote().equals("") || outlay.getNote() == null)
101  0 Toast.makeText(this, "No notes for this movement",
102    Toast.LENGTH_SHORT).show();
103    else {
104  1 Bundle bundle = new Bundle();
105  1 bundle.putString("Note", (outlay.getNote()));
106  1 bundle.putInt("Id", outlayId);
107  1 Intent intent = new Intent(this.getApplicationContext(),
108    NoteViewActivity.class);
109  1 intent.putExtras(bundle);
110  1 startActivity(intent);
111    }
112  0 } else if (v == btnFile) {
113  0 Toast.makeText(this, getString(R.string.strNotSupported),
114    Toast.LENGTH_SHORT).show();
115  0 } else if (v == btnPhoto) {
116  0 Toast.makeText(this, getString(R.string.strNotSupported),
117    Toast.LENGTH_SHORT).show();
118    }
119    }
120   
 
121  0 toggle protected void onActivityResult(int requestCode, int resultCode, Intent data) {
122  0 note = data.getStringExtra("Note");
123  0 if (note != null)
124  0 Toast.makeText(this, getString(R.string.strNoteAdded),
125    Toast.LENGTH_SHORT).show();
126   
127    }
128   
 
129  0 toggle public void text() {
130  0 Toast.makeText(this, "Deleting", Toast.LENGTH_SHORT).show();
131    }
132   
133    /*------------------------------------------------------------------------------------------------
134    *--------------------------------------MENU------------------------------------------------------
135    *------------------------------------------------------------------------------------------------ */
136   
 
137  6 toggle public boolean onCreateOptionsMenu(Menu menu) {
138  6 Log.i("ODA", "Menu Inflating...");
139  6 MenuInflater inflater = getMenuInflater();
140  6 inflater.inflate(R.menu.menu, menu);
141  6 Log.i("ODA", "Menu Inflated");
142  6 return true;
143    }
144   
 
145  5 toggle @Override
146    public boolean onOptionsItemSelected(MenuItem item) {
147  5 Log.i("ODA", "Menu...");
148  5 switch (item.getItemId()) {
149  3 case R.id.mnuEdit:
150  3 Log.i("ODA", "Menu Edit");
151  3 saveApp.outlay.inflate(outlayId);
152  3 Bundle bundle = new Bundle();
153  3 bundle.putBoolean("HasChanges", false);
154  3 bundle.putInt("Id", outlayId);
155  3 Intent intentEdit = new Intent(this.getApplicationContext(),
156    OutlayEditActivity.class);
157  3 intentEdit.putExtras(bundle);
158  3 Log.i("ODA", "Start Activity For Editint");
159  3 startActivity(intentEdit);
160  3 return true;
161  2 case R.id.mnuDelete:
162  2 Log.i("ODA", "Menu Delete");
163  2 deleteOutlay();
164  2 return true;
165  0 default:
166  0 return super.onOptionsItemSelected(item);
167    }
168    }
169   
170    /*------------------------------------------------------------------------------------------------
171    *--------------------------------------ALERT DIALOG------------------------------------------------------
172    *------------------------------------------------------------------------------------------------ */
173   
 
174  2 toggle public void deleteOutlay() {
175  2 Log.i("ODA", "Delete Alert");
176  2 AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
177  2 alt_bld.setMessage(getString(R.string.strDialogDelete))
178    .setCancelable(true)
179    .setPositiveButton(getString(R.string.strYes),
180    new DialogInterface.OnClickListener() {
 
181  1 toggle public void onClick(DialogInterface dialog, int id) {
182  1 delete();
183    }
184    })
185    .setNegativeButton(getString(R.string.strNo),
186    new DialogInterface.OnClickListener() {
 
187  1 toggle public void onClick(DialogInterface dialog, int id) {
188    // Action for 'NO' Button
189  1 dialog.cancel();
190    }
191    });
192  2 AlertDialog alert = alt_bld.create();
193  2 alert.setTitle(getString(R.string.strAlert));
194  2 alert.setIcon(R.drawable.alert);
195  2 alert.show();
196    }
197    }