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

View File

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