diff --git a/DroidFish/res/values/strings.xml b/DroidFish/res/values/strings.xml
index c9dcc6e..f26211a 100644
--- a/DroidFish/res/values/strings.xml
+++ b/DroidFish/res/values/strings.xml
@@ -322,6 +322,8 @@ you are not actively using the program.\
No next game
Ok
Cancel
+ Yes
+ No
Move number:
Filename:
Halfmove clock:
@@ -369,6 +371,14 @@ you are not actively using the program.\
Delete file
Delete file?
Delete file %s?
+ Game saved
+ Failed to save game
+ Failed to delete game
+ File too large
+ Save game?
+ Before Selected
+ After Selected
+ Replace Selected
Too few spaces
Invalid piece
diff --git a/DroidFish/src/org/petero/droidfish/activities/EditPGN.java b/DroidFish/src/org/petero/droidfish/activities/EditPGN.java
index 5845708..955e5c0 100644
--- a/DroidFish/src/org/petero/droidfish/activities/EditPGN.java
+++ b/DroidFish/src/org/petero/droidfish/activities/EditPGN.java
@@ -313,13 +313,13 @@ public class EditPGN extends ListActivity {
builder.setTitle(R.string.delete_game);
String msg = gi.toString();
builder.setMessage(msg);
- builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
+ builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
deleteGame(gi);
dialog.cancel();
}
});
- builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
+ builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
@@ -331,8 +331,12 @@ public class EditPGN extends ListActivity {
final GameInfo gi = selectedGi;
selectedGi = null;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle("Save game?");
- final CharSequence[] items = { "Before Selected", "After Selected", "Replace Selected" };
+ builder.setTitle(R.string.save_game_question);
+ final CharSequence[] items = {
+ getString(R.string.before_selected),
+ getString(R.string.after_selected),
+ getString(R.string.replace_selected),
+ };
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
GameInfo giToReplace;
@@ -356,13 +360,13 @@ public class EditPGN extends ListActivity {
String name = new File(pgnFile.getName()).getName();
String msg = String.format(getString(R.string.delete_named_file), name);
builder.setMessage(msg);
- builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
+ builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
pgnFile.delete();
finish();
}
});
- builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
+ builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
@@ -389,7 +393,8 @@ public class EditPGN extends ListActivity {
if (p.first == GameInfoResult.OUT_OF_MEMORY) {
runOnUiThread(new Runnable() {
public void run() {
- Toast.makeText(getApplicationContext(), "File too large", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getApplicationContext(), R.string.file_too_large,
+ Toast.LENGTH_SHORT).show();
}
});
}
diff --git a/DroidFish/src/org/petero/droidfish/activities/PGNFile.java b/DroidFish/src/org/petero/droidfish/activities/PGNFile.java
index 1825058..467f65a 100644
--- a/DroidFish/src/org/petero/droidfish/activities/PGNFile.java
+++ b/DroidFish/src/org/petero/droidfish/activities/PGNFile.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
+import org.petero.droidfish.R;
import org.petero.droidfish.gamelogic.Pair;
import android.app.Activity;
@@ -306,12 +307,10 @@ public class PGNFile {
FileWriter fw = new FileWriter(fileName, true);
fw.write(pgn);
fw.close();
- Toast.makeText(context, "Game saved", Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, R.string.game_saved, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
- if (context != null) {
- String msg = "Failed to save game";
- Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
- }
+ if (context != null)
+ Toast.makeText(context, R.string.failed_to_save_game, Toast.LENGTH_SHORT).show();
}
}
@@ -343,10 +342,8 @@ public class PGNFile {
}
return true;
} catch (IOException e) {
- if (context != null) {
- String msg = "Failed to delete game";
- Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
- }
+ if (context != null)
+ Toast.makeText(context, R.string.failed_to_delete_game, Toast.LENGTH_SHORT).show();
}
return false;
}
@@ -363,13 +360,11 @@ public class PGNFile {
fileReader.close();
fileWriter.close();
tmpFile.renameTo(fileName);
- Toast.makeText(context, "Game saved", Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, R.string.game_saved, Toast.LENGTH_SHORT).show();
return true;
} catch (IOException e) {
- if (context != null) {
- String msg = "Failed to save game";
- Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
- }
+ if (context != null)
+ Toast.makeText(context, R.string.failed_to_save_game, Toast.LENGTH_SHORT).show();
}
return false;
}