Clover Coverage Report - RaspberryBusMalaysiaActivity Coverage Report
Coverage timestamp: mar dic 23 2014 15:39:35 EST
../../../img/srcFileCovDistChart10.png 0% of files have more coverage
51   134   13   6,38
2   101   0,25   8
8     1,62  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  RaspberryBusMalaysiaActivity       Line # 34 51 13 95,1% 0.9508197
 
No Tests
 
1    /*
2    Copyright (C) 2012,2013 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 android.app.Activity;
23    import android.content.Intent;
24    import android.content.res.Configuration;
25    import android.database.sqlite.SQLiteException;
26    import android.net.Uri;
27    import android.os.Bundle;
28    import android.view.Menu;
29    import android.view.MenuInflater;
30    import android.view.MenuItem;
31    import android.view.View;
32    import android.widget.TextView;
33   
 
34    public class RaspberryBusMalaysiaActivity extends Activity
35    {
36    private static final String SOURCE_URL = "https://github.com/sweetiepiggy/Raspberry-Bus-Malaysia";
37   
38    /** Called when the activity is first created. */
 
39  1 toggle @Override
40    public void onCreate(Bundle savedInstanceState)
41    {
42  1 super.onCreate(savedInstanceState);
43   
44  1 init();
45  1 try {
46    /* open database only to sync if it has not been created yet */
47  1 DbAdapter dbHelper = new DbAdapter();
48  1 dbHelper.open_readwrite(this);
49  1 dbHelper.check_last_update_and_sync();
50  1 dbHelper.close();
51    } catch (SQLiteException e) {
52    }
53    }
54   
 
55  1 toggle public void init()
56    {
57  1 int content_view = getResources().getConfiguration().orientation ==
58    Configuration.ORIENTATION_LANDSCAPE ?
59    R.layout.main_landscape : R.layout.main;
60  1 setContentView(content_view);
61   
62  1 TextView route = (TextView) findViewById(R.id.route);
63  1 route.setOnClickListener(new View.OnClickListener() {
 
64  1 toggle public void onClick(View v)
65    {
66  1 Intent intent = new Intent(getApplicationContext(), RouteActivity.class);
67  1 startActivity(intent);
68    }
69    });
70   
71  1 TextView submit_trip = (TextView) findViewById(R.id.submit_trip);
72  1 submit_trip.setOnClickListener(new View.OnClickListener() {
 
73  1 toggle public void onClick(View v)
74    {
75  1 Intent intent = new Intent(getApplicationContext(), SubmitTripActivity.class);
76  1 startActivity(intent);
77    }
78    });
79   
80  1 TextView map = (TextView) findViewById(R.id.map);
81  1 map.setOnClickListener(new View.OnClickListener() {
 
82  1 toggle public void onClick(View v)
83    {
84  1 Intent intent = new Intent(getApplicationContext(), RbmMapActivity.class);
85  1 Bundle b = new Bundle();
86  1 b.putBoolean("draw_routes", true);
87  1 intent.putExtras(b);
88  1 startActivity(intent);
89    }
90    });
91   
92  1 TextView complain = (TextView) findViewById(R.id.complain);
93  1 complain.setOnClickListener(new View.OnClickListener() {
 
94  1 toggle public void onClick(View v)
95    {
96  1 Intent intent = new Intent(getApplicationContext(), ComplainActivity.class);
97  1 startActivity(intent);
98    }
99    });
100    }
101   
 
102  1 toggle @Override
103    public boolean onCreateOptionsMenu(Menu menu) {
104  1 MenuInflater inflater = getMenuInflater();
105  1 inflater.inflate(R.menu.options_menu, menu);
106  1 return true;
107    }
108   
 
109  3 toggle @Override
110    public boolean onOptionsItemSelected(MenuItem item) {
111  3 Intent intent;
112  3 switch (item.getItemId()) {
113  1 case R.id.about:
114  1 intent = new Intent(getApplicationContext(), TextViewActivity.class);
115  1 Bundle b = new Bundle();
116  1 b.putString("text", getResources().getString(R.string.license));
117  1 intent.putExtras(b);
118  1 startActivity(intent);
119  1 return true;
120  1 case R.id.sync:
121  1 SyncTask sync = new SyncTask(this);
122  1 sync.execute();
123  1 return true;
124  1 case R.id.source:
125  1 intent = new Intent(Intent.ACTION_VIEW);
126  1 intent.setDataAndType(Uri.parse(SOURCE_URL), "text/html");
127  1 startActivity(Intent.createChooser(intent, null));
128  1 return true;
129  0 default:
130  0 return super.onOptionsItemSelected(item);
131    }
132    }
133    }
134