DroidFish: Fixed problem where a long press on the chess board could be interpreted as both a tap and a long press.

This commit is contained in:
Peter Osterlund 2013-03-02 07:50:16 +00:00
parent f05e0fe48a
commit 0a38bbbd7b
2 changed files with 13 additions and 15 deletions

View File

@ -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) {

View File

@ -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