DroidFish: Show toast when quick loading FEN from file.

When loading a position from a file using the quick next/previous key
actions, display a toast containing the whole line from the EPD/FEN
file.
This commit is contained in:
Peter Osterlund 2018-10-14 09:16:39 +02:00
parent 2038855893
commit 9a6b374856

@ -152,7 +152,7 @@ public class LoadFEN extends ListActivity {
finish(); finish();
} else { } else {
defaultItem = loadItem; defaultItem = loadItem;
sendBackResult(fensInFile.get(loadItem)); sendBackResult(fensInFile.get(loadItem), true);
} }
} }
}); });
@ -210,7 +210,7 @@ public class LoadFEN extends ListActivity {
okButton.setOnClickListener(new OnClickListener() { okButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
if (selectedFi != null) if (selectedFi != null)
sendBackResult(selectedFi); sendBackResult(selectedFi, false);
} }
}); });
cancelButton.setOnClickListener(new OnClickListener() { cancelButton.setOnClickListener(new OnClickListener() {
@ -269,7 +269,7 @@ public class LoadFEN extends ListActivity {
chessPos = e2.pos; chessPos = e2.pos;
} }
if (chessPos != null) if (chessPos != null)
sendBackResult(selectedFi); sendBackResult(selectedFi, false);
return true; return true;
} }
}); });
@ -352,9 +352,11 @@ public class LoadFEN extends ListActivity {
return true; return true;
} }
private final void sendBackResult(FenInfo fi) { private final void sendBackResult(FenInfo fi, boolean toast) {
String fen = fi.fen; String fen = fi.fen;
if (fen != null) { if (fen != null) {
if (toast)
DroidFishApp.toast(String.valueOf(fi.gameNo) + ": " + fen, Toast.LENGTH_SHORT);
setResult(RESULT_OK, (new Intent()).setAction(fen)); setResult(RESULT_OK, (new Intent()).setAction(fen));
finish(); finish();
} else { } else {