summaryrefslogtreecommitdiffstats
path: root/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2011-01-01 21:14:06 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2011-01-01 21:14:06 (GMT)
commitec8f0e387aa0bee03b47baca8888b4094ee8fa43 (patch)
tree69d28acdbbcc481a88041fd0ef01157922e042f0 /src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
parent6f84379257c7c95b35427a64c4aa5e09f619fea4 (diff)
downloadSoftKeys-ec8f0e387aa0bee03b47baca8888b4094ee8fa43.zip
SoftKeys-ec8f0e387aa0bee03b47baca8888b4094ee8fa43.tar.gz
SoftKeys-ec8f0e387aa0bee03b47baca8888b4094ee8fa43.tar.bz2
Adding smoother class to try and stop the drag jitter, currently it does
not smoothing but should allow swapping out smoothing ideas pretty easy
Diffstat (limited to 'src/net/hoopajoo/android/SoftKeys/SoftKeysService.java')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/SoftKeysService.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
index faa2a14..d5e15d7 100644
--- a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
+++ b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
@@ -44,6 +44,7 @@ import android.widget.ImageButton;
import android.widget.LinearLayout;
public class SoftKeysService extends Service {
+ private InputSmoother i;
private View mView;
private View mBumpView;
private boolean auto_hide;
@@ -169,8 +170,11 @@ public class SoftKeysService extends Service {
mDraggingView = true;
mDidDrag = true;
- int currX = (int)me.getRawX();
- int currY = (int)me.getRawY();
+ i.addPoint( (int)me.getRawX(), (int)me.getRawY() );
+ i.updateOutliers();
+ int[] pts = i.getCurrent();
+ int currX = pts[ 0 ];
+ int currY = pts[ 1 ];
// make our deltas work relative to movement, y
int dx = currX - mDraggingOrigX;
@@ -215,6 +219,7 @@ public class SoftKeysService extends Service {
WindowManager wm = (WindowManager)getSystemService(WINDOW_SERVICE);
wm.updateViewLayout( root, l );
+
return( true );
}
}
@@ -300,6 +305,8 @@ public class SoftKeysService extends Service {
wm.addView( mBumpView, makeOverlayParams() );
wm.addView( mView, makeOverlayParams() );
+ i = new InputSmoother( 5 );
+
initOrientation();
}