diff --git a/DroidFish/res/raw/about.html b/DroidFish/res/raw/about.html
index ae39747..69d0167 100644
--- a/DroidFish/res/raw/about.html
+++ b/DroidFish/res/raw/about.html
@@ -27,19 +27,6 @@
Hints
- -
- In game mode, long press chess board to activate copy/paste menu.
-
- -
- In edit board mode, long press chess board to activate edit menu.
-
- -
- Scroll left/right on the chess board to undo/redo moves.
-
- -
- If the game contains multiple variations, scroll up/down on the chess board
- to go to the previous/next variation.
-
-
Long press mode/left/right buttons for additional commands.
diff --git a/DroidFish/res/values/strings.xml b/DroidFish/res/values/strings.xml
index d7f8454..c2aab00 100644
--- a/DroidFish/res/values/strings.xml
+++ b/DroidFish/res/values/strings.xml
@@ -283,6 +283,8 @@ you are not actively using the program.\
Discard non-mainline moves from move list
Left-handed mode
Controls on left side in landscape mode
+ Board Gestures
+ Long press board for tools menu. Swipe horizontally to undo/redo moves. Swipe vertically to go to previous/next variation.
Square selection
Control how selecting squares on the chess board behaves
Text Size
diff --git a/DroidFish/res/xml/preferences.xml b/DroidFish/res/xml/preferences.xml
index b72bde3..d2f845a 100644
--- a/DroidFish/res/xml/preferences.xml
+++ b/DroidFish/res/xml/preferences.xml
@@ -482,8 +482,15 @@
android:entries="@array/squareSelectType_texts"
android:defaultValue="@string/squareSelectType_default">
+
+
diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java
index 800844b..2e491b9 100644
--- a/DroidFish/src/org/petero/droidfish/DroidFish.java
+++ b/DroidFish/src/org/petero/droidfish/DroidFish.java
@@ -185,8 +185,10 @@ public class DroidFish extends Activity implements GUIInterface {
SharedPreferences settings;
+ private boolean boardGestures;
private float scrollSensitivity;
private boolean invertScrollDirection;
+
private boolean leftHanded;
private boolean soundEnabled;
private MediaPlayer moveSound;
@@ -574,12 +576,20 @@ public class DroidFish extends Activity implements GUIInterface {
final GestureDetector gd = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
private float scrollX = 0;
private float scrollY = 0;
+ @Override
public boolean onDown(MotionEvent e) {
+ if (!boardGestures) {
+ handleClick(e);
+ return true;
+ }
scrollX = 0;
scrollY = 0;
return false;
}
+ @Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+ if (!boardGestures)
+ return false;
cb.cancelLongPress();
if (invertScrollDirection) {
distanceX = -distanceX;
@@ -629,12 +639,18 @@ public class DroidFish extends Activity implements GUIInterface {
}
return true;
}
+ @Override
public boolean onSingleTapUp(MotionEvent e) {
+ if (!boardGestures)
+ return false;
cb.cancelLongPress();
handleClick(e);
return true;
}
+ @Override
public boolean onDoubleTapEvent(MotionEvent e) {
+ if (!boardGestures)
+ return false;
if (e.getAction() == MotionEvent.ACTION_UP)
handleClick(e);
return true;
@@ -823,6 +839,7 @@ public class DroidFish extends Activity implements GUIInterface {
ctrl.setTimeLimit(timeControl, movesPerSession, timeIncrement);
setSummaryTitle();
+ boardGestures = settings.getBoolean("boardGestures", false);
scrollSensitivity = Float.parseFloat(settings.getString("scrollSensitivity", "2"));
invertScrollDirection = settings.getBoolean("invertScrollDirection", false);
discardVariations = settings.getBoolean("discardVariations", false);
@@ -1101,6 +1118,13 @@ public class DroidFish extends Activity implements GUIInterface {
return true;
}
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ MenuItem item = menu.findItem(R.id.item_file_menu);
+ item.setTitle(boardGestures ? R.string.option_file : R.string.tools_menu);
+ return true;
+ }
+
static private final int RESULT_EDITBOARD = 0;
static private final int RESULT_SETTINGS = 1;
static private final int RESULT_LOAD_PGN = 2;
@@ -1582,7 +1606,7 @@ public class DroidFish extends Activity implements GUIInterface {
case NEW_GAME_DIALOG: return newGameDialog();
case PROMOTE_DIALOG: return promoteDialog();
case BOARD_MENU_DIALOG: return boardMenuDialog();
- case FILE_MENU_DIALOG: return fileMenuDialog();
+ case FILE_MENU_DIALOG: return boardGestures ? fileMenuDialog() : boardMenuDialog();
case ABOUT_DIALOG: return aboutDialog();
case SELECT_MOVE_DIALOG: return selectMoveDialog();
case SELECT_BOOK_DIALOG: return selectBookDialog();
diff --git a/DroidFish/src/org/petero/droidfish/activities/EditBoard.java b/DroidFish/src/org/petero/droidfish/activities/EditBoard.java
index 2afcd6c..b3cc551 100644
--- a/DroidFish/src/org/petero/droidfish/activities/EditBoard.java
+++ b/DroidFish/src/org/petero/droidfish/activities/EditBoard.java
@@ -68,6 +68,7 @@ public class EditBoard extends Activity {
private boolean egtbHints;
private boolean autoScrollTitle;
+ private boolean boardGestures;
private TextView whiteFigText;
private TextView blackFigText;
private Typeface figNotation;
@@ -83,6 +84,7 @@ public class EditBoard extends Activity {
egtbHints = settings.getBoolean("tbHintsEdit", false);
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
autoScrollTitle = settings.getBoolean("autoScrollTitle", true);
+ boardGestures = settings.getBoolean("boardGestures", false);
initUI();
@@ -163,19 +165,33 @@ public class EditBoard extends Activity {
cb.requestFocus();
cb.setClickable(true);
final GestureDetector gd = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
+ @Override
public boolean onDown(MotionEvent e) {
+ if (!boardGestures) {
+ handleClick(e);
+ return true;
+ }
return false;
}
+ @Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+ if (!boardGestures)
+ return false;
cb.cancelLongPress();
return true;
}
+ @Override
public boolean onSingleTapUp(MotionEvent e) {
+ if (!boardGestures)
+ return false;
cb.cancelLongPress();
handleClick(e);
return true;
}
+ @Override
public boolean onDoubleTapEvent(MotionEvent e) {
+ if (!boardGestures)
+ return false;
if (e.getAction() == MotionEvent.ACTION_UP)
handleClick(e);
return true;