Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dialelo/GeoAlarms
...
head fork: dialelo/GeoAlarms
compare: fdf845ced3
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
9 src/main/java/com/geoalarms/activity/AlarmList.java
@@ -3,10 +3,9 @@
import java.util.LinkedList;
import java.util.List;
-import com.geoalarms.GeoAlarms;
import com.geoalarms.R;
+import com.geoalarms.GeoAlarms;
import com.geoalarms.model.Alarm;
-import com.geoalarms.model.AlarmManager;
import com.geoalarms.model.Coordinates;
import android.app.Activity;
@@ -19,7 +18,6 @@
public class AlarmList extends Activity {
private ListView alarmlist;
- private AlarmManager manager;
private ArrayAdapter<String> adapter;
private LinkedList<String> values;
@@ -27,8 +25,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listalarms);
- this.manager = new AlarmManager();
- List<Alarm> alarms = manager.getAllAlarms();
+ List<Alarm> alarms = GeoAlarms.alarmManager.getAllAlarms();
values = new LinkedList<String>();
@@ -69,7 +66,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// save the alarm object into DB
Alarm alarm = new Alarm(radius, coords, name, description);
- this.manager.add(alarm);
+ GeoAlarms.alarmManager.add(alarm);
// update the listview elements
values.addFirst(name);
View
8 src/main/java/com/geoalarms/activity/Home.java
@@ -1,10 +1,8 @@
package com.geoalarms.activity;
-import com.geoalarms.GeoAlarms;
-
-import com.geoalarms.model.AlarmManager;
import com.geoalarms.R;
+import com.geoalarms.GeoAlarms;
import android.app.Activity;
import android.content.Intent;
@@ -13,14 +11,10 @@
public class Home extends Activity {
- private AlarmManager manager;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard);
-
- this.manager = new AlarmManager();
}
public void toMap(View v) {
View
1  src/main/java/com/geoalarms/db/AlarmDatabaseHelper.java
@@ -42,7 +42,6 @@ public AlarmDatabaseHelper () {
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(ALARMS_TABLE_CREATE);
- db.close();
}
@Override
View
12 src/main/java/com/geoalarms/model/AlarmManager.java
@@ -63,13 +63,19 @@ public void delete(Alarm... alarms) {
// get database
SQLiteDatabase db = this.databaseHelper.getReadableDatabase();
- Cursor cursor = db.rawQuery("SELECT * from alarms", null);
+ // TODO: improve query
+ Cursor cursor;
+ try {
+ cursor = db.rawQuery("SELECT * from alarms", null);
+ } catch (SQLiteException e) {
+ return alarms;
+ }
if (cursor.moveToFirst()) {
- while (cursor.moveToNext()) {
+ do {
Alarm alarm = this.alarmFromCursor(cursor);
alarms.add(alarm);
- }
+ } while (cursor.moveToNext());
}
db.close();
View
2  src/main/java/com/geoalarms/model/MapOverlay.java
@@ -57,7 +57,7 @@ public void draw(Canvas canvas, MapView mapView, boolean shadow) {
//// canv.drawText("%f,%f",geoPoint.getLatitudeE6(),geoPoint.getLongitudeE6(), centro.x + 10, centro.y + 5, p);
//
//
-//// Context context = GeoAlarms.getAppContext();
+//// Context context = GeoAlarms.context;
//// Toast.makeText(context, "Tapped", 10);
// return true;
// }

No commit comments for this range

Something went wrong with that request. Please try again.