From 58a5e19ba44c96fc5f41eabb917f4da0b9dcbbbd Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sun, 8 Jan 2017 09:46:25 +0100 Subject: [PATCH] DroidFish: Source code rearrangement. --- DroidFish/res/layout-land/main.xml | 6 +-- DroidFish/res/layout/main.xml | 6 +-- DroidFish/res/layout/main_left_handed.xml | 6 +-- .../org/petero/droidfish/ChessBoardPlay.java | 1 + .../src/org/petero/droidfish/ColorTheme.java | 38 +++++++++---------- .../src/org/petero/droidfish/DroidFish.java | 4 +- DroidFish/src/org/petero/droidfish/Util.java | 1 + .../droidfish/activities/ChessBoardEdit.java | 2 +- .../droidfish/activities/EditBoard.java | 4 +- .../{ => activities}/SeekBarPreference.java | 7 +++- .../droidfish/{ => view}/ChessBoard.java | 14 ++++--- .../droidfish/{ => view}/MoveListView.java | 2 +- .../{ => view}/MyRelativeLayout.java | 2 +- .../droidfish/{ => view}/MyScrollView.java | 2 +- 14 files changed, 53 insertions(+), 42 deletions(-) rename DroidFish/src/org/petero/droidfish/{ => activities}/SeekBarPreference.java (98%) rename DroidFish/src/org/petero/droidfish/{ => view}/ChessBoard.java (98%) rename DroidFish/src/org/petero/droidfish/{ => view}/MoveListView.java (99%) rename DroidFish/src/org/petero/droidfish/{ => view}/MyRelativeLayout.java (97%) rename DroidFish/src/org/petero/droidfish/{ => view}/MyScrollView.java (97%) diff --git a/DroidFish/res/layout-land/main.xml b/DroidFish/res/layout-land/main.xml index f315012..779d0f9 100644 --- a/DroidFish/res/layout-land/main.xml +++ b/DroidFish/res/layout-land/main.xml @@ -77,7 +77,7 @@ android:typeface="monospace" android:textSize="12sp"/> @@ -86,7 +86,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"> @@ -86,7 +86,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"> @@ -81,7 +81,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"> . */ -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; diff --git a/DroidFish/src/org/petero/droidfish/ChessBoard.java b/DroidFish/src/org/petero/droidfish/view/ChessBoard.java similarity index 98% rename from DroidFish/src/org/petero/droidfish/ChessBoard.java rename to DroidFish/src/org/petero/droidfish/view/ChessBoard.java index 1e20b72..eb26318 100644 --- a/DroidFish/src/org/petero/droidfish/ChessBoard.java +++ b/DroidFish/src/org/petero/droidfish/view/ChessBoard.java @@ -16,12 +16,13 @@ along with this program. If not, see . */ -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 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)); diff --git a/DroidFish/src/org/petero/droidfish/MoveListView.java b/DroidFish/src/org/petero/droidfish/view/MoveListView.java similarity index 99% rename from DroidFish/src/org/petero/droidfish/MoveListView.java rename to DroidFish/src/org/petero/droidfish/view/MoveListView.java index 9fce061..0674d83 100644 --- a/DroidFish/src/org/petero/droidfish/MoveListView.java +++ b/DroidFish/src/org/petero/droidfish/view/MoveListView.java @@ -16,7 +16,7 @@ along with this program. If not, see . */ -package org.petero.droidfish; +package org.petero.droidfish.view; import android.annotation.SuppressLint; import android.content.Context; diff --git a/DroidFish/src/org/petero/droidfish/MyRelativeLayout.java b/DroidFish/src/org/petero/droidfish/view/MyRelativeLayout.java similarity index 97% rename from DroidFish/src/org/petero/droidfish/MyRelativeLayout.java rename to DroidFish/src/org/petero/droidfish/view/MyRelativeLayout.java index 7cf4082..eae3200 100644 --- a/DroidFish/src/org/petero/droidfish/MyRelativeLayout.java +++ b/DroidFish/src/org/petero/droidfish/view/MyRelativeLayout.java @@ -16,7 +16,7 @@ along with this program. If not, see . */ -package org.petero.droidfish; +package org.petero.droidfish.view; import android.content.Context; import android.util.AttributeSet; diff --git a/DroidFish/src/org/petero/droidfish/MyScrollView.java b/DroidFish/src/org/petero/droidfish/view/MyScrollView.java similarity index 97% rename from DroidFish/src/org/petero/droidfish/MyScrollView.java rename to DroidFish/src/org/petero/droidfish/view/MyScrollView.java index 34b3c9b..c6df5e3 100644 --- a/DroidFish/src/org/petero/droidfish/MyScrollView.java +++ b/DroidFish/src/org/petero/droidfish/view/MyScrollView.java @@ -16,7 +16,7 @@ along with this program. If not, see . */ -package org.petero.droidfish; +package org.petero.droidfish.view; import android.content.Context; import android.util.AttributeSet;