From 0a38bbbd7b96815229339621565d1d32a39b3674 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sat, 2 Mar 2013 07:50:16 +0000 Subject: [PATCH] DroidFish: Fixed problem where a long press on the chess board could be interpreted as both a tap and a long press. --- DroidFish/src/org/petero/droidfish/DroidFish.java | 13 ++++++------- .../petero/droidfish/activities/EditBoard.java | 15 +++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java index 647536c..11ce6a7 100644 --- a/DroidFish/src/org/petero/droidfish/DroidFish.java +++ b/DroidFish/src/org/petero/droidfish/DroidFish.java @@ -692,6 +692,12 @@ public class DroidFish extends Activity implements GUIInterface { setEgtbHints(cb.getSelectedSquare()); } } + @Override + public void onLongPress(MotionEvent e) { + ((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(20); + removeDialog(BOARD_MENU_DIALOG); + showDialog(BOARD_MENU_DIALOG); + } }); cb.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { @@ -708,13 +714,6 @@ public class DroidFish extends Activity implements GUIInterface { } } }); - cb.setOnLongClickListener(new OnLongClickListener() { - public boolean onLongClick(View v) { - removeDialog(BOARD_MENU_DIALOG); - showDialog(BOARD_MENU_DIALOG); - return true; - } - }); moveList.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(View v) { diff --git a/DroidFish/src/org/petero/droidfish/activities/EditBoard.java b/DroidFish/src/org/petero/droidfish/activities/EditBoard.java index 6377498..981a4e1 100644 --- a/DroidFish/src/org/petero/droidfish/activities/EditBoard.java +++ b/DroidFish/src/org/petero/droidfish/activities/EditBoard.java @@ -36,12 +36,14 @@ import org.petero.droidfish.gtb.Probe; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Typeface; import android.os.Bundle; +import android.os.Vibrator; import android.preference.PreferenceManager; import android.text.ClipboardManager; import android.text.TextUtils; @@ -52,7 +54,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; -import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; import android.view.Window; import android.widget.Button; @@ -197,6 +198,11 @@ public class EditBoard extends Activity { handleClick(e); return true; } + @Override + public void onLongPress(MotionEvent e) { + ((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(20); + showDialog(EDIT_DIALOG); + } private final void handleClick(MotionEvent e) { int sq = cb.eventToSquare(e); Move m = cb.mousePressed(sq); @@ -218,13 +224,6 @@ public class EditBoard extends Activity { setEgtbHints(cb.getSelectedSquare()); } }); - cb.setOnLongClickListener(new OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - showDialog(EDIT_DIALOG); - return true; - } - }); } @Override