mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-21 13:12:17 +01:00
DroidFish: Moved code in ChessBoard.java that is not used by ChessBoardEdit.java to new class ChessBoardPlay.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<view
|
<view
|
||||||
class="org.petero.droidfish.ChessBoard"
|
class="org.petero.droidfish.ChessBoardPlay"
|
||||||
android:id="@+id/chessboard"
|
android:id="@+id/chessboard"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"/>
|
android:layout_height="fill_parent"/>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<view
|
<view
|
||||||
class="org.petero.droidfish.ChessBoard"
|
class="org.petero.droidfish.ChessBoardPlay"
|
||||||
android:id="@+id/chessboard"
|
android:id="@+id/chessboard"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"/>
|
android:layout_height="fill_parent"/>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<view
|
<view
|
||||||
class="org.petero.droidfish.ChessBoard"
|
class="org.petero.droidfish.ChessBoardPlay"
|
||||||
android:id="@+id/chessboard"
|
android:id="@+id/chessboard"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|||||||
@@ -23,11 +23,8 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.petero.droidfish.gamelogic.Move;
|
import org.petero.droidfish.gamelogic.Move;
|
||||||
import org.petero.droidfish.gamelogic.MoveGen;
|
|
||||||
import org.petero.droidfish.gamelogic.Pair;
|
|
||||||
import org.petero.droidfish.gamelogic.Piece;
|
import org.petero.droidfish.gamelogic.Piece;
|
||||||
import org.petero.droidfish.gamelogic.Position;
|
import org.petero.droidfish.gamelogic.Position;
|
||||||
import org.petero.droidfish.gamelogic.TextIO;
|
|
||||||
import org.petero.droidfish.gamelogic.UndoInfo;
|
import org.petero.droidfish.gamelogic.UndoInfo;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -41,10 +38,8 @@ import android.os.Handler;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class ChessBoard extends View {
|
public abstract class ChessBoard extends View {
|
||||||
private PGNOptions pgnOptions = null;
|
|
||||||
public Position pos;
|
public Position pos;
|
||||||
|
|
||||||
public int selectedSquare;
|
public int selectedSquare;
|
||||||
@@ -56,7 +51,6 @@ public class ChessBoard extends View {
|
|||||||
int pieceXDelta, pieceYDelta; // top/left pixel draw position relative to square
|
int pieceXDelta, pieceYDelta; // top/left pixel draw position relative to square
|
||||||
public boolean flipped;
|
public boolean flipped;
|
||||||
public boolean drawSquareLabels;
|
public boolean drawSquareLabels;
|
||||||
boolean oneTouchMoves;
|
|
||||||
boolean toggleSelection;
|
boolean toggleSelection;
|
||||||
|
|
||||||
List<Move> moveHints;
|
List<Move> moveHints;
|
||||||
@@ -91,10 +85,6 @@ public class ChessBoard extends View {
|
|||||||
private Paint decorationPaint;
|
private Paint decorationPaint;
|
||||||
private ArrayList<Paint> moveMarkPaint;
|
private ArrayList<Paint> moveMarkPaint;
|
||||||
|
|
||||||
public void setPgnOptions(PGNOptions pgnOptions) {
|
|
||||||
this.pgnOptions = pgnOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChessBoard(Context context, AttributeSet attrs) {
|
public ChessBoard(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
pos = new Position();
|
pos = new Position();
|
||||||
@@ -106,7 +96,6 @@ public class ChessBoard extends View {
|
|||||||
pieceXDelta = pieceYDelta = -1;
|
pieceXDelta = pieceYDelta = -1;
|
||||||
flipped = false;
|
flipped = false;
|
||||||
drawSquareLabels = false;
|
drawSquareLabels = false;
|
||||||
oneTouchMoves = false;
|
|
||||||
toggleSelection = false;
|
toggleSelection = false;
|
||||||
|
|
||||||
darkPaint = new Paint();
|
darkPaint = new Paint();
|
||||||
@@ -360,12 +349,11 @@ public class ChessBoard extends View {
|
|||||||
userSelectedSquare = true;
|
userSelectedSquare = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getWidth(int sqSize) { return sqSize * 8; }
|
protected abstract int getWidth(int sqSize);
|
||||||
protected int getHeight(int sqSize) { return sqSize * 8; }
|
protected abstract int getHeight(int sqSize);
|
||||||
protected int getSqSizeW(int width) { return (width) / 8; }
|
protected abstract int getSqSizeW(int width);
|
||||||
protected int getSqSizeH(int height) { return (height) / 8; }
|
protected abstract int getSqSizeH(int height);
|
||||||
|
protected abstract int getMaxHeightPercentage();
|
||||||
protected int getMaxHeightPercentage() { return 75; }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
@@ -386,13 +374,9 @@ public class ChessBoard extends View {
|
|||||||
setMeasuredDimension(width, height);
|
setMeasuredDimension(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void computeOrigin(int width, int height) {
|
protected abstract void computeOrigin(int width, int height);
|
||||||
x0 = (width - sqSize * 8) / 2;
|
protected abstract int getXFromSq(int sq);
|
||||||
y0 = (height - sqSize * 8) / 2;
|
protected abstract int getYFromSq(int sq);
|
||||||
}
|
|
||||||
|
|
||||||
protected int getXFromSq(int sq) { return Position.getX(sq); }
|
|
||||||
protected int getYFromSq(int sq) { return Position.getY(sq); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
@@ -573,10 +557,10 @@ public class ChessBoard extends View {
|
|||||||
canvas.drawText(s, xCrd, yCrd, labelPaint);
|
canvas.drawText(s, xCrd, yCrd, labelPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getXCrd(int x) { return x0 + sqSize * (flipped ? 7 - x : x); }
|
protected abstract int getXCrd(int x);
|
||||||
protected int getYCrd(int y) { return y0 + sqSize * (flipped ? y : 7 - y); }
|
protected abstract int getYCrd(int y);
|
||||||
protected int getXSq(int xCrd) { int t = (xCrd - x0) / sqSize; return flipped ? 7 - t : t; }
|
protected abstract int getXSq(int xCrd);
|
||||||
protected int getYSq(int yCrd) { int t = (yCrd - y0) / sqSize; return flipped ? t : 7 - t; }
|
protected abstract int getYSq(int yCrd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the square corresponding to the coordinates of a mouse event.
|
* Compute the square corresponding to the coordinates of a mouse event.
|
||||||
@@ -598,108 +582,7 @@ public class ChessBoard extends View {
|
|||||||
return sq;
|
return sq;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final boolean myColor(int piece) {
|
protected abstract Move mousePressed(int sq);
|
||||||
return (piece != Piece.EMPTY) && (Piece.isWhite(piece) == pos.whiteMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Move mousePressed(int sq) {
|
|
||||||
if (sq < 0)
|
|
||||||
return null;
|
|
||||||
cursorVisible = false;
|
|
||||||
if ((selectedSquare != -1) && !userSelectedSquare)
|
|
||||||
setSelection(-1); // Remove selection of opponents last moving piece
|
|
||||||
|
|
||||||
if (!oneTouchMoves) {
|
|
||||||
int p = pos.getPiece(sq);
|
|
||||||
if (selectedSquare != -1) {
|
|
||||||
if (sq == selectedSquare) {
|
|
||||||
if (toggleSelection)
|
|
||||||
setSelection(-1);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!myColor(p)) {
|
|
||||||
Move m = new Move(selectedSquare, sq, Piece.EMPTY);
|
|
||||||
setSelection(sq);
|
|
||||||
userSelectedSquare = false;
|
|
||||||
return m;
|
|
||||||
} else
|
|
||||||
setSelection(sq);
|
|
||||||
} else {
|
|
||||||
if (myColor(p))
|
|
||||||
setSelection(sq);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int prevSq = userSelectedSquare ? selectedSquare : -1;
|
|
||||||
if (prevSq == sq) {
|
|
||||||
if (toggleSelection)
|
|
||||||
setSelection(-1);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
ArrayList<Move> moves = new MoveGen().legalMoves(pos);
|
|
||||||
Move matchingMove = null;
|
|
||||||
if (prevSq >= 0)
|
|
||||||
matchingMove = matchingMove(prevSq, sq, moves).first;
|
|
||||||
boolean anyMatch = false;
|
|
||||||
if (matchingMove == null) {
|
|
||||||
Pair<Move, Boolean> match = matchingMove(-1, sq, moves);
|
|
||||||
matchingMove = match.first;
|
|
||||||
anyMatch = match.second;
|
|
||||||
}
|
|
||||||
if (matchingMove != null) {
|
|
||||||
setSelection(matchingMove.to);
|
|
||||||
userSelectedSquare = false;
|
|
||||||
return matchingMove;
|
|
||||||
}
|
|
||||||
if (!anyMatch && (sq >= 0)) {
|
|
||||||
int p = pos.getPiece(sq);
|
|
||||||
if (myColor(p)) {
|
|
||||||
String msg = getContext().getString(R.string.piece_can_not_be_moved);
|
|
||||||
boolean localized = (pgnOptions != null) &&
|
|
||||||
(pgnOptions.view.pieceType != PGNOptions.PT_ENGLISH);
|
|
||||||
msg += ": " + TextIO.pieceAndSquareToString(localized, p, sq);
|
|
||||||
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setSelection(anyMatch ? sq : -1);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if there is a unique legal move corresponding to one or two selected squares.
|
|
||||||
* @param sq1 First square, or -1.
|
|
||||||
* @param sq2 Second square.
|
|
||||||
* @param moves List of legal moves.
|
|
||||||
* @return Matching move if unique.
|
|
||||||
* Boolean indicating if there was at least one match.
|
|
||||||
*/
|
|
||||||
private final Pair<Move, Boolean> matchingMove(int sq1, int sq2, ArrayList<Move> moves) {
|
|
||||||
Move matchingMove = null;
|
|
||||||
boolean anyMatch = false;
|
|
||||||
for (Move m : moves) {
|
|
||||||
boolean match;
|
|
||||||
if (sq1 == -1)
|
|
||||||
match = (m.from == sq2) || (m.to == sq2);
|
|
||||||
else
|
|
||||||
match = (m.from == sq1) && (m.to == sq2) ||
|
|
||||||
(m.from == sq2) && (m.to == sq1);
|
|
||||||
if (match) {
|
|
||||||
if (matchingMove == null) {
|
|
||||||
matchingMove = m;
|
|
||||||
anyMatch = true;
|
|
||||||
} else {
|
|
||||||
if ((matchingMove.from == m.from) &&
|
|
||||||
(matchingMove.to == m.to)) {
|
|
||||||
matchingMove.promoteTo = Piece.EMPTY;
|
|
||||||
} else {
|
|
||||||
matchingMove = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Pair<Move, Boolean>(matchingMove, anyMatch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class OnTrackballListener {
|
public static class OnTrackballListener {
|
||||||
public void onTrackballEvent(MotionEvent event) { }
|
public void onTrackballEvent(MotionEvent event) { }
|
||||||
@@ -717,8 +600,8 @@ public class ChessBoard extends View {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int minValidY() { return 0; }
|
protected abstract int minValidY();
|
||||||
protected int getSquare(int x, int y) { return Position.getSquare(x, y); }
|
protected abstract int getSquare(int x, int y);
|
||||||
|
|
||||||
public final Move handleTrackballEvent(MotionEvent event) {
|
public final Move handleTrackballEvent(MotionEvent event) {
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
|
|||||||
189
DroidFish/src/org/petero/droidfish/ChessBoardPlay.java
Normal file
189
DroidFish/src/org/petero/droidfish/ChessBoardPlay.java
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
/*
|
||||||
|
DroidFish - An Android chess program.
|
||||||
|
Copyright (C) 2012 Peter Österlund, peterosterlund2@gmail.com
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.petero.droidfish;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.petero.droidfish.gamelogic.Move;
|
||||||
|
import org.petero.droidfish.gamelogic.MoveGen;
|
||||||
|
import org.petero.droidfish.gamelogic.Pair;
|
||||||
|
import org.petero.droidfish.gamelogic.Piece;
|
||||||
|
import org.petero.droidfish.gamelogic.Position;
|
||||||
|
import org.petero.droidfish.gamelogic.TextIO;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chess board widget suitable for play mode.
|
||||||
|
* @author petero
|
||||||
|
*/
|
||||||
|
public class ChessBoardPlay extends ChessBoard {
|
||||||
|
private PGNOptions pgnOptions = null;
|
||||||
|
boolean oneTouchMoves;
|
||||||
|
|
||||||
|
public ChessBoardPlay(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
oneTouchMoves = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPgnOptions(PGNOptions pgnOptions) {
|
||||||
|
this.pgnOptions = pgnOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getXCrd(int x) { return x0 + sqSize * (flipped ? 7 - x : x); }
|
||||||
|
@Override
|
||||||
|
protected int getYCrd(int y) { return y0 + sqSize * (flipped ? y : 7 - y); }
|
||||||
|
@Override
|
||||||
|
protected int getXSq(int xCrd) { int t = (xCrd - x0) / sqSize; return flipped ? 7 - t : t; }
|
||||||
|
@Override
|
||||||
|
protected int getYSq(int yCrd) { int t = (yCrd - y0) / sqSize; return flipped ? t : 7 - t; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getWidth(int sqSize) { return sqSize * 8; }
|
||||||
|
@Override
|
||||||
|
protected int getHeight(int sqSize) { return sqSize * 8; }
|
||||||
|
@Override
|
||||||
|
protected int getSqSizeW(int width) { return (width) / 8; }
|
||||||
|
@Override
|
||||||
|
protected int getSqSizeH(int height) { return (height) / 8; }
|
||||||
|
@Override
|
||||||
|
protected int getMaxHeightPercentage() { return 75; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void computeOrigin(int width, int height) {
|
||||||
|
x0 = (width - sqSize * 8) / 2;
|
||||||
|
y0 = (height - sqSize * 8) / 2;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected int getXFromSq(int sq) { return Position.getX(sq); }
|
||||||
|
@Override
|
||||||
|
protected int getYFromSq(int sq) { return Position.getY(sq); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int minValidY() { return 0; }
|
||||||
|
@Override
|
||||||
|
protected int getSquare(int x, int y) { return Position.getSquare(x, y); }
|
||||||
|
|
||||||
|
|
||||||
|
private final boolean myColor(int piece) {
|
||||||
|
return (piece != Piece.EMPTY) && (Piece.isWhite(piece) == pos.whiteMove);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Move mousePressed(int sq) {
|
||||||
|
if (sq < 0)
|
||||||
|
return null;
|
||||||
|
cursorVisible = false;
|
||||||
|
if ((selectedSquare != -1) && !userSelectedSquare)
|
||||||
|
setSelection(-1); // Remove selection of opponents last moving piece
|
||||||
|
|
||||||
|
if (!oneTouchMoves) {
|
||||||
|
int p = pos.getPiece(sq);
|
||||||
|
if (selectedSquare != -1) {
|
||||||
|
if (sq == selectedSquare) {
|
||||||
|
if (toggleSelection)
|
||||||
|
setSelection(-1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!myColor(p)) {
|
||||||
|
Move m = new Move(selectedSquare, sq, Piece.EMPTY);
|
||||||
|
setSelection(sq);
|
||||||
|
userSelectedSquare = false;
|
||||||
|
return m;
|
||||||
|
} else
|
||||||
|
setSelection(sq);
|
||||||
|
} else {
|
||||||
|
if (myColor(p))
|
||||||
|
setSelection(sq);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int prevSq = userSelectedSquare ? selectedSquare : -1;
|
||||||
|
if (prevSq == sq) {
|
||||||
|
if (toggleSelection)
|
||||||
|
setSelection(-1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ArrayList<Move> moves = new MoveGen().legalMoves(pos);
|
||||||
|
Move matchingMove = null;
|
||||||
|
if (prevSq >= 0)
|
||||||
|
matchingMove = matchingMove(prevSq, sq, moves).first;
|
||||||
|
boolean anyMatch = false;
|
||||||
|
if (matchingMove == null) {
|
||||||
|
Pair<Move, Boolean> match = matchingMove(-1, sq, moves);
|
||||||
|
matchingMove = match.first;
|
||||||
|
anyMatch = match.second;
|
||||||
|
}
|
||||||
|
if (matchingMove != null) {
|
||||||
|
setSelection(matchingMove.to);
|
||||||
|
userSelectedSquare = false;
|
||||||
|
return matchingMove;
|
||||||
|
}
|
||||||
|
if (!anyMatch && (sq >= 0)) {
|
||||||
|
int p = pos.getPiece(sq);
|
||||||
|
if (myColor(p)) {
|
||||||
|
String msg = getContext().getString(R.string.piece_can_not_be_moved);
|
||||||
|
boolean localized = (pgnOptions != null) &&
|
||||||
|
(pgnOptions.view.pieceType != PGNOptions.PT_ENGLISH);
|
||||||
|
msg += ": " + TextIO.pieceAndSquareToString(localized, p, sq);
|
||||||
|
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setSelection(anyMatch ? sq : -1);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if there is a unique legal move corresponding to one or two selected squares.
|
||||||
|
* @param sq1 First square, or -1.
|
||||||
|
* @param sq2 Second square.
|
||||||
|
* @param moves List of legal moves.
|
||||||
|
* @return Matching move if unique.
|
||||||
|
* Boolean indicating if there was at least one match.
|
||||||
|
*/
|
||||||
|
private final Pair<Move, Boolean> matchingMove(int sq1, int sq2, ArrayList<Move> moves) {
|
||||||
|
Move matchingMove = null;
|
||||||
|
boolean anyMatch = false;
|
||||||
|
for (Move m : moves) {
|
||||||
|
boolean match;
|
||||||
|
if (sq1 == -1)
|
||||||
|
match = (m.from == sq2) || (m.to == sq2);
|
||||||
|
else
|
||||||
|
match = (m.from == sq1) && (m.to == sq2) ||
|
||||||
|
(m.from == sq2) && (m.to == sq1);
|
||||||
|
if (match) {
|
||||||
|
if (matchingMove == null) {
|
||||||
|
matchingMove = m;
|
||||||
|
anyMatch = true;
|
||||||
|
} else {
|
||||||
|
if ((matchingMove.from == m.from) &&
|
||||||
|
(matchingMove.to == m.to)) {
|
||||||
|
matchingMove.promoteTo = Piece.EMPTY;
|
||||||
|
} else {
|
||||||
|
matchingMove = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Pair<Move, Boolean>(matchingMove, anyMatch);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -154,7 +154,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
// FIXME!!! Selection dialog for going into variation
|
// FIXME!!! Selection dialog for going into variation
|
||||||
// FIXME!!! Use two engines in engine/engine games
|
// FIXME!!! Use two engines in engine/engine games
|
||||||
|
|
||||||
private ChessBoard cb;
|
private ChessBoardPlay cb;
|
||||||
private static DroidChessController ctrl = null;
|
private static DroidChessController ctrl = null;
|
||||||
private boolean mShowThinking;
|
private boolean mShowThinking;
|
||||||
private boolean mShowStats;
|
private boolean mShowStats;
|
||||||
@@ -479,7 +479,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
ChessBoard oldCB = cb;
|
ChessBoardPlay oldCB = cb;
|
||||||
String statusStr = status.getText().toString();
|
String statusStr = status.getText().toString();
|
||||||
initUI(false);
|
initUI(false);
|
||||||
readPrefs();
|
readPrefs();
|
||||||
@@ -522,7 +522,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
moveList.setMovementMethod(LinkMovementMethod.getInstance());
|
moveList.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
thinking.setFocusable(false);
|
thinking.setFocusable(false);
|
||||||
|
|
||||||
cb = (ChessBoard)findViewById(R.id.chessboard);
|
cb = (ChessBoardPlay)findViewById(R.id.chessboard);
|
||||||
cb.setFocusable(true);
|
cb.setFocusable(true);
|
||||||
cb.requestFocus();
|
cb.requestFocus();
|
||||||
cb.setClickable(true);
|
cb.setClickable(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user