Clover Coverage Report - Main Coverage Report
Coverage timestamp: ven dic 19 2014 16:47:52 EST
../../../../img/srcFileCovDistChart5.png 64% of files have more coverage
36   102   15   3,6
8   79   0,42   10
10     1,5  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  SplashScreen       Line # 15 36 15 48,1% 0.4814815
 
No Tests
 
1    package com.dreamcatcher.bicycle.activity;
2   
3    import android.app.Activity;
4    import android.content.Intent;
5    import android.os.Bundle;
6   
7    import com.dreamcatcher.bicycle.R;
8    import com.dreamcatcher.bicycle.core.BicycleService;
9    import com.dreamcatcher.bicycle.interfaces.IAssetsEvent;
10    import com.dreamcatcher.bicycle.interfaces.IAssetsService;
11    import com.dreamcatcher.bicycle.util.Constants;
12    import com.dreamcatcher.bicycle.util.GlobalSetting;
13    import com.dreamcatcher.bicycle.util.Utils;
14   
 
15    public class SplashScreen extends Activity implements IAssetsEvent{
16    private IAssetsService mAssetsService = null;
17   
 
18  1 toggle @Override
19    protected void onCreate(Bundle savedInstanceState) {
20  1 super.onCreate(savedInstanceState);
21  1 setContentView(R.layout.splash_screen);
22    }
23   
 
24  1 toggle @Override
25    protected void onDestroy() {
26  1 this.removeEvent();
27  1 super.onDestroy();
28    }
29   
 
30  1 toggle private void addEvent(){
31  1 BicycleService.getInstance().getAssetsEventListener().addEvent(this);
32    }
33   
 
34  1 toggle private void removeEvent(){
35  1 BicycleService.getInstance().getAssetsEventListener().removeEvent(this);
36    }
37   
 
38  1 toggle @Override
39    protected void onResume() {
40  1 super.onResume();
41  1 this.init();
42    }
43   
 
44  1 toggle private void init(){
45  1 this.addEvent();
46   
47  1 mAssetsService = BicycleService.getInstance().getAssertsService();
48  1 mAssetsService.loadCitySetting();
49   
50    //get next ad shown time
51  1 long nextShowAdTime = Utils.getLongDataFromLocal(Constants.LocalStoreTag.NEXT_AD_SHOWN_TIME, 0);
52   
53  1 GlobalSetting.getInstance().getAdsetting().setNextShowAdTime(nextShowAdTime);
54    }
55   
 
56  0 toggle private void getBicycleInfo(){
57  0 boolean success = loadAllBicyclesInfoFromLocal();
58  0 if(!success){
59  0 mAssetsService.loadBicyclesInfo();
60    }else {
61  0 Intent data = new Intent();
62  0 data.putExtra("load_completed", true);
63  0 setResult(RESULT_OK, data);
64  0 finish();
65    }
66    }
67   
 
68  0 toggle private boolean loadAllBicyclesInfoFromLocal(){
69  0 String jsonStr = Utils.getStringDataFromLocal(Constants.LocalStoreTag.ALL_BICYCLE);
70  0 if(jsonStr == null || jsonStr.equals("")){
71  0 return false;
72    }
73  0 Utils.setToDataset(jsonStr);
74  0 return true;
75    }
76   
77    /**
78    * load city setting result
79    */
 
80  1 toggle public void onCitySettingLoaded(int resultCode) {
81  1 if(resultCode == Constants.ResultCode.SUCCESS){
82  0 getBicycleInfo();
83    }else {
84  1 Intent data = new Intent();
85  1 data.putExtra("load_completed", false);
86  1 setResult(RESULT_OK, data);
87  1 finish();
88    }
89    }
90   
91    /**
92    * load bicycles info result
93    */
 
94  0 toggle public void onBicyclesInfoLoaded(int resultCode) {
95  0 if (resultCode == Constants.ResultCode.SUCCESS) {
96  0 Intent data = new Intent();
97  0 data.putExtra("load_completed", true);
98  0 setResult(RESULT_OK, data);
99  0 finish();
100    }
101    }
102    }