Commits

littledot5566 committed f139352

*Implementing TreasureActivity.

  • Participants
  • Parent commits 10e090c

Comments (0)

Files changed (8)

File release/TODO.txt

-v Continue active expedition
-v Expedition list in ListView form
-
-* delete expedition from history
+v Continue active expedition.
+v Expedition list in ListView form.
+v delete expedition from history.
+* Help/About/Credits button telling users what this app is about, thanks for icons, etc.
+* Expedition statistics. Graph of travelled distance over days, etc.
+* Display treasure in a trophy case.

File res/layout/chest_act.xml

+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <GridView
+        android:id="@+id/chest_gv_frame"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:columnWidth="90dp"
+        android:gravity="center"
+        android:horizontalSpacing="10dp"
+        android:numColumns="auto_fit"
+        android:stretchMode="columnWidth"
+        android:verticalSpacing="10dp" />
+
+</LinearLayout>

File res/layout/main_act_layout.xml

         android:onClick="onClick"
         android:text="History" />
 
+    <Button
+        android:id="@+id/main_but_chest"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:onClick="onClick"
+        android:text="Treasure Chest" />
+
 </LinearLayout>

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

 
 	private ListView lvHistory;
 	private HistoryActivityAdapter mAdapter;
-	private DialogManager mDM = new DialogManager();;
 
 	@Override
 	protected void onCreate(Bundle savedInstanceState) {
 
 		mAdapter = new HistoryActivityAdapter(this);
 		lvHistory.setAdapter(mAdapter);
-
 		lvHistory.setOnItemClickListener(new OnItemClickListener() {
 			@Override
 			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
 					long arg3) {
 				Leg.a("arg2=" + arg2 + " arg3=" + arg3);
-				mDM.deleteExpeditionDialog(HistoryActivity.this, arg2).show();
+				deleteExpeditionDialog(arg2).show();
 			}
 		});
 
 		super.onPause();
 	}
 
-	private static final int CONTINUE = 1;
-	private static final int DELETE = 2;
-
-	private class DialogManager {
-
-		public Dialog deleteExpeditionDialog(Context ctx, final int pos) {
-			AlertDialog.Builder b = new AlertDialog.Builder(ctx);
-			b.setTitle("hello");
-			b.setItems(new CharSequence[] { "Continue", "Delete" },
-					new OnClickListener() {
-						@Override
-						public void onClick(DialogInterface dialog, int which) {
-							Leg.a("which=" + which);
-							if (which == 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 if (which == 1) {
-								mAdapter.deleteExpedition(pos);
-							}
-
-							dialog.dismiss();
+	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) {
+							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 if (which == 1) {
+							mAdapter.deleteExpedition(pos);
 						}
-					});
 
-			return b.create();
+						dialog.dismiss();
+					}
+				});
+
+		return b.create();
 
-		}
 	}
 
 }

File src/nctuw/littledot/localtreasure/components/MainActivity.java

 			intent.putExtra(Const.BUNDLE_SOURCE, getClass().getName());
 			startActivity(intent);
 
+		} else if (id == R.id.main_but_chest) {
+			Intent intent = new Intent(this, TreasureActivity.class);
+			intent.putExtra(Const.BUNDLE_SOURCE, getClass().getName());
+			startActivity(intent);
 		}
 	}
 }

File src/nctuw/littledot/localtreasure/components/TreasureActivity.java

+package nctuw.littledot.localtreasure.components;
+
+import nctuw.littledot.localtreasure.R;
+
+import org.holoeverywhere.app.Activity;
+
+import android.os.Bundle;
+import android.widget.GridView;
+
+public class TreasureActivity extends Activity {
+
+	private GridView gvTreasure;
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+
+		gvTreasure = (GridView) findViewById(R.id.chest_gv_frame);
+
+	}
+
+	@Override
+	protected void onResume() {
+		super.onResume();
+	}
+
+	@Override
+	protected void onPause() {
+		super.onPause();
+	}
+}

File src/nctuw/littledot/localtreasure/components/TreasureActivityAdapter.java

+package nctuw.littledot.localtreasure.components;
+
+import nctuw.littledot.localtreasure.database.Database;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+public class TreasureActivityAdapter extends BaseAdapter {
+
+	private Database mDB;
+
+	@Override
+	public int getCount() {
+		return 0;
+	}
+
+	@Override
+	public Object getItem(int arg0) {
+		return null;
+	}
+
+	@Override
+	public long getItemId(int position) {
+		return 0;
+	}
+
+	@Override
+	public View getView(int position, View convertView, ViewGroup parent) {
+		return null;
+	}
+
+}

File src/nctuw/littledot/localtreasure/expedition/DialogManager.java

 		// Create the AlertDialog object and return it
 		return builder.create();
 	}
-
-	// public static Dialog deleteExpeditionDialog(Context ctx, long eid) {
-	//
-	// AlertDialog.Builder b = new AlertDialog.Builder(ctx);
-	//
-	// b.setTitle("hello");
-	//
-	// b.setItems(new CharSequence[] { "Continue", "Delete" },
-	// new OnClickListener() {
-	//
-	// @Override
-	// public void onClick(DialogInterface dialog, int which) {
-	// Leg.a("which=" + which);
-	// if (which == 1) {
-	// } else if (which == 2) {
-	// }
-	//
-	// dialog.dismiss();
-	// }
-	// });
-	//
-	// return b.create();
-	//
-	// }
 }