aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anysoftkeyboard/devicespecific
diff options
context:
space:
mode:
authorMenny Even Danan <menny@evendanan.net>2014-03-07 15:05:08 +0000
committerMenny Even Danan <menny@evendanan.net>2014-03-07 15:05:08 +0000
commit92687dc24161753950c632eeaf6d56048349fc3c (patch)
treea90d2339e8093cc60701c6ed4277c47796e410be /src/main/java/com/anysoftkeyboard/devicespecific
parentb1203221a8d37ba416c6570e5d9739a5c36fdd35 (diff)
downloadAnySoftKeyboard-92687dc24161753950c632eeaf6d56048349fc3c.tar.gz
AnySoftKeyboard-92687dc24161753950c632eeaf6d56048349fc3c.tar.bz2
Fix for issue #332
In KitKat, the default behavior of GScaleGestureDetector has been change: It will now enable by default the double-tap and slide to zoom. Which is a bad behavior for us. Change-Id: I91b4c36b5fea9c4b1632ca5201a462fa2d074ef9
Diffstat (limited to 'src/main/java/com/anysoftkeyboard/devicespecific')
-rw-r--r--src/main/java/com/anysoftkeyboard/devicespecific/AskV19GestureDetector.java29
-rw-r--r--src/main/java/com/anysoftkeyboard/devicespecific/AskV8GestureDetector.java12
-rw-r--r--src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V19.java34
-rw-r--r--src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V8.java5
4 files changed, 71 insertions, 9 deletions
diff --git a/src/main/java/com/anysoftkeyboard/devicespecific/AskV19GestureDetector.java b/src/main/java/com/anysoftkeyboard/devicespecific/AskV19GestureDetector.java
new file mode 100644
index 000000000..991b2e898
--- /dev/null
+++ b/src/main/java/com/anysoftkeyboard/devicespecific/AskV19GestureDetector.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013 Menny Even-Danan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.anysoftkeyboard.devicespecific;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+
+@TargetApi(19)
+public class AskV19GestureDetector extends AskV8GestureDetector {
+ public AskV19GestureDetector(Context context, AskOnGestureListener listener) {
+ super(context, listener);
+ //this behavior is not good for ASK. See https://github.com/AnySoftKeyboard/AnySoftKeyboard/issues/332
+ mScaleGestureDetector.setQuickScaleEnabled(false);
+ }
+}
diff --git a/src/main/java/com/anysoftkeyboard/devicespecific/AskV8GestureDetector.java b/src/main/java/com/anysoftkeyboard/devicespecific/AskV8GestureDetector.java
index bb4d116db..56f4d6f9b 100644
--- a/src/main/java/com/anysoftkeyboard/devicespecific/AskV8GestureDetector.java
+++ b/src/main/java/com/anysoftkeyboard/devicespecific/AskV8GestureDetector.java
@@ -18,7 +18,6 @@ package com.anysoftkeyboard.devicespecific;
import android.annotation.TargetApi;
import android.content.Context;
-import android.os.Handler;
import android.support.v4.view.MotionEventCompat;
import android.view.GestureDetector;
import android.view.MotionEvent;
@@ -26,20 +25,21 @@ import android.view.ScaleGestureDetector;
import com.anysoftkeyboard.utils.Log;
+import javax.annotation.Nonnull;
+
@TargetApi(8)
public class AskV8GestureDetector extends GestureDetector {
private static final String TAG = "AskV8GestureDetector";
private static final int NOT_A_POINTER_ID = -1;
- private final ScaleGestureDetector mScaleGestureDetector;
+ protected final ScaleGestureDetector mScaleGestureDetector;
private final AskOnGestureListener mListener;
private int mSingleFingerEventPointerId = NOT_A_POINTER_ID;
- public AskV8GestureDetector(Context context, AskOnGestureListener listener,
- Handler handler, boolean ignoreMultitouch) {
- super(context, listener, handler, ignoreMultitouch);
+ public AskV8GestureDetector(Context context, AskOnGestureListener listener) {
+ super(context, listener, null, true/*ignore multi-touch*/);
mListener = listener;
@@ -60,7 +60,7 @@ public class AskV8GestureDetector extends GestureDetector {
}
@Override
- public boolean onTouchEvent(MotionEvent ev) {
+ public boolean onTouchEvent(@Nonnull MotionEvent ev) {
int singleFingerEventPointerId = mSingleFingerEventPointerId;
//I want to keep track on the first finger (https://github.com/AnySoftKeyboard/AnySoftKeyboard/issues/300)
diff --git a/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V19.java b/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V19.java
new file mode 100644
index 000000000..8053b1b2d
--- /dev/null
+++ b/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V19.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2013 Menny Even-Danan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.anysoftkeyboard.devicespecific;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.view.GestureDetector;
+
+@TargetApi(19)
+public class DeviceSpecific_V19 extends DeviceSpecific_V11 {
+ @Override
+ public String getApiLevel() {
+ return "DeviceSpecific_V19";
+ }
+
+ @Override
+ public GestureDetector createGestureDetector(Context appContext, AskOnGestureListener listener) {
+ return new AskV19GestureDetector(appContext, listener);
+ }
+}
diff --git a/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V8.java b/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V8.java
index 89f8a79b8..bba73e88d 100644
--- a/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V8.java
+++ b/src/main/java/com/anysoftkeyboard/devicespecific/DeviceSpecific_V8.java
@@ -32,8 +32,7 @@ public class DeviceSpecific_V8 extends DeviceSpecific_V7 {
@Override
public MultiTouchSupportLevel getMultiTouchSupportLevel(Context appContext) {
PackageManager pkg = appContext.getPackageManager();
- boolean hasDistintMultitouch = pkg
- .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
+ boolean hasDistintMultitouch = pkg.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
boolean hasMultitouch = pkg
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
@@ -48,7 +47,7 @@ public class DeviceSpecific_V8 extends DeviceSpecific_V7 {
@Override
public GestureDetector createGestureDetector(Context appContext,
AskOnGestureListener listener) {
- return new AskV8GestureDetector(appContext, listener, null, true/*ignore multi-touch*/);
+ return new AskV8GestureDetector(appContext, listener);
}
@Override