summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-03-07 21:46:30 +0200
committerTor Lillqvist <tml@iki.fi>2013-03-07 21:51:26 +0200
commit783d3928b7d935e2a022f92318e00faa3efa6bc7 (patch)
tree52af27d93c08fa7157b0b2fb670f95fef83cbb6c /android
parent847583867903cc7e2dd1abaeaef5245c9310243a (diff)
Try to make the scrolling and zooming actions snappier
Now it does work nicely during the gesture when all the action is on the Java side (translating and scaling the pre-rendered bitmap). Looks a bit sad, of course, that nothing scrolls in to replace the parts of page(s) scrolled out during the gesture, and correspondingly for zooming. To then get the stuff down in the murky depths of the LO code to do what I want still is beyond me. Change-Id: I9ce33ed482013d18a877d1798de3bce5ac608e5e
Diffstat (limited to 'android')
-rw-r--r--android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java35
1 files changed, 18 insertions, 17 deletions
diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
index ace4efeb38de..5fb59f20ddd0 100644
--- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
@@ -282,8 +282,10 @@ public class Desktop
@Override public boolean onTouchEvent(MotionEvent event)
{
- if (gestureDetector.onTouchEvent(event))
+ if (event.getPointerCount() == 1 &&
+ gestureDetector.onTouchEvent(event)) {
return true;
+ }
// There is no callback in SimpleOnGestureListener for end
// of scroll. Is this a good way to detect it? Assume that
@@ -296,17 +298,14 @@ public class Desktop
Desktop.scroll((int) translateX, (int) translateY);
translateX = translateY = 0;
scrollInProgress = false;
- }
-
- // If a scaling gesture is in progress no other touch
- // processing should be done.
- if (scaleDetector.onTouchEvent(event) && scalingInProgress)
+ invalidate();
+ } else if (event.getPointerCount() == 2 &&
+ scaleDetector.onTouchEvent(event) &&
+ scalingInProgress) {
+ // If a scaling gesture is in progress no other touch
+ // processing should be done.
return true;
-
- if (!renderedOnce)
- return super.onTouchEvent(event);
-
- super.onTouchEvent(event);
+ }
// Just temporary hack. We should not show the keyboard
// unconditionally on a ACTION_UP event here. The LO level
@@ -323,12 +322,14 @@ public class Desktop
imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
}
- switch (event.getActionMasked()) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_MOVE:
- Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY());
- break;
+ if (event.getPointerCount() == 1) {
+ switch (event.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_MOVE:
+ Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY());
+ break;
+ }
}
return true;