Clover Coverage Report - Main Coverage Report
Coverage timestamp: ven dic 19 2014 16:47:52 EST
../../../../img/srcFileCovDistChart7.png 35% of files have more coverage
38   140   21   2,38
10   106   0,55   16
16     1,31  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  BicycleList       Line # 20 38 21 70,3% 0.703125
 
No Tests
 
1    package com.dreamcatcher.bicycle.activity;
2   
3    import android.app.Activity;
4    import android.app.ProgressDialog;
5    import android.os.Bundle;
6    import android.widget.ListView;
7    import android.widget.Toast;
8   
9    import com.dreamcatcher.bicycle.R;
10    import com.dreamcatcher.bicycle.adapter.BicycleListAdapter;
11    import com.dreamcatcher.bicycle.core.BicycleService;
12    import com.dreamcatcher.bicycle.interfaces.IHttpEvent;
13    import com.dreamcatcher.bicycle.interfaces.ISettingEvent;
14    import com.dreamcatcher.bicycle.util.Constants;
15    import com.dreamcatcher.bicycle.util.Utils;
16    import com.dreamcatcher.bicycle.view.ActivityTitle;
17    import com.dreamcatcher.bicycle.view.ActivityTitle.IActivityTitleRightImageClickEvent;
18    import com.dreamcatcher.bicycle.vo.BicycleNumberInfo;
19   
 
20    public class BicycleList extends Activity implements IHttpEvent, ISettingEvent{
21    private ActivityTitle mActivityTitle = null;
22    private BicycleListAdapter mAdapter = null;
23    private ListView mListView = null;
24    private ProgressDialog mProgressDialog = null;
25   
 
26  1 toggle @Override
27    protected void onCreate(Bundle savedInstanceState) {
28    // TODO Auto-generated method stub
29  1 super.onCreate(savedInstanceState);
30  1 setContentView(R.layout.bicycle_list);
31  1 init();
32    }
33   
 
34  1 toggle private void init(){
35  1 this.addEvent();
36   
37  1 mActivityTitle = (ActivityTitle) findViewById(R.id.bicycle_title);
38  1 mActivityTitle.setActivityTitle(getText(R.string.title_list));
39   
40  1 IActivityTitleRightImageClickEvent rightImageClickEvent = new IActivityTitleRightImageClickEvent() {
 
41  2 toggle public void onRightImageClicked() {
42  2 loadAllBicyclesInfoFromServer();
43    }
44    };
45   
46  1 mActivityTitle.setRightImage(R.drawable.ic_titlebar_refresh, rightImageClickEvent, false);
47   
48  1 mListView = (ListView) findViewById(R.id.bicycle_listview);
49  1 mAdapter = new BicycleListAdapter();
50  1 mListView.setAdapter(mAdapter);
51   
52    }
53   
54   
 
55  0 toggle @Override
56    protected void onDestroy() {
57  0 this.removeEvent();
58  0 super.onDestroy();
59    }
60   
 
61  0 toggle @Override
62    public boolean onSearchRequested() {
63    // TODO Auto-generated method stub
64   
65  0 return super.onSearchRequested();
66    }
67   
 
68  1 toggle private void addEvent(){
69  1 BicycleService.getInstance().getHttpEventListener().addEvent(this);
70  1 BicycleService.getInstance().getSettingEventListener().addEvent(this);
71    }
72   
 
73  0 toggle private void removeEvent(){
74  0 BicycleService.getInstance().getHttpEventListener().removeEvent(this);
75  0 BicycleService.getInstance().getSettingEventListener().removeEvent(this);
76    }
77   
 
78  0 toggle @Override
79    public void onBackPressed() {
80  0 this.getParent().onBackPressed();
81    }
82   
 
83  2 toggle private void loadAllBicyclesInfoFromServer(){
84  2 if(Utils.getNetworkInfo() == Constants.NetworkInfo.DISCONNECT){
85  0 Toast.makeText(this, R.string.toast_msg_network_error, Toast.LENGTH_SHORT).show();
86  0 return;
87    }
88  2 if(mProgressDialog == null){
89  1 mProgressDialog = new ProgressDialog(this);
90  1 mProgressDialog.setMessage(getText(R.string.list_progress_dialog_msg));
91    }
92  2 mProgressDialog.show();
93  2 BicycleService.getInstance().getHttpService().getAllBicyclesInfo();
94    }
95   
 
96  2 toggle public void onAllBicyclesInfoReceived(int resultCode) {
97  2 if(mProgressDialog != null){
98  2 mProgressDialog.dismiss();
99   
100    }
101  2 if(resultCode == Constants.ResultCode.SUCCESS){
102  0 mAdapter.updateDataset();
103  0 Toast.makeText(this, R.string.toast_msg_bicycles_info_refresh_success, Toast.LENGTH_SHORT).show();
104    }else {
105  2 Toast.makeText(this, R.string.toast_msg_server_unavailable, Toast.LENGTH_SHORT).show();
106    }
107    }
108   
 
109  0 toggle public void onSingleBicycleNumberInfoReceived(
110    BicycleNumberInfo bicycleNumberInfo, int resultCode) {
111    }
112   
 
113  1 toggle public void onNewVersionCheckCompleted(boolean needUpdate, int resultCode) {
114    }
115   
116    /**
117    *
118    */
 
119  2 toggle public void onCitySettingChanged(int resultCode) {
120  2 if(resultCode == Constants.ResultCode.SUCCESS){
121  2 mAdapter.updateDataset();
122    }
123    }
124   
 
125  8 toggle public void onFavoriteIdsChanged() {
126    // TODO Auto-generated method stub
127   
128    }
129   
 
130  5 toggle @Override
131    protected void onResume() {
132  5 super.onResume();
133    }
134   
 
135  5 toggle @Override
136    protected void onPause() {
137  5 super.onPause();
138    }
139   
140    }