mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-12-18 00:05:10 +01:00
DroidFish: Disable board gestures by default, to improve responsiveness when touching the board to make moves.
This commit is contained in:
parent
c43d652207
commit
3047c32ec5
|
@ -27,19 +27,6 @@
|
||||||
|
|
||||||
<h3>Hints</h3>
|
<h3>Hints</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
|
||||||
In game mode, long press chess board to activate copy/paste menu.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
In edit board mode, long press chess board to activate edit menu.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Scroll left/right on the chess board to undo/redo moves.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
If the game contains multiple variations, scroll up/down on the chess board
|
|
||||||
to go to the previous/next variation.
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
Long press mode/left/right buttons for additional commands.
|
Long press mode/left/right buttons for additional commands.
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -283,6 +283,8 @@ you are not actively using the program.\
|
||||||
<string name="prefs_discardVariations_summary">Discard non-mainline moves from move list</string>
|
<string name="prefs_discardVariations_summary">Discard non-mainline moves from move list</string>
|
||||||
<string name="prefs_leftHanded_title">Left-handed mode</string>
|
<string name="prefs_leftHanded_title">Left-handed mode</string>
|
||||||
<string name="prefs_leftHanded_summary">Controls on left side in landscape mode</string>
|
<string name="prefs_leftHanded_summary">Controls on left side in landscape mode</string>
|
||||||
|
<string name="prefs_boardGestures_title">Board Gestures</string>
|
||||||
|
<string name="prefs_boardGestures_summary">Long press board for tools menu. Swipe horizontally to undo/redo moves. Swipe vertically to go to previous/next variation.</string>
|
||||||
<string name="prefs_squareSelectType_title">Square selection</string>
|
<string name="prefs_squareSelectType_title">Square selection</string>
|
||||||
<string name="prefs_squareSelectType_summary">Control how selecting squares on the chess board behaves</string>
|
<string name="prefs_squareSelectType_summary">Control how selecting squares on the chess board behaves</string>
|
||||||
<string name="prefs_fontSize_title">Text Size</string>
|
<string name="prefs_fontSize_title">Text Size</string>
|
||||||
|
|
|
@ -482,8 +482,15 @@
|
||||||
android:entries="@array/squareSelectType_texts"
|
android:entries="@array/squareSelectType_texts"
|
||||||
android:defaultValue="@string/squareSelectType_default">
|
android:defaultValue="@string/squareSelectType_default">
|
||||||
</ListPreference>
|
</ListPreference>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="boardGestures"
|
||||||
|
android:title="@string/prefs_boardGestures_title"
|
||||||
|
android:summary="@string/prefs_boardGestures_summary"
|
||||||
|
android:defaultValue="false">
|
||||||
|
</CheckBoxPreference>
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="scrollSensitivity"
|
android:key="scrollSensitivity"
|
||||||
|
android:dependency="boardGestures"
|
||||||
android:title="@string/prefs_scrollSensitivity_title"
|
android:title="@string/prefs_scrollSensitivity_title"
|
||||||
android:summary="@string/prefs_scrollSensitivity_summary"
|
android:summary="@string/prefs_scrollSensitivity_summary"
|
||||||
android:entryValues="@array/scroll_sensitivity_values"
|
android:entryValues="@array/scroll_sensitivity_values"
|
||||||
|
@ -492,6 +499,7 @@
|
||||||
</ListPreference>
|
</ListPreference>
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="invertScrollDirection"
|
android:key="invertScrollDirection"
|
||||||
|
android:dependency="boardGestures"
|
||||||
android:title="@string/prefs_invertScrollDirection_title"
|
android:title="@string/prefs_invertScrollDirection_title"
|
||||||
android:summary="@string/prefs_invertScrollDirection_summary"
|
android:summary="@string/prefs_invertScrollDirection_summary"
|
||||||
android:defaultValue="false">
|
android:defaultValue="false">
|
||||||
|
|
|
@ -185,8 +185,10 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
|
|
||||||
SharedPreferences settings;
|
SharedPreferences settings;
|
||||||
|
|
||||||
|
private boolean boardGestures;
|
||||||
private float scrollSensitivity;
|
private float scrollSensitivity;
|
||||||
private boolean invertScrollDirection;
|
private boolean invertScrollDirection;
|
||||||
|
|
||||||
private boolean leftHanded;
|
private boolean leftHanded;
|
||||||
private boolean soundEnabled;
|
private boolean soundEnabled;
|
||||||
private MediaPlayer moveSound;
|
private MediaPlayer moveSound;
|
||||||
|
@ -574,12 +576,20 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
final GestureDetector gd = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
|
final GestureDetector gd = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
|
||||||
private float scrollX = 0;
|
private float scrollX = 0;
|
||||||
private float scrollY = 0;
|
private float scrollY = 0;
|
||||||
|
@Override
|
||||||
public boolean onDown(MotionEvent e) {
|
public boolean onDown(MotionEvent e) {
|
||||||
|
if (!boardGestures) {
|
||||||
|
handleClick(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
scrollX = 0;
|
scrollX = 0;
|
||||||
scrollY = 0;
|
scrollY = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||||
|
if (!boardGestures)
|
||||||
|
return false;
|
||||||
cb.cancelLongPress();
|
cb.cancelLongPress();
|
||||||
if (invertScrollDirection) {
|
if (invertScrollDirection) {
|
||||||
distanceX = -distanceX;
|
distanceX = -distanceX;
|
||||||
|
@ -629,12 +639,18 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean onSingleTapUp(MotionEvent e) {
|
public boolean onSingleTapUp(MotionEvent e) {
|
||||||
|
if (!boardGestures)
|
||||||
|
return false;
|
||||||
cb.cancelLongPress();
|
cb.cancelLongPress();
|
||||||
handleClick(e);
|
handleClick(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean onDoubleTapEvent(MotionEvent e) {
|
public boolean onDoubleTapEvent(MotionEvent e) {
|
||||||
|
if (!boardGestures)
|
||||||
|
return false;
|
||||||
if (e.getAction() == MotionEvent.ACTION_UP)
|
if (e.getAction() == MotionEvent.ACTION_UP)
|
||||||
handleClick(e);
|
handleClick(e);
|
||||||
return true;
|
return true;
|
||||||
|
@ -823,6 +839,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
ctrl.setTimeLimit(timeControl, movesPerSession, timeIncrement);
|
ctrl.setTimeLimit(timeControl, movesPerSession, timeIncrement);
|
||||||
setSummaryTitle();
|
setSummaryTitle();
|
||||||
|
|
||||||
|
boardGestures = settings.getBoolean("boardGestures", false);
|
||||||
scrollSensitivity = Float.parseFloat(settings.getString("scrollSensitivity", "2"));
|
scrollSensitivity = Float.parseFloat(settings.getString("scrollSensitivity", "2"));
|
||||||
invertScrollDirection = settings.getBoolean("invertScrollDirection", false);
|
invertScrollDirection = settings.getBoolean("invertScrollDirection", false);
|
||||||
discardVariations = settings.getBoolean("discardVariations", false);
|
discardVariations = settings.getBoolean("discardVariations", false);
|
||||||
|
@ -1101,6 +1118,13 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
return true;
|
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_EDITBOARD = 0;
|
||||||
static private final int RESULT_SETTINGS = 1;
|
static private final int RESULT_SETTINGS = 1;
|
||||||
static private final int RESULT_LOAD_PGN = 2;
|
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 NEW_GAME_DIALOG: return newGameDialog();
|
||||||
case PROMOTE_DIALOG: return promoteDialog();
|
case PROMOTE_DIALOG: return promoteDialog();
|
||||||
case BOARD_MENU_DIALOG: return boardMenuDialog();
|
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 ABOUT_DIALOG: return aboutDialog();
|
||||||
case SELECT_MOVE_DIALOG: return selectMoveDialog();
|
case SELECT_MOVE_DIALOG: return selectMoveDialog();
|
||||||
case SELECT_BOOK_DIALOG: return selectBookDialog();
|
case SELECT_BOOK_DIALOG: return selectBookDialog();
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class EditBoard extends Activity {
|
||||||
|
|
||||||
private boolean egtbHints;
|
private boolean egtbHints;
|
||||||
private boolean autoScrollTitle;
|
private boolean autoScrollTitle;
|
||||||
|
private boolean boardGestures;
|
||||||
private TextView whiteFigText;
|
private TextView whiteFigText;
|
||||||
private TextView blackFigText;
|
private TextView blackFigText;
|
||||||
private Typeface figNotation;
|
private Typeface figNotation;
|
||||||
|
@ -83,6 +84,7 @@ public class EditBoard extends Activity {
|
||||||
egtbHints = settings.getBoolean("tbHintsEdit", false);
|
egtbHints = settings.getBoolean("tbHintsEdit", false);
|
||||||
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
||||||
autoScrollTitle = settings.getBoolean("autoScrollTitle", true);
|
autoScrollTitle = settings.getBoolean("autoScrollTitle", true);
|
||||||
|
boardGestures = settings.getBoolean("boardGestures", false);
|
||||||
|
|
||||||
initUI();
|
initUI();
|
||||||
|
|
||||||
|
@ -163,19 +165,33 @@ public class EditBoard extends Activity {
|
||||||
cb.requestFocus();
|
cb.requestFocus();
|
||||||
cb.setClickable(true);
|
cb.setClickable(true);
|
||||||
final GestureDetector gd = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
|
final GestureDetector gd = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
|
||||||
|
@Override
|
||||||
public boolean onDown(MotionEvent e) {
|
public boolean onDown(MotionEvent e) {
|
||||||
|
if (!boardGestures) {
|
||||||
|
handleClick(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||||
|
if (!boardGestures)
|
||||||
|
return false;
|
||||||
cb.cancelLongPress();
|
cb.cancelLongPress();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean onSingleTapUp(MotionEvent e) {
|
public boolean onSingleTapUp(MotionEvent e) {
|
||||||
|
if (!boardGestures)
|
||||||
|
return false;
|
||||||
cb.cancelLongPress();
|
cb.cancelLongPress();
|
||||||
handleClick(e);
|
handleClick(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean onDoubleTapEvent(MotionEvent e) {
|
public boolean onDoubleTapEvent(MotionEvent e) {
|
||||||
|
if (!boardGestures)
|
||||||
|
return false;
|
||||||
if (e.getAction() == MotionEvent.ACTION_UP)
|
if (e.getAction() == MotionEvent.ACTION_UP)
|
||||||
handleClick(e);
|
handleClick(e);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user