Commits

littledot5566 committed e84d06c

*Added number formatting in ProfileActivity. *Fixed treasure info due to view re-use in HistoryActivity.

  • Participants
  • Parent commits 2af5a8e

Comments (0)

Files changed (5)

src/nctuw/littledot/localtreasure/MapOverlay.java

 
 import java.util.ArrayList;
 
-import android.app.AlertDialog;
+import org.holoeverywhere.app.AlertDialog;
+
 import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.location.Location;
 
 public class MapOverlay extends ItemizedOverlay<OverlayItem> {
 
-	private ArrayList<OverlayItem>	mOverlays	= new ArrayList<OverlayItem>();
-	private Context									mContext;
+	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
+	private Context mContext;
 
 	public MapOverlay(Drawable defaultMarker) {
 		super(boundCenterBottom(defaultMarker));

src/nctuw/littledot/localtreasure/components/ExpeditionActivity.java

 				mController.setCenter(new GeoPoint(
 						(int) (mExpedition.getDestLoc().getLatitude() * 1E6),
 						(int) (mExpedition.getDestLoc().getLongitude() * 1E6)));
-				mController.setZoom(11);
+				mController.setZoom(14);
 
 				isCalibrated = true;
 
 		if (id == LOCATION_LOCK_DIALOG) {
 			pdLock.setTitle("Calibrating device");
 			pdLock.setMessage("Please walk around so that the GPS can get a fix");
-			pdLock.setCanceledOnTouchOutside(false);
+			// pdLock.setCanceledOnTouchOutside(false);
 			pdLock.setOnCancelListener(new OnCancelListener() {
 				public void onCancel(DialogInterface dialog) {
-					// finish();
 					dialog.dismiss();
+					finish();
 				}
 			});
 			return pdLock;
 			// mSP.setActiveExpeditionID(eID);
 
 			startMarker.clearOverlay();
-			startMarker
-					.addLocation(location, "Cali-Start", location.toString());
+			startMarker.addLocation(location, "Cali-Start", location.toString());
 			destMarker.clearOverlay();
 			destMarker.addLocation(mExpedition.getDestLoc(), "Cali-Dest",
 					mExpedition.getDestLoc().toString());
 			mController.setCenter(new GeoPoint(
 					(int) (location.getLatitude() * 1E6),
 					(int) (location.getLongitude() * 1E6)));
-			mController.setZoom(11);
+			mController.setZoom(14);
 
 			isCalibrated = true;
 

src/nctuw/littledot/localtreasure/components/HistoryActivityAdapter.java

 		if ((i = kv.getAsInteger(Expedition.KEY_TREASURE_ID)) > 0) {
 			Treasure t = Treasure.getTreasure(i);
 			tvTreasure.setText(t.getName());
+			tvTreasure.setVisibility(View.VISIBLE);
 			ivTreasure.setImageResource(t.getDrawableID());
+			ivTreasure.setVisibility(View.VISIBLE);
+		} else {
+			tvTreasure.setVisibility(View.INVISIBLE);
+			ivTreasure.setVisibility(View.INVISIBLE);
 		}
 
 		return view;

src/nctuw/littledot/localtreasure/components/ProfileActivity.java

 package nctuw.littledot.localtreasure.components;
 
+import java.text.NumberFormat;
+
 import nctuw.littledot.localtreasure.Const;
 import nctuw.littledot.localtreasure.R;
 import nctuw.littledot.localtreasure.database.Database;
 
 		mDB = new Database(this).open(Database.MODE_WRITE);
 
+		NumberFormat nf = NumberFormat.getInstance();
+
 		tvName.setText(mProfile.getName());
 		tvExpeditionTotal.setText("Total expeditions="
 				+ mProfile.getTotalExpeditions());
 		tvTotalDistance.setText("Total distance travelled="
-				+ mProfile.getTotalDistance());
+				+ nf.format(mProfile.getTotalDistance()) + "m");
 
 		// Support Action Bar (future work)
 		// ActionBar ab = getSupportActionBar();

src/nctuw/littledot/localtreasure/database/Treasure.java

 	/** Interface Parcelable **/
 	/**************************/
 
-	public int describeContents() {
-		return 0;
-	}
-
-	public void writeToParcel(Parcel dest, int flags) {
-		dest.writeInt(mID);
-	}
-
-	public static final Parcelable.Creator<Treasure> CREATOR = new Parcelable.Creator<Treasure>() {
-		public Treasure createFromParcel(Parcel in) {
-			return getTreasure(in.readInt());
-		}
-
-		public Treasure[] newArray(
-				int size) {
-			return new Treasure[size];
-		}
-	};
+	// public int describeContents() {
+	// return 0;
+	// }
+	//
+	// public void writeToParcel(Parcel dest, int flags) {
+	// dest.writeInt(mID);
+	// }
+	//
+	// public static final Parcelable.Creator<Treasure> CREATOR = new
+	// Parcelable.Creator<Treasure>() {
+	// public Treasure createFromParcel(Parcel in) {
+	// return getTreasure(in.readInt());
+	// }
+	//
+	// public Treasure[] newArray(
+	// int size) {
+	// return new Treasure[size];
+	// }
+	// };
 
 }