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
56   148   12   7
4   108   0,21   8
8     1,5  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  OutlaysListActivity       Line # 22 56 12 73,5% 0.7352941
 
No Tests
 
1    package com.loopback.androidapps.saveapp;
2   
3    import java.util.ArrayList;
4   
5    import android.app.ListActivity;
6    import android.content.Context;
7    import android.content.DialogInterface;
8    import android.content.DialogInterface.OnClickListener;
9    import android.content.Intent;
10    import android.content.res.Configuration;
11    import android.database.Cursor;
12    import android.graphics.PixelFormat;
13    import android.os.Bundle;
14    import android.util.Log;
15    import android.view.Display;
16    import android.view.View;
17    import android.view.WindowManager;
18    import android.widget.ListAdapter;
19    import android.widget.ListView;
20    import android.widget.TextView;
21   
 
22    public class OutlaysListActivity extends ListActivity implements
23    OnClickListener {
24   
25    private DBManager dbManager;
26    private ArrayList<Outlay> outlays = new ArrayList<Outlay>();
27    private ListAdapter listAdapter; // we will use this "custom adapter" to
28    // bind this data to the listView
29    private TextView txtAccount, footerDays, footerBudget;
30    private boolean landscape = false;
31   
32    public SaveApp saveApp;
33   
34    /*------------------------------------------------------------------------------------------------
35    *-------------------------------------- ON CREATE --------------------------------------------------
36    *------------------------------------------------------------------------------------------------ */
 
37  0 toggle public void onConfigurationChanged(Configuration newConfig) {
38  0 super.onConfigurationChanged(newConfig);
39   
40  0 Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
41    .getDefaultDisplay();
42  0 int orientation = display.getOrientation();
43  0 if (orientation == 1 || orientation == 3) {
44  0 setContentView(R.layout.outlayslistland);
45  0 landscape = true;
46    } else
47  0 setContentView(R.layout.outlayslist);
48   
49  0 loadActivity();
50    }
51   
 
52  9 toggle public void onCreate(Bundle savedInstanceState) {
53  9 super.onCreate(savedInstanceState);
54  9 getWindow().setFormat(PixelFormat.RGBA_8888);
55  9 getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
56  9 Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
57    .getDefaultDisplay();
58  9 int orientation = display.getOrientation();
59  9 if (orientation == 1 || orientation == 3) {
60  0 setContentView(R.layout.outlayslistland);
61  0 landscape = true;
62    } else
63  9 setContentView(R.layout.outlayslist);
64   
65  9 loadActivity();
66    }
67   
 
68  9 toggle public void loadActivity() {
69  9 Log.i("OLA", "Loading...");
70  9 saveApp = ((SaveApp) getApplicationContext());
71  9 dbManager = saveApp.getDbManager();
72    // Header
73  9 txtAccount = (TextView) findViewById(R.id.txtAccount);
74  9 txtAccount.setText(getString(R.string.strAccount) + ": "
75    + saveApp.getAccountDesc());
76   
77    // Reading Outlays from the DB
78  9 Log.i("OLA", "Reading...");
79  9 Cursor cursor = dbManager.select(-1, DBManager.OUTLAY_TABLE_ID);
80  9 DBReader dbReader = new DBReader();
81  9 dbReader.readOutlay(cursor);
82  9 outlays = dbReader.outlayList;
83   
84    // Inflating and bind this adapter to the ListActivity
85  9 Log.i("OLA", "Inflating...");
86  9 listAdapter = new OutlayAdapter(getApplicationContext(), outlays,
87    landscape);
88  9 this.setListAdapter(listAdapter);
89   
90    // Set Footer
91  9 Log.i("OLA", "Setting Footer...");
92  9 footerBudget = (TextView) findViewById(R.id.txtFooterBudget);
93  9 footerDays = (TextView) findViewById(R.id.txtFooterDays);
94  9 footerDays.setText(String.valueOf(saveApp.getCurrentDays()));
95  9 footerBudget.setText(saveApp.getCurrentBudget()
96    + saveApp.getCurrencySymbol());
97  9 sendTextToWidget(this);
98  9 Log.i("OLA", "Set.");
99    }
100   
101    /*------------------------------------------------------------------------------------------------
102    *--------------------------------------BUTTONS--------------------------------------------------
103    *------------------------------------------------------------------------------------------------ */
104   
105    /* BACK---------------------------------------------------- */
 
106  4 toggle public void onBackPressed() {
107  4 Log.i("OLA", "Back Pressed...");
108  4 Intent intent = new Intent(this.getApplicationContext(),
109    HomeActivity.class);
110  4 Log.i("OLA", "Starting Activity Home");
111  4 startActivity(intent);
112    }
113   
114    /* REST---------------------------------------------------- */
 
115  5 toggle public void onListItemClick(ListView parent, View v, int _position, long _id) {
116  5 Log.i("OLA", "ListItemClick"); // debug statement
117  5 int id = outlays.get(_position).getId();
118   
119  5 Bundle bundle = new Bundle();
120  5 bundle.putInt("Id", id);
121   
122  5 Log.i("OLA", "ListItemClick"); // debug statement
123   
124  5 Intent intent = new Intent(this.getApplicationContext(),
125    OutlayDetailActivity.class);
126  5 intent.putExtras(bundle);
127  5 Log.i("OLA", "Starting Activity Outlay Detail"); // debug statement
128  5 startActivity(intent);
129   
130    }
131   
132    /* NOT USED---------------------------------------------------- */
 
133  0 toggle public void onClick(View v) {
134  0 Log.d("Selections:", "Click"); // debug statement
135    }
136   
 
137  0 toggle public void onClick(DialogInterface dialog, int which) {
138  0 Log.d("Selections:", "Click"); // debug statement
139   
140    }
141   
 
142  9 toggle private void sendTextToWidget(Context context) {
143  9 Intent uiIntent = new Intent();
144  9 uiIntent.putExtra(Constants.INTENT_EXTRA_WIDGET_TEXT,footerBudget.getText());
145  9 context.sendBroadcast(uiIntent);
146    }
147   
148    }