diff --git a/HW3/res/layout/activity_main.xml b/HW3/res/layout/activity_main.xml
index 556bb40..6336ceb 100644
--- a/HW3/res/layout/activity_main.xml
+++ b/HW3/res/layout/activity_main.xml
@@ -194,7 +194,8 @@
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
- android:text="@string/btnNewGame" />
+ android:text="@string/btnNewGame"
+ android:onClick="newGame"/>
+ android:text="@string/btnUnCover"
+ android:onClick="uncover" />
\ No newline at end of file
diff --git a/HW3/res/values/dimens.xml b/HW3/res/values/dimens.xml
index 2e0e2ae..39b7c0d 100644
--- a/HW3/res/values/dimens.xml
+++ b/HW3/res/values/dimens.xml
@@ -3,5 +3,7 @@
16dp
16dp
+ 80dp
+ 80dp
diff --git a/HW3/src/com/uncc/hw3/MainActivity.java b/HW3/src/com/uncc/hw3/MainActivity.java
index e1cb355..15237e0 100644
--- a/HW3/src/com/uncc/hw3/MainActivity.java
+++ b/HW3/src/com/uncc/hw3/MainActivity.java
@@ -7,16 +7,39 @@ package com.uncc.hw3;
* MainActivity.java
*/
+import java.util.ArrayList;
+import java.util.Collections;
+
import android.os.Bundle;
+import android.os.Handler;
import android.app.Activity;
import android.view.Menu;
+import android.view.View;
+import android.widget.ImageView;
-public class MainActivity extends Activity {
-
+public class MainActivity extends Activity
+{
+
+ ImageView iv;
+ public int [] imageViews = {R.id.imgTile1_1, R.id.imgTile1_2, R.id.imgTile1_3, R.id.imgTile1_4,
+ R.id.imgTile2_1, R.id.imgTile2_2, R.id.imgTile2_3, R.id.imgTile2_4,
+ R.id.imgTile3_1, R.id.imgTile3_2, R.id.imgTile3_3, R.id.imgTile3_4,
+ R.id.imgTile4_1, R.id.imgTile4_2, R.id.imgTile4_3, R.id.imgTile4_4,};
+ public int[] iconIds = {R.drawable.diamond, R.drawable.garnet, R.drawable.gem, R.drawable.pearl, R.drawable.ruby, R.drawable.sapphire, R.drawable.swarovski, R.drawable.toppaz};
+ static ArrayList tiles;
+ static ArrayList focusImages;
+ Handler handler = new Handler();
+ static int focusIndex;
+ static long startTime, endTime;
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+
+ newGame((View)findViewById(R.id.LinearLayout1));
+ focusImages.get(focusIndex).show();
}
@Override
@@ -26,4 +49,64 @@ public class MainActivity extends Activity {
return true;
}
+ public void newGame(View v)
+ {
+ tiles = new ArrayList();
+ focusImages = new ArrayList();
+ ArrayList focusImagesTemp = new ArrayList();
+
+ //Create list of board tiles and tiles to find
+ for(int x: iconIds)
+ {
+ tiles.add(new Tile(null, x));
+ tiles.add(new Tile(null, x));
+ focusImagesTemp.add(new Tile((ImageView)findViewById(R.id.imgResult), x));
+ }
+
+ //Shuffle Tiles
+ Collections.shuffle(tiles);
+ Collections.shuffle(focusImagesTemp);
+
+ //Set focusImages list
+ for(int x=0; x