aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-09-23 18:48:39 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-09-23 18:48:39 +0200
commit45b7b88b947c3c12792be898d8e0d6af70471ecc (patch)
treeb53b7f0c037e8786c8e72b95194c0f2a199d2a7f /OpenKeychain/src/main/java
parentc5239d6e9b138925718e031df8da86f57035947a (diff)
downloadopen-keychain-45b7b88b947c3c12792be898d8e0d6af70471ecc.tar.gz
open-keychain-45b7b88b947c3c12792be898d8e0d6af70471ecc.tar.bz2
open-keychain-45b7b88b947c3c12792be898d8e0d6af70471ecc.zip
disable pull to refresh in upper right corner
While at the top of the list, the scroll bar handle is in the top right corner. Previously, dragging the handle from this position was difficult because touch events were intercepted by the pull to refresh handler. Closes #858
Diffstat (limited to 'OpenKeychain/src/main/java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java1
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java26
2 files changed, 26 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index 4891ab63a..6e9eed650 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -23,7 +23,6 @@ import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
-import android.graphics.PorterDuff;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java
index f7d44d2cf..818d92390 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java
@@ -20,6 +20,12 @@ package org.sufficientlysecure.keychain.ui.widget;
import android.content.Context;
import android.support.v4.widget.NoScrollableSwipeRefreshLayout;
import android.util.AttributeSet;
+import android.view.InputDevice;
+import android.view.InputDevice.MotionRange;
+import android.view.MotionEvent;
+
+import org.sufficientlysecure.keychain.Constants;
+import org.sufficientlysecure.keychain.util.Log;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
@@ -71,4 +77,24 @@ public class ListAwareSwipeRefreshLayout extends NoScrollableSwipeRefreshLayout
)
);
}
+
+ /** Called on a touch event, this method exempts a small area in the upper right from pull to
+ * refresh handling.
+ *
+ * If the touch event happens somewhere in the upper right corner of the screen, we return false
+ * to indicate that the event was not handled. This ensures events in that area are always
+ * handed through to the list scrollbar handle. For all other cases, we pass the message through
+ * to the pull to refresh handler.
+ */
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ float ratioX = event.getX() / event.getDevice().getMotionRange(MotionEvent.AXIS_X).getMax();
+ float ratioY = event.getY() / event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMax();
+ // if this is the upper right corner, don't handle as pull to refresh event
+ if (ratioX > 0.85f && ratioY < 0.15f) {
+ return false;
+ }
+ return super.onTouchEvent(event);
+ }
+
} \ No newline at end of file