DroidFish: Made sharing games from ChessBase app work.

This commit is contained in:
Peter Osterlund 2016-12-12 19:43:56 +01:00
parent 3fa87c01eb
commit 558a4abcea
2 changed files with 4 additions and 2 deletions

View File

@ -693,7 +693,7 @@ public class DroidFish extends Activity
"application/x-chess-fen".equals(intent.getType())))
pgnOrFen = intent.getStringExtra(Intent.EXTRA_TEXT);
} else {
String scheme = intent.getScheme();
String scheme = data.getScheme();
if ("file".equals(scheme)) {
filename = data.getEncodedPath();
if (filename != null)
@ -703,7 +703,7 @@ public class DroidFish extends Activity
("content".equals(scheme) ||
"file".equals(scheme))) {
ContentResolver resolver = getContentResolver();
InputStream in = resolver.openInputStream(intent.getData());
InputStream in = resolver.openInputStream(data);
StringBuilder sb = new StringBuilder();
while (true) {
byte[] buffer = new byte[16384];

View File

@ -262,6 +262,8 @@ public class DroidChessController {
/** Parse a string as FEN or PGN data. */
public final synchronized void setFENOrPGN(String fenPgn) throws ChessParseError {
if (!fenPgn.isEmpty() && fenPgn.charAt(0) == '\ufeff')
fenPgn = fenPgn.substring(1); // Remove BOM
Game newGame = new Game(gameTextListener, game.timeController.tcData);
try {
Position pos = TextIO.readFEN(fenPgn);