mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-12 17:12:40 +01:00
DroidFish: A long press on the positions list now loads the position immediately.
This commit is contained in:
@@ -53,6 +53,7 @@ import android.widget.ListView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.AdapterView.OnItemLongClickListener;
|
||||||
|
|
||||||
public class LoadFEN extends ListActivity {
|
public class LoadFEN extends ListActivity {
|
||||||
private static ArrayList<FenInfo> fensInFile = new ArrayList<FenInfo>();
|
private static ArrayList<FenInfo> fensInFile = new ArrayList<FenInfo>();
|
||||||
@@ -236,6 +237,24 @@ public class LoadFEN extends ListActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
lv.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
|
selectedFi = aa.getItem(pos);
|
||||||
|
if (selectedFi == null)
|
||||||
|
return false;
|
||||||
|
defaultItem = pos;
|
||||||
|
Position chessPos;
|
||||||
|
try {
|
||||||
|
chessPos = TextIO.readFEN(selectedFi.fen);
|
||||||
|
} catch (ChessParseError e2) {
|
||||||
|
chessPos = e2.pos;
|
||||||
|
}
|
||||||
|
if (chessPos != null)
|
||||||
|
sendBackResult(selectedFi);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
lv.requestFocus();
|
lv.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user