aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-09-24 01:49:50 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-09-24 01:49:50 +0200
commitf7d49a48cb0a8f26261ebb67c053f2d7f6e8d55d (patch)
treea0cb9d108691e5e173dc4d8a0fe96998f695a742 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget
parent3850ddea084ae53e3f14a839ede0209ca7f0e451 (diff)
parentc871891f49e2d456c8b5848d12f9c81d3efd6bc7 (diff)
downloadopen-keychain-f7d49a48cb0a8f26261ebb67c053f2d7f6e8d55d.tar.gz
open-keychain-f7d49a48cb0a8f26261ebb67c053f2d7f6e8d55d.tar.bz2
open-keychain-f7d49a48cb0a8f26261ebb67c053f2d7f6e8d55d.zip
Merge branch 'master' of github.com:open-keychain/open-keychain
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/ListAwareSwipeRefreshLayout.java14
1 files changed, 9 insertions, 5 deletions
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 818d92390..b3c3eb417 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
@@ -88,11 +88,15 @@ public class ListAwareSwipeRefreshLayout extends NoScrollableSwipeRefreshLayout
*/
@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;
+ // The device may be null. This actually happens
+ if (event.getDevice() != null) {
+ // MotionEvent.AXIS_X is api level 12, for some reason, so we use a constant 0 here
+ float ratioX = event.getX() / event.getDevice().getMotionRange(0).getMax();
+ float ratioY = event.getY() / event.getDevice().getMotionRange(1).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);
}