Clover Coverage Report - RaspberryBusMalaysiaActivity Coverage Report
Coverage timestamp: mar dic 23 2014 15:39:35 EST
../../../img/srcFileCovDistChart9.png 36% of files have more coverage
36   101   14   18
22   64   0,39   2
2     7  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  RbmMapActivity       Line # 35 36 14 90% 0.9
 
No Tests
 
1    /*
2    Copyright (C) 2012 Sweetie Piggy Apps <sweetiepiggyapps@gmail.com>
3   
4    This file is part of Raspberry Bus Malaysia.
5   
6    Raspberry Bus Malaysia is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10   
11    Raspberry Bus Malaysia is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14    GNU General Public License for more details.
15   
16    You should have received a copy of the GNU General Public License
17    along with Raspberry Bus Malaysia; if not, see <http://www.gnu.org/licenses/>.
18    */
19   
20    package com.sweetiepiggy.raspberrybusmalaysia;
21   
22    import java.util.List;
23   
24    import android.database.Cursor;
25    import android.graphics.drawable.Drawable;
26    import android.os.Bundle;
27   
28    import com.google.android.maps.GeoPoint;
29    import com.google.android.maps.MapActivity;
30    import com.google.android.maps.MapController;
31    import com.google.android.maps.MapView;
32    import com.google.android.maps.Overlay;
33    import com.google.android.maps.OverlayItem;
34   
 
35    public class RbmMapActivity extends MapActivity
36    {
37    /* center map here */
38    private static final GeoPoint CENTER_GEOPOINT = new GeoPoint(3657249,102144600);
39    private static final int CENTER_ZOOM = 8;
40   
41    /** Called when the activity is first created. */
 
42  9 toggle @Override
43    public void onCreate(Bundle savedInstanceState)
44    {
45  9 super.onCreate(savedInstanceState);
46  9 setContentView(R.layout.map);
47   
48  9 Bundle b = getIntent().getExtras();
49  9 boolean draw_routes = (b == null) ? false : b.getBoolean("draw_routes");
50  9 boolean set_result = (b == null) ? false : b.getBoolean("set_result");
51  9 boolean valid_from = (b == null) ? false : b.getBoolean("valid_from");
52  9 boolean valid_to = (b == null) ? false : b.getBoolean("valid_to");
53  9 String from_city = (b == null) ? "" : b.getString("from_city");
54  9 if (from_city == null || from_city.length() == 0) {
55  7 valid_to = false;
56    }
57   
58  9 MapView mv = (MapView) findViewById(R.id.mapview);
59  9 mv.setBuiltInZoomControls(true);
60   
61  9 List<Overlay> mapOverlays = mv.getOverlays();
62  9 Drawable drawable = getResources().getDrawable(R.drawable.ic_launcher);
63  9 RbmItemizedOverlay itemizedoverlay = new RbmItemizedOverlay(drawable, this, set_result);
64   
65  9 DbAdapter dbHelper = new DbAdapter();
66  9 dbHelper.open(this);
67  9 Cursor c = valid_from ? dbHelper.fetch_from_stations() :
68  7 valid_to ? dbHelper.fetch_to_stations_from_city(from_city) :
69    dbHelper.fetch_stations();
70  9 if (c.moveToFirst()) do {
71  495 int latitude = c.getInt(c.getColumnIndex(DbAdapter.KEY_LATITUDE));
72  495 int longitude = c.getInt(c.getColumnIndex(DbAdapter.KEY_LONGITUDE));
73  495 String station = c.getString(c.getColumnIndex(DbAdapter.KEY_STN));
74  495 String city = c.getString(c.getColumnIndex(DbAdapter.KEY_CITY));
75   
76  495 GeoPoint gp = new GeoPoint(latitude, longitude);
77  495 OverlayItem oi = new OverlayItem(gp, station, city);
78  495 itemizedoverlay.addOverlay(oi);
79  495 } while (c.moveToNext());
80  9 c.close();
81  9 dbHelper.close();
82   
83  9 mapOverlays.add(itemizedoverlay);
84   
85  9 if (draw_routes) {
86  1 mapOverlays.add(new RouteOverlay(this, mv.getProjection()));
87    }
88   
89  9 MapController mc = mv.getController();
90  9 mc.setCenter(CENTER_GEOPOINT);
91  9 mc.setZoom(CENTER_ZOOM);
92    }
93   
94   
 
95  44 toggle @Override
96    protected boolean isRouteDisplayed()
97    {
98  44 return false;
99    }
100    }
101