Permalink
Browse files

Don't get remote points if there is no network, and move user overlay…

… when the user moves(untested).
  • Loading branch information...
1 parent 73a77cf commit 769da0e018e6f73f6d1389703d498a3e1378ac48 Thaddeus Taylor committed Apr 24, 2012
@@ -1,6 +1,5 @@
package edu.pitt.designs1635.ParkIt;
-import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -36,5 +35,10 @@ public boolean draw(Canvas canvas,
canvas.drawBitmap(bmp, screenPts.x-15, screenPts.y-15, null);
return true;
}
+
+ public void setLocation(GeoPoint p)
+ {
+ m_point = p;
+ }
}
@@ -235,9 +235,14 @@ public boolean onOptionsItemSelected(MenuItem item) {
public void getRemotePoints()
{
+
+ if (!isNetworkAvailable())
+ return;
+
ab.setTitle("Refreshing Points...");
setSupportProgressBarIndeterminateVisibility(true);
-
+
+
Parse.initialize(this, "pAtl7R7WUbPl3RIVMD9Ov8UDVODGYSJ9tImxKTPQ", "cgjq64nO8l5RVbmrqYH3Nv2VC1zPyX4904htpXPy");
ParseQuery query = new ParseQuery("Points");
query.findInBackground(new FindCallback() {
@@ -266,11 +271,12 @@ public void pointsProcessing(List<ParseObject> objs)
public void refreshAllPoints()
{
- if(mDbHelper == null)
- {
+ //if(mDbHelper == null)
+ //{
mDbHelper.open();
- mCursor = mDbHelper.fetchAllRows();
- }
+
+ //}
+ mCursor = mDbHelper.fetchAllRows();
startManagingCursor(mCursor);
mCursor.moveToFirst();
drawable = getResources().getDrawable(R.drawable.g_icon);
@@ -337,6 +343,17 @@ private void updateLocation(GeoPoint p)
{
if(p != null)
mapCtrl.animateTo(p);
+
+ if (cLocationOverlay != null)
+ {
+ GeoPoint currentLocation = getCurrentLocation();
+ if(currentLocation != null)
+ {
+ mapView.getOverlays().remove(cLocationOverlay);
+ cLocationOverlay = new CurrentLocationOverlay(currentLocation);
+ mapView.getOverlays().add(cLocationOverlay);
+ }
+ }
}
private GeoPoint getCurrentLocation()

0 comments on commit 769da0e

Please sign in to comment.