diff --git a/UNCCScavenger/res/drawable-hdpi/compass_rose_brosen.png b/UNCCScavenger/res/drawable-hdpi/compass_rose_brosen.png deleted file mode 100644 index c8a2804..0000000 Binary files a/UNCCScavenger/res/drawable-hdpi/compass_rose_brosen.png and /dev/null differ diff --git a/UNCCScavenger/res/drawable-hdpi/map.png b/UNCCScavenger/res/drawable-hdpi/map.png deleted file mode 100644 index b3f14c9..0000000 Binary files a/UNCCScavenger/res/drawable-hdpi/map.png and /dev/null differ diff --git a/UNCCScavenger/res/layout/activity_found.xml b/UNCCScavenger/res/layout/activity_found.xml index e7cd8fd..0e7436f 100644 --- a/UNCCScavenger/res/layout/activity_found.xml +++ b/UNCCScavenger/res/layout/activity_found.xml @@ -16,14 +16,6 @@ android:text="@string/found_text" android:textAppearance="?android:attr/textAppearanceLarge" /> - - rotationAverage = new ArrayList(MOVING_AVERAGE_SIZE); LocationManager locationManager; DirectionListener locationListener; Location searchLocation; @@ -70,13 +64,6 @@ public class CompassActivity extends Activity implements SensorEventListener searchImageView.setImageBitmap(b); } - /*Test Values - searchLocation.setLatitude(35.30719258);//woodward eagle - searchLocation.setLongitude(-80.73505447); - searchLocation = new Location(LocationManager.NETWORK_PROVIDER); - searchLocation.setLatitude(35.310043);//Bottom of Student Union bridge - searchLocation.setLongitude(-80.733734);*/ - searchLocation = new Location(LocationManager.NETWORK_PROVIDER); searchLocation.setLatitude((float)(restLocation.getLocationLat())); searchLocation.setLongitude((float)(restLocation.getLocationLong())); @@ -97,8 +84,6 @@ public class CompassActivity extends Activity implements SensorEventListener finish(); } }); - - //Toast.makeText(this, ""+searchLocation.getLatitude()+", "+searchLocation.getLongitude(), Toast.LENGTH_SHORT).show(); } @Override @@ -149,21 +134,11 @@ public class CompassActivity extends Activity implements SensorEventListener SensorManager.getOrientation(rotation, compassValues); //Calculate true north and angle to desired location - //float azimuth = (float) (Math.toDegrees(compassValues[0])); float trueHeading = (float)(Math.toDegrees(compassValues[0]) + locationListener.getDeclination()); //Calculate bearing to search location float rotateArrow = (float) (trueHeading - locationListener.getBearing()); - //Add rotate average later. Does not handle wrap around when exactly at 0 degrees - /* Take moving average of bearing to smooth it out - if (rotationAverage.size() == MOVING_AVERAGE_SIZE) { - rotationAverage.remove(0); - } - rotationAverage.add(rotateArrow); - float finalRotation = findAverage(rotationAverage);*/ - - - //Rotate compass and arrow. Rotations must be opposite to counteract device movement + //Rotate compass pointer accordingly arrowView.setRotation((long)(-1 * rotateArrow)); if(locationListener.getDistance() <= SEARCH_PROXIMITY) @@ -183,13 +158,4 @@ public class CompassActivity extends Activity implements SensorEventListener // TODO Auto-generated method stub } - - /*private float findAverage(List list) { - float sum = 0.0f; - for (Float f : list) { - sum += f; - } - Toast.makeText(CompassActivity.this, ""+(sum/list.size()), Toast.LENGTH_SHORT).show(); - return sum / list.size(); - }*/ } diff --git a/UNCCScavenger/src/edu/uncc/scavenger/DirectionListener.java b/UNCCScavenger/src/edu/uncc/scavenger/DirectionListener.java index 45d81e6..8045fcb 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/DirectionListener.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/DirectionListener.java @@ -11,7 +11,6 @@ import android.hardware.GeomagneticField; import android.location.Location; import android.location.LocationListener; import android.os.Bundle; -import android.widget.TextView; public class DirectionListener implements LocationListener { @@ -30,8 +29,6 @@ public class DirectionListener implements LocationListener @Override public void onLocationChanged(Location location) { - //String lat = ""+location.getLatitude(); - //String lon = ""+location.getLongitude(); geoField = new GeomagneticField( (float)location.getLatitude(), diff --git a/UNCCScavenger/src/edu/uncc/scavenger/FoundActivity.java b/UNCCScavenger/src/edu/uncc/scavenger/FoundActivity.java index d3f8441..97c469b 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/FoundActivity.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/FoundActivity.java @@ -12,17 +12,13 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; -import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.view.ViewDebug.FlagToString; import android.webkit.WebView; import android.widget.Button; -import android.widget.TextView; public class FoundActivity extends Activity { - TextView numberFoundText; Button tryMoreButton; WebView moreInfoWebView; Intent intent; @@ -33,12 +29,9 @@ public class FoundActivity extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_found); - numberFoundText = (TextView)findViewById(R.id.numberFoundText); moreInfoWebView = (WebView)findViewById(R.id.moreInfoWebView); tryMoreButton = (Button)findViewById(R.id.tryMoreButton); - numberFoundText.setVisibility(View.INVISIBLE); - restLocation = (RestLocation)(getIntent().getSerializableExtra("restLocation")); moreInfoWebView.loadData(restLocation.getKey(), "text/html", "UTF-8"); diff --git a/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java b/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java index 80a838e..7bdc42d 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/MainActivity.java @@ -12,7 +12,6 @@ import java.util.List; import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.util.Log; import android.view.Menu; import android.view.View; import android.view.ViewGroup; @@ -22,7 +21,6 @@ import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; -import android.widget.Toast; import edu.uncc.scavenger.database.LocationDatabaseHelper; import edu.uncc.scavenger.rest.LocationClient; import edu.uncc.scavenger.rest.RestLocation; @@ -39,21 +37,6 @@ public class MainActivity extends Activity { locationList = (ListView)findViewById(R.id.listLocations); - /*Test Code for mock location - RestLocation location = new RestLocation(); - location.setId(1); - location.setName("Bridge"); - location.setRiddle("Riddle"); - location.setLocationLong(-80.733734); - location.setLocationLat(35.310043); - location.setKey("Key"); - location.setRiddleImageURL("http://rmss.uncc.edu/sites/rmss.uncc.edu/files/media/Belk%20Tower.jpg"); - Intent intent = new Intent(getApplicationContext(), SearchActivity.class); - intent.putExtra("restLocation", location); - startActivity(intent); - finish(); - /*End Test Code*/ - // Get our list of events loaded locationList = (ListView)findViewById(R.id.listLocations); locations = LocationDatabaseHelper.getInstance(this).fetchAll(); @@ -74,7 +57,6 @@ public class MainActivity extends Activity { // We don't yet have any locations... ((TextView)findViewById(R.id.txtNoLocations)).setVisibility(View.VISIBLE); ((ListView)findViewById(R.id.listLocations)).setVisibility(View.GONE); - //Log.d("Location", "NoLocations"); } // And kick off contacting to server to see if there are any new ones diff --git a/UNCCScavenger/src/edu/uncc/scavenger/SearchActivity.java b/UNCCScavenger/src/edu/uncc/scavenger/SearchActivity.java index dfcacea..12f9bc5 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/SearchActivity.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/SearchActivity.java @@ -177,7 +177,7 @@ public class SearchActivity extends Activity { protected void onPostExecute(String result) { super.onPostExecute(result); key = result; - //Toast.makeText(getApplicationContext(), key, Toast.LENGTH_SHORT).show(); + if(key!= null) { restLocation.setKey(key); diff --git a/UNCCScavenger/src/edu/uncc/scavenger/database/LocationDatabaseHelper.java b/UNCCScavenger/src/edu/uncc/scavenger/database/LocationDatabaseHelper.java index 6c2f75b..5b71b88 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/database/LocationDatabaseHelper.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/database/LocationDatabaseHelper.java @@ -17,9 +17,7 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; -import android.database.sqlite.SQLiteStatement; public class LocationDatabaseHelper extends SQLiteOpenHelper { diff --git a/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java b/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java index 1aa6ee7..53ce4ec 100644 --- a/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java +++ b/UNCCScavenger/src/edu/uncc/scavenger/rest/LocationClient.java @@ -20,7 +20,6 @@ import retrofit.RetrofitError; import retrofit.converter.GsonConverter; import android.content.Context; import android.os.AsyncTask; -import android.util.Log; import edu.uncc.scavenger.R; public class LocationClient {