private static final long serialVersionUID = 1L;
{
put("none_flick", 0);
- //put("normal_stroke", 1);
+ put("normal_stroke", 1);
put("nico_stroke", 2);
}};
private GestureDetector mDetector;
private float mStartX, mStartY;
private float mGestureX, mGestureY;
+ private boolean mIsLongPress;
//private static final int ya_flick[] = { 0, 2, -1, 1, -1 };
//private static final int wa_flick[] = { 0, -1, 1, 2, 5 };
/**
}
// entry gesture detector
mDetector = new GestureDetector(this);
- mDetector.setIsLongpressEnabled(false);
+ if (NICOFLICK_1STROKE == mFlickNicoInput) {
+ mDetector.setIsLongpressEnabled(true);
+ }
+ else{
+ mDetector.setIsLongpressEnabled(false);
+ }
mMetrics.setToDefaults();
//changeKeyboardKeyHeight();
return mMainView;
}
mFlickNicoInput = flickModeTable.get(pref.getString("nicoflick_mode", "none_flick"));
mFlickSensivity = (float)flickSensivityModeTable.get(pref.getString("flick_sensivity_mode", "sensitivity_value_2"));
-
+ if (null != mDetector) {
+ if (NICOFLICK_1STROKE == mFlickNicoInput) {
+
+ mDetector.setIsLongpressEnabled(true);
+ }
+ else{
+ mDetector.setIsLongpressEnabled(false);
+ }
+ }
/* pop-up preview */
mKeyboardView.setPreviewEnabled(pref.getBoolean("popup_preview", true));
}
mStartY = ev.getRawY();
mGestureX = mStartX;
mGestureY = mStartY;
- //Log.d("NicoWnn", "onDown " + mStartX + "/" + mStartY);
+ mIsLongPress = false;
return true;
}
public boolean onFling(MotionEvent ev1, MotionEvent ev2, float getX, float getY){
return true;
}
public void onLongPress(MotionEvent ev){
+ mIsLongPress = true;
}
public boolean onScroll(MotionEvent ev1, MotionEvent ev2, float distX, float distY){
mGestureX = ev2.getRawX();
mGestureY = ev2.getRawY();
- //Log.d("NicoWnn", "get " + (mGestureX - mStartX) + "/" + (mGestureY - mStartY));
return true;
}
public void onShowPress(MotionEvent ev){
if (NICOFLICK_NONE == mFlickNicoInput) {
return -1;
}
- if (mCurrentKeyMode != KEYMODE_JA_FULL_NICO) {
+ if (!((mCurrentKeyMode == KEYMODE_JA_FULL_NICO) || (mCurrentKeyMode == KEYMODE_JA_HALF_ALPHABET))) {
return -1;
}
if (true == mNicoFirst) {
return -1;
}
+ // check 12key
+ switch (mPrevInputKeyCode) {
+ case KEYCODE_JP12_1: // A
+ case KEYCODE_JP12_2: // Ka
+ case KEYCODE_JP12_3: // Sa
+ case KEYCODE_JP12_4: // Ta
+ case KEYCODE_JP12_5: // Na
+ case KEYCODE_JP12_6: // Ha
+ case KEYCODE_JP12_7: // Ma
+ case KEYCODE_JP12_8: // Ya
+ case KEYCODE_JP12_9: // Ra
+ case KEYCODE_JP12_0: // Wa
+ break;
+ default:
+ return -1;
+ }
/**
* creation flick keys
*/
float calcx, calcy;
- calcx = (mGestureX - mStartX) * mMetrics.scaledDensity;
- calcy = (mGestureY - mStartY) * mMetrics.scaledDensity;
+ //calcx = (mGestureX - mStartX) * mMetrics.scaledDensity;
+ //calcy = (mGestureY - mStartY) * mMetrics.scaledDensity;
+ calcx = (mGestureX - mStartX);
+ calcy = (mGestureY - mStartY);
+ //Log.d("NicoWnn", "checkFlick " + calcx + "/" + calcy);
+
float length = FloatMath.sqrt((calcx * calcx) + (calcy * calcy));
double rotation;
rotation = Math.atan2(calcy, calcx);
}
// change rotate -> keycode
int keycode = -1;
- if (length < 30.0) {
- //keycode = 0;
- keycode = -1;
+ if (length < mFlickSensivity) {
+ if (false == mIsLongPress) {
+ keycode = 0;
+ }
+ else{
+ keycode = -1;
+ }
}
else {
if (getrot >= 45.0f && getrot < 135.0f) {
else {
keycode = 4;
}
- // convert keycode
- switch (mPrevInputKeyCode) {
- case KEYCODE_JP12_1: // A
- case KEYCODE_JP12_2: // Ka
- case KEYCODE_JP12_3: // Sa
- case KEYCODE_JP12_4: // Ta
- case KEYCODE_JP12_5: // Na
- case KEYCODE_JP12_6: // Ha
- case KEYCODE_JP12_7: // Ma
- case KEYCODE_JP12_9: // Ra
- break;
- case KEYCODE_JP12_8: // Ya
- //keycode = ya_flick[keycode];
- break;
- case KEYCODE_JP12_0: // Wa
- //keycode = wa_flick[keycode];
- break;
- }
}
if (-1 != keycode) {
keycode = convertModeFlick(getTableIndex(mPrevInputKeyCode), keycode);