DroidFish: Source code rearrangement.

This commit is contained in:
Peter Osterlund 2017-01-08 09:46:25 +01:00
parent 74fdfaf9b1
commit 58a5e19ba4
14 changed files with 53 additions and 42 deletions

View File

@ -77,7 +77,7 @@
android:typeface="monospace"
android:textSize="12sp"/>
<view
class="org.petero.droidfish.MyRelativeLayout"
class="org.petero.droidfish.view.MyRelativeLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@ -86,7 +86,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<view
class="org.petero.droidfish.MoveListView"
class="org.petero.droidfish.view.MoveListView"
android:id="@+id/moveList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -94,7 +94,7 @@
android:padding="0dp"/>
</ScrollView>
<view
class="org.petero.droidfish.MyScrollView"
class="org.petero.droidfish.view.MyScrollView"
android:id="@+id/scrollViewBot"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"

View File

@ -77,7 +77,7 @@
</LinearLayout>
</LinearLayout>
<view
class="org.petero.droidfish.MyRelativeLayout"
class="org.petero.droidfish.view.MyRelativeLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@ -86,7 +86,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<view
class="org.petero.droidfish.MoveListView"
class="org.petero.droidfish.view.MoveListView"
android:id="@+id/moveList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -94,7 +94,7 @@
android:padding="0dp"/>
</ScrollView>
<view
class="org.petero.droidfish.MyScrollView"
class="org.petero.droidfish.view.MyScrollView"
android:id="@+id/scrollViewBot"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"

View File

@ -72,7 +72,7 @@
android:typeface="monospace"
android:textSize="12sp"/>
<view
class="org.petero.droidfish.MyRelativeLayout"
class="org.petero.droidfish.view.MyRelativeLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@ -81,7 +81,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<view
class="org.petero.droidfish.MoveListView"
class="org.petero.droidfish.view.MoveListView"
android:id="@+id/moveList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -89,7 +89,7 @@
android:padding="0dp"/>
</ScrollView>
<view
class="org.petero.droidfish.MyScrollView"
class="org.petero.droidfish.view.MyScrollView"
android:id="@+id/scrollViewBot"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"

View File

@ -26,6 +26,7 @@ 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 org.petero.droidfish.view.ChessBoard;
import android.content.Context;
import android.content.res.Configuration;

View File

@ -32,25 +32,25 @@ public class ColorTheme {
return inst;
}
final static int DARK_SQUARE = 0;
final static int BRIGHT_SQUARE = 1;
final static int SELECTED_SQUARE = 2;
final static int CURSOR_SQUARE = 3;
final static int DARK_PIECE = 4;
final static int BRIGHT_PIECE = 5;
final static int CURRENT_MOVE = 6;
final static int ARROW_0 = 7;
final static int ARROW_1 = 8;
final static int ARROW_2 = 9;
final static int ARROW_3 = 10;
final static int ARROW_4 = 11;
final static int ARROW_5 = 12;
final static int ARROW_6 = 13;
final static int ARROW_7 = 14;
final static int MAX_ARROWS = 8;
final static int SQUARE_LABEL = 15;
final static int DECORATION = 16;
final static int PGN_COMMENT = 17;
public final static int DARK_SQUARE = 0;
public final static int BRIGHT_SQUARE = 1;
public final static int SELECTED_SQUARE = 2;
public final static int CURSOR_SQUARE = 3;
public final static int DARK_PIECE = 4;
public final static int BRIGHT_PIECE = 5;
public final static int CURRENT_MOVE = 6;
public final static int ARROW_0 = 7;
public final static int ARROW_1 = 8;
public final static int ARROW_2 = 9;
public final static int ARROW_3 = 10;
public final static int ARROW_4 = 11;
public final static int ARROW_5 = 12;
public final static int ARROW_6 = 13;
public final static int ARROW_7 = 14;
public final static int MAX_ARROWS = 8;
public final static int SQUARE_LABEL = 15;
public final static int DECORATION = 16;
public final static int PGN_COMMENT = 17;
public final static int FONT_FOREGROUND = 18;
public final static int GENERAL_BACKGROUND = 19;
private final static int numColors = 20;

View File

@ -38,7 +38,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import org.petero.droidfish.ChessBoard.SquareDecoration;
import org.petero.droidfish.activities.CPUWarning;
import org.petero.droidfish.activities.EditBoard;
import org.petero.droidfish.activities.EditOptions;
@ -65,6 +64,9 @@ import org.petero.droidfish.gamelogic.GameTree.Node;
import org.petero.droidfish.gamelogic.TimeControlData;
import org.petero.droidfish.tb.Probe;
import org.petero.droidfish.tb.ProbeResult;
import org.petero.droidfish.view.ChessBoard;
import org.petero.droidfish.view.MoveListView;
import org.petero.droidfish.view.ChessBoard.SquareDecoration;
import tourguide.tourguide.Overlay;
import tourguide.tourguide.Pointer;

View File

@ -20,6 +20,7 @@ package org.petero.droidfish;
import org.petero.droidfish.gamelogic.Piece;
import org.petero.droidfish.gamelogic.Position;
import org.petero.droidfish.view.MoveListView;
import android.app.Activity;
import android.content.SharedPreferences;

View File

@ -18,10 +18,10 @@
package org.petero.droidfish.activities;
import org.petero.droidfish.ChessBoard;
import org.petero.droidfish.gamelogic.Move;
import org.petero.droidfish.gamelogic.Piece;
import org.petero.droidfish.gamelogic.Position;
import org.petero.droidfish.view.ChessBoard;
import android.content.Context;
import android.content.res.Configuration;

View File

@ -21,10 +21,8 @@ package org.petero.droidfish.activities;
import java.util.ArrayList;
import java.util.Locale;
import org.petero.droidfish.ChessBoard;
import org.petero.droidfish.DroidFish;
import org.petero.droidfish.R;
import org.petero.droidfish.ChessBoard.SquareDecoration;
import org.petero.droidfish.Util;
import org.petero.droidfish.Util.MaterialDiff;
import org.petero.droidfish.gamelogic.ChessParseError;
@ -35,6 +33,8 @@ import org.petero.droidfish.gamelogic.Position;
import org.petero.droidfish.gamelogic.TextIO;
import org.petero.droidfish.tb.Probe;
import org.petero.droidfish.tb.ProbeResult;
import org.petero.droidfish.view.ChessBoard;
import org.petero.droidfish.view.ChessBoard.SquareDecoration;
import android.annotation.SuppressLint;
import android.app.Activity;

View File

@ -16,10 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.petero.droidfish;
package org.petero.droidfish.activities;
import java.util.Locale;
import org.petero.droidfish.R;
import org.petero.droidfish.R.id;
import org.petero.droidfish.R.layout;
import org.petero.droidfish.R.string;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;

View File

@ -16,12 +16,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.petero.droidfish;
package org.petero.droidfish.view;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.petero.droidfish.ColorTheme;
import org.petero.droidfish.gamelogic.Move;
import org.petero.droidfish.gamelogic.Piece;
import org.petero.droidfish.gamelogic.Position;
@ -48,13 +49,14 @@ public abstract class ChessBoard extends View {
// false if selectedSquare used to highlight last move
public float cursorX, cursorY;
public boolean cursorVisible;
protected int x0, y0, sqSize;
protected int x0, y0;
public int sqSize;
int pieceXDelta, pieceYDelta; // top/left pixel draw position relative to square
public boolean flipped;
public boolean drawSquareLabels;
boolean toggleSelection;
boolean highlightLastMove; // If true, last move is marked with a rectangle
boolean blindMode; // If true, no chess pieces and arrows are drawn
public boolean toggleSelection;
public boolean highlightLastMove; // If true, last move is marked with a rectangle
public boolean blindMode; // If true, no chess pieces and arrows are drawn
List<Move> moveHints;
@ -140,7 +142,7 @@ public abstract class ChessBoard extends View {
}
/** Must be called for new color theme to take effect. */
final void setColors() {
public final void setColors() {
ColorTheme ct = ColorTheme.instance();
darkPaint.setColor(ct.getColor(ColorTheme.DARK_SQUARE));
brightPaint.setColor(ct.getColor(ColorTheme.BRIGHT_SQUARE));

View File

@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.petero.droidfish;
package org.petero.droidfish.view;
import android.annotation.SuppressLint;
import android.content.Context;

View File

@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.petero.droidfish;
package org.petero.droidfish.view;
import android.content.Context;
import android.util.AttributeSet;

View File

@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.petero.droidfish;
package org.petero.droidfish.view;
import android.content.Context;
import android.util.AttributeSet;