DroidFish: Moved more strings to strings.xml.

This commit is contained in:
Peter Osterlund 2011-12-17 18:01:08 +00:00
parent 148d12f090
commit 3c9f4a676c
3 changed files with 31 additions and 21 deletions

View File

@ -322,6 +322,8 @@ you are not actively using the program.\
<string name="no_next_game">No next game</string>
<string name="ok">Ok</string>
<string name="cancel">Cancel</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="move_number">Move number:</string>
<string name="filename">Filename:</string>
<string name="halfmove">Halfmove clock:</string>
@ -369,6 +371,14 @@ you are not actively using the program.\
<string name="delete_file">Delete file</string>
<string name="delete_file_question">Delete file?</string>
<string name="delete_named_file">Delete file %s?</string>
<string name="game_saved">Game saved</string>
<string name="failed_to_save_game">Failed to save game</string>
<string name="failed_to_delete_game">Failed to delete game</string>
<string name="file_too_large">File too large</string>
<string name="save_game_question">Save game?</string>
<string name="before_selected">Before Selected</string>
<string name="after_selected">After Selected</string>
<string name="replace_selected">Replace Selected</string>
<string name="err_too_few_spaces">Too few spaces</string>
<string name="err_invalid_piece">Invalid piece</string>

View File

@ -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();
}
});
}

View File

@ -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;
}