diff options
author | Steve Slaven <bpk@hoopajoo.net> | 2011-01-04 00:22:35 (GMT) |
---|---|---|
committer | Steve Slaven <bpk@hoopajoo.net> | 2011-01-04 00:22:35 (GMT) |
commit | b1deb15c4b365da40f6910828492394cea07cf00 (patch) | |
tree | 7777c7dfe6fa8a5f509a1dc2dad6a48beb2c8fda /src | |
parent | 51960ad671cea118e2590a74dffe97fd56a25f99 (diff) | |
download | SoftKeys-b1deb15c4b365da40f6910828492394cea07cf00.zip SoftKeys-b1deb15c4b365da40f6910828492394cea07cf00.tar.gz SoftKeys-b1deb15c4b365da40f6910828492394cea07cf00.tar.bz2 |
Another attempt to reduce jitter by limiting max call per second
Diffstat (limited to 'src')
-rw-r--r-- | src/net/hoopajoo/android/SoftKeys/SoftKeysService.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java index 785c11d..4c5039c 100644 --- a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java +++ b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java @@ -53,6 +53,7 @@ public class SoftKeysService extends Service { private View mDraggingViewObj; private int mDraggingOrigX, mDraggingOrigY; private int mDraggingViewX, mDraggingViewY; + private boolean mPendingDragEvent; private boolean mDidDrag; private int mNumDrags; private OrientationEventListener mOrientation; @@ -178,11 +179,16 @@ public class SoftKeysService extends Service { mDraggingView = true; mDidDrag = true; + // note: input smoother has no effect on the nook, something else is + // causing the jitters, I'm guessing we need to lock something when + // we update the params mInputSmoother.addPoint( (int)me.getRawX(), (int)me.getRawY() ); mInputSmoother.updateOutliers(); - //view.removeCallbacks( mUpdateDrag ); - view.post( mUpdateDrag ); + if( ! mPendingDragEvent ) { + mPendingDragEvent = true; + view.postDelayed( mUpdateDrag, 50 ); + } return( false ); } } @@ -238,10 +244,14 @@ public class SoftKeysService extends Service { finaly = mScreenHeight + mOffScreenMax - height; } + d( "Final xy: " + finalx + "," + finaly ); + l.x = finalx; l.y = finaly; WindowManager wm = (WindowManager)getSystemService(WINDOW_SERVICE); wm.updateViewLayout( root, l ); + + mPendingDragEvent = false; } }; |