Clover Coverage Report - Main Coverage Report
Coverage timestamp: ven dic 19 2014 16:47:52 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
34   108   13   3,4
6   84   0,38   10
10     1,3  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  SelectCityActivity       Line # 22 34 13 94% 0.94
 
No Tests
 
1    package com.dreamcatcher.bicycle.activity;
2   
3    import android.app.Activity;
4    import android.app.ProgressDialog;
5    import android.content.Intent;
6    import android.os.Bundle;
7    import android.view.View;
8    import android.view.View.OnClickListener;
9    import android.widget.Button;
10    import android.widget.ListView;
11   
12    import com.dreamcatcher.bicycle.R;
13    import com.dreamcatcher.bicycle.adapter.CityListAdapter;
14    import com.dreamcatcher.bicycle.adapter.CityListAdapter.ICityListEvent;
15    import com.dreamcatcher.bicycle.core.BicycleService;
16    import com.dreamcatcher.bicycle.interfaces.IAssetsEvent;
17    import com.dreamcatcher.bicycle.interfaces.IAssetsService;
18    import com.dreamcatcher.bicycle.util.Constants;
19    import com.dreamcatcher.bicycle.util.Utils;
20    import com.dreamcatcher.bicycle.view.ActivityTitle;
21   
 
22    public class SelectCityActivity extends Activity implements IAssetsEvent{
23    private int mSelectedCityIndex = -1;
24    private IAssetsService mAssetsService = null;
25    private ProgressDialog mProgressDialog = null;
26   
 
27  1 toggle @Override
28    protected void onCreate(Bundle savedInstanceState) {
29    // TODO Auto-generated method stub
30  1 super.onCreate(savedInstanceState);
31  1 setContentView(R.layout.select_city);
32  1 init();
33    }
34   
 
35  1 toggle @Override
36    protected void onDestroy() {
37  1 this.removeEvent();
38  1 super.onDestroy();
39    }
40   
 
41  1 toggle private void init(){
42  1 this.addEvent();
43   
44  1 mAssetsService = BicycleService.getInstance().getAssertsService();
45   
46  1 ActivityTitle activityTitle = (ActivityTitle) findViewById(R.id.bicycle_title);
47  1 activityTitle.setActivityTitle(R.string.title_select_city);
48   
49  1 ListView listView = (ListView) findViewById(R.id.select_city_list);
50   
51  1 ICityListEvent citySelectEvent = new ICityListEvent() {
 
52  2 toggle public void onCityItemClicked(int index) {
53  2 mSelectedCityIndex = index;
54    }
55    };
56   
57  1 CityListAdapter adapter = new CityListAdapter(citySelectEvent, 0);
58   
59  1 listView.setAdapter(adapter);
60   
61  1 Button nextBtn = (Button) findViewById(R.id.select_city_next_btn);
62  1 nextBtn.setOnClickListener(new OnClickListener() {
 
63  1 toggle public void onClick(View v) {
64  1 onNextBtnClicked();
65    }
66    });
67   
68    }
69   
70   
 
71  1 toggle private void addEvent(){
72  1 BicycleService.getInstance().getAssetsEventListener().addEvent(this);
73    }
74   
 
75  1 toggle private void removeEvent(){
76  1 BicycleService.getInstance().getAssetsEventListener().removeEvent(this);
77    }
78   
 
79  1 toggle private void onNextBtnClicked(){
80  1 if(mSelectedCityIndex != -1){
81  1 final String cityTag = Constants.CitySetting.CITY_TAG[mSelectedCityIndex];
82   
83  1 mProgressDialog = new ProgressDialog(this);
84  1 mProgressDialog.setMessage(getText(R.string.progress_dialog_loading_msg));
85  1 mProgressDialog.show();
86   
87  1 Utils.storeStringDataToLocal(Constants.LocalStoreTag.CITY_NAME, cityTag);
88  1 mAssetsService.loadCitySetting();
89    }
90    }
91   
 
92  1 toggle public void onCitySettingLoaded(int resultCode) {
93  1 if(resultCode == Constants.ResultCode.SUCCESS){
94  1 mAssetsService.loadBicyclesInfo();
95    }
96    }
97   
 
98  1 toggle public void onBicyclesInfoLoaded(int resultCode) {
99  1 if (resultCode == Constants.ResultCode.SUCCESS) {
100  1 Intent data = new Intent();
101  1 data.putExtra("load_completed", true);
102  1 setResult(RESULT_OK, data);
103  1 mProgressDialog.dismiss();
104  1 finish();
105    }
106    }
107   
108    }