No time for comments :(
authorgumartinm <gustavo@gumartinm.name>
Wed, 5 Sep 2012 00:21:39 +0000 (02:21 +0200)
committergumartinm <gustavo@gumartinm.name>
Wed, 5 Sep 2012 00:21:39 +0000 (02:21 +0200)
res/values/strings.xml
src/de/android/reversi/ReversiView.java

index fa5b469..07047e2 100644 (file)
@@ -2,8 +2,8 @@
 
     <string name="app_name">Reversi</string>
     <string name="hello_world">Hello world!</string>
-    <string name="AIwon">YOU LOST!</string>
-    <string name="Iwin">I WIN!</string>
+    <string name="player1WON">YOU LOST!</string>
+    <string name="player2WON">I WIN!</string>
     <string name="menu_settings">Settings</string>
     <string name="title_activity_reversi">ReversiActivity</string>
     <string name="player1">Black: </string>
index d8cff67..c36f04c 100644 (file)
@@ -276,7 +276,13 @@ public class ReversiView extends SurfaceView {
             listAllowedPositions = board.allowedPositions(currentPlayer);
 
             if (listAllowedPositions.isEmpty()) {
-                final DialogFragment newFragment = ErrorDialogFragment.newInstance(R.string.Iwin);
+                int idString;
+                if (player1Score > player2Score) {
+                    idString = R.string.player1WON;
+                } else {
+                    idString = R.string.player2WON;
+                }
+                final DialogFragment newFragment = ErrorDialogFragment.newInstance(idString);
                 newFragment.show(((Activity)context).getFragmentManager(), "errorDialog");
             }
 
@@ -310,7 +316,13 @@ public class ReversiView extends SurfaceView {
                         mainLoop(ai.getBestMove(board));
                     }
                     else {
-                        final DialogFragment newFragment = ErrorDialogFragment.newInstance(R.string.AIwon);
+                        int idString;
+                        if (player1Score > player2Score) {
+                            idString = R.string.player1WON;
+                        } else {
+                            idString = R.string.player2WON;
+                        }
+                        final DialogFragment newFragment = ErrorDialogFragment.newInstance(idString);
                         newFragment.show(((Activity)context).getFragmentManager(), "errorDialog");
                     }
                 }