Commits

littledot5566 committed 0bf257e

*Release v0.1

  • Participants
  • Parent commits b0a2b82

Comments (0)

Files changed (5)

AndroidManifest.xml

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="nctuw.littledot.localtreasure"
-    android:versionCode="1"
+    android:versionCode="2"
     android:versionName="0.1" >
 
     <uses-sdk
 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
     <uses-permission android:name="android.permission.INTERNET" />
 
     <application

proguard-project.txt

 -libraryjars ../HoloEverywhere/library/bin/he.jar
 -libraryjars ../ActionBarSherlock/library/bin/abs.jar
 -libraryjars ../Utils/bin/utils.jar
+#-libraryjars E:\android-sdk-linux\add-ons\addon-google_apis-google-16\libs\maps.jar
 
 -keep class com.actionbarsherlock.** {*;}
 -keep class org.holoeverywhere.** {*;}
+#-keep class com.google.** {*;}
 -assumenosideeffects class nctuw.littledot.util.Leg {*;}
 
 
 # class:
 #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
 #   public *;
-#}
-
--assumenosideeffects class nctuw.littledot.Leg 
+#}

project.properties

 # project structure.
 #
 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+#proguard.config=proguard-project.txt
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt
 
 # Project target.
 target=Google Inc.:Google APIs:16
-android.library.reference.1=..\\Utils
-android.library.reference.2=..\\ActionBarSherlock\\library
-android.library.reference.3=..\\HoloEverywhere\\library
+android.library.reference.1=../Utils
+android.library.reference.2=../ActionBarSherlock/library
+android.library.reference.3=../HoloEverywhere/library

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

 
 import org.holoeverywhere.app.Activity;
 import org.holoeverywhere.app.AlertDialog;
-import org.holoeverywhere.app.Dialog;
 import org.holoeverywhere.widget.ListView;
 import org.holoeverywhere.widget.Toast;
 
 			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
 					long arg3) {
 				Leg.a("arg2=" + arg2 + " arg3=" + arg3);
-				deleteExpeditionDialog(arg2).show();
+				// deleteExpeditionDialog(arg2).show();
+				Bundle args = new Bundle();
+				args.putInt(KEY_POS, arg2);
+				showDialog(DIALOG_EXP_OPTIONS, args);
 			}
 		});
 
 		super.onPause();
 	}
 
-	public Dialog deleteExpeditionDialog(final int pos) {
-		AlertDialog.Builder b = new AlertDialog.Builder(this);
-		b.setItems(new CharSequence[] { "Continue", "Delete" },
-				new OnClickListener() {
-					@Override
-					public void onClick(DialogInterface dialog, int which) {
-						Leg.a("which=" + which);
-						if (which == 0) {
-							ContentValues expedition = mAdapter.getItem(pos);
-							// expedition has not concluded yet
-							if (expedition.getAsLong(Expedition.KEY_END_TIMESTAMP) == 0) {
-
-								Intent intent = new Intent(HistoryActivity.this,
-										ExpeditionActivity.class);
-								intent.putExtra(Const.BUNDLE_SOURCE, HistoryActivity.this
-										.getClass().getName());
-								intent.putExtra(Const.BUNDLE_EID, mAdapter.getItemId(pos));
-								startActivity(intent);
-
-								finish();
-							} else
-								Toast.makeText(HistoryActivity.this,
-										"This expedition has concluded and cannot be continued.",
-										Toast.LENGTH_SHORT).show();
-						} else if (which == 1) {
-
-							AlertDialog.Builder builder = new AlertDialog.Builder(
-									HistoryActivity.this);
-
-							builder.setTitle("Delete expedition?")
-									.setMessage("Are you sure you want to delete this record?")
-									.setPositiveButton("Yes", new OnClickListener() {
-										@Override
-										public void onClick(DialogInterface dialog, int which) {
-											mAdapter.deleteExpedition(pos);
-											dialog.dismiss();
-										}
-									}).setNegativeButton("No", new OnClickListener() {
-										@Override
-										public void onClick(DialogInterface dialog, int which) {
-											dialog.dismiss();
-										}
-									});
-
-							builder.create().show();
-
-							// mAdapter.deleteExpedition(pos);
+	private int DIALOG_EXP_OPTIONS = 1;
+	private int DIALOG_CONFIRM = 2;
+	private String KEY_POS = "pos";
+
+	@Override
+	@Deprecated
+	protected android.app.Dialog onCreateDialog(int id, final Bundle args) {
+
+		if (id == DIALOG_EXP_OPTIONS) {
+			final int pos = args.getInt(KEY_POS);
+
+			AlertDialog.Builder b = new AlertDialog.Builder(this);
+			b.setItems(new CharSequence[] { "Continue", "Delete" },
+					new OnClickListener() {
+						@Override
+						public void onClick(DialogInterface dialog, int which) {
+							Leg.a("which=" + which);
+							if (which == 0) {
+								ContentValues expedition = mAdapter.getItem(pos);
+								// expedition has not concluded yet
+								if (expedition.getAsLong(Expedition.KEY_END_TIMESTAMP) == 0) {
+
+									Intent intent = new Intent(HistoryActivity.this,
+											ExpeditionActivity.class);
+									intent.putExtra(Const.BUNDLE_SOURCE, HistoryActivity.this
+											.getClass().getName());
+									intent.putExtra(Const.BUNDLE_EID, mAdapter.getItemId(pos));
+									startActivity(intent);
+
+									finish();
+								} else
+									Toast.makeText(HistoryActivity.this,
+											"This expedition has concluded and cannot be continued.",
+											Toast.LENGTH_SHORT).show();
+							} else if (which == 1) {
+								showDialog(DIALOG_CONFIRM, args);
+								// mAdapter.deleteExpedition(pos);
+							}
+
+							dialog.dismiss();
+						}
+					});
+			return b.create();
+			
+		} else if (id == DIALOG_CONFIRM) {
+			AlertDialog.Builder b = new AlertDialog.Builder(
+					HistoryActivity.this);
+
+			final int pos = args.getInt(KEY_POS);
+
+			b.setTitle("Delete expedition?")
+					.setMessage("Are you sure you want to delete this record?")
+					.setPositiveButton("Yes", new OnClickListener() {
+						@Override
+						public void onClick(DialogInterface dialog, int which) {
+							mAdapter.deleteExpedition(pos);
+							dialog.dismiss();
 						}
+					}).setNegativeButton("No", new OnClickListener() {
+						@Override
+						public void onClick(DialogInterface dialog, int which) {
+							dialog.dismiss();
+						}
+					});
+			return b.create();
+		}
 
-						dialog.dismiss();
-					}
-				});
-		return b.create();
+		return super.onCreateDialog(id, args);
 	}
+
+	// public Dialog deleteExpeditionDialog(final int pos) {
+	// AlertDialog.Builder b = new AlertDialog.Builder(this);
+	// b.setItems(new CharSequence[] { "Continue", "Delete" },
+	// new OnClickListener() {
+	// @Override
+	// public void onClick(DialogInterface dialog, int which) {
+	// Leg.a("which=" + which);
+	// if (which == 0) {
+	// ContentValues expedition = mAdapter.getItem(pos);
+	// // expedition has not concluded yet
+	// if (expedition.getAsLong(Expedition.KEY_END_TIMESTAMP) == 0) {
+	//
+	// Intent intent = new Intent(HistoryActivity.this,
+	// ExpeditionActivity.class);
+	// intent.putExtra(Const.BUNDLE_SOURCE, HistoryActivity.this
+	// .getClass().getName());
+	// intent.putExtra(Const.BUNDLE_EID, mAdapter.getItemId(pos));
+	// startActivity(intent);
+	//
+	// finish();
+	// } else
+	// Toast.makeText(HistoryActivity.this,
+	// "This expedition has concluded and cannot be continued.",
+	// Toast.LENGTH_SHORT).show();
+	// } else if (which == 1) {
+	//
+	// AlertDialog.Builder builder = new AlertDialog.Builder(
+	// HistoryActivity.this);
+	//
+	// builder.setTitle("Delete expedition?")
+	// .setMessage("Are you sure you want to delete this record?")
+	// .setPositiveButton("Yes", new OnClickListener() {
+	// @Override
+	// public void onClick(DialogInterface dialog, int which) {
+	// mAdapter.deleteExpedition(pos);
+	// dialog.dismiss();
+	// }
+	// }).setNegativeButton("No", new OnClickListener() {
+	// @Override
+	// public void onClick(DialogInterface dialog, int which) {
+	// dialog.dismiss();
+	// }
+	// });
+	//
+	// builder.create().show();
+	//
+	// // mAdapter.deleteExpedition(pos);
+	// }
+	//
+	// dialog.dismiss();
+	// }
+	// });
+	// return b.create();
+	// }
 }

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

 	 * @return
 	 */
 	public static Treasure generateReward(Expedition e) {
-		if (e.getTravelled() < 400D)
+		if (e.getTravelled() < 300D)
 			return null;
 
 		Random rand = new Random();
 		int index = 0;
 
 		// different tiers of reward based on distance travelled?
-		if (e.getTravelled() > 400D)
+		if (e.getTravelled() > 300D)
 			index = rand.nextInt(values().length);
 
 		return values()[index];