DroidFish: Implemented function to share a PGN game.

This commit is contained in:
Peter Osterlund 2012-07-16 11:47:29 +00:00
parent 46c62f232d
commit 1de1e05025
2 changed files with 19 additions and 3 deletions

View File

@ -29,6 +29,8 @@ you are not actively using the program.\
<string name="copy_game">Copy Game to Clipboard</string>
<string name="copy_position">Copy Position to Clipboard</string>
<string name="paste">Paste from Clipboard</string>
<string name="share">Share</string>
<string name="share_pgn_game">Share PGN game</string>
<string name="load_game">Load game from PGN file</string>
<string name="load_scid_game">Load game from Scid file</string>
<string name="save_game">Save game to PGN file</string>

View File

@ -1430,15 +1430,17 @@ public class DroidFish extends Activity implements GUIInterface {
final int COPY_GAME = 0;
final int COPY_POSITION = 1;
final int PASTE = 2;
final int LOAD_GAME = 3;
final int SAVE_GAME = 4;
final int LOAD_SCID_GAME = 5;
final int SHARE = 3;
final int LOAD_GAME = 4;
final int SAVE_GAME = 5;
final int LOAD_SCID_GAME = 6;
List<CharSequence> lst = new ArrayList<CharSequence>();
List<Integer> actions = new ArrayList<Integer>();
lst.add(getString(R.string.copy_game)); actions.add(COPY_GAME);
lst.add(getString(R.string.copy_position)); actions.add(COPY_POSITION);
lst.add(getString(R.string.paste)); actions.add(PASTE);
lst.add(getString(R.string.share)); actions.add(SHARE);
lst.add(getString(R.string.load_game)); actions.add(LOAD_GAME);
lst.add(getString(R.string.save_game)); actions.add(SAVE_GAME);
if (hasScidProvider()) {
@ -1475,6 +1477,10 @@ public class DroidFish extends Activity implements GUIInterface {
}
break;
}
case SHARE: {
shareGame();
break;
}
case LOAD_GAME:
selectPgnFile(false);
break;
@ -2145,6 +2151,14 @@ public class DroidFish extends Activity implements GUIInterface {
return null;
}
private final void shareGame() {
Intent i = new Intent(Intent.ACTION_SEND);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_TEXT, ctrl.getPGN());
startActivity(Intent.createChooser(i, getString(R.string.share_pgn_game)));
}
private Dialog makeButtonDialog(ButtonActions buttonActions) {
List<CharSequence> names = new ArrayList<CharSequence>();
final List<UIAction> actions = new ArrayList<UIAction>();