summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2011-01-03 16:44:09 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2011-01-03 16:44:09 (GMT)
commit33e47109a5ddb9f3011d5c66eed92e6a07722c2b (patch)
tree37b9a1a9aaf6e20464489b5df48bdf1c26d7304c /src
parent92bea9162959c4b5af21bcd8299233bfe9078508 (diff)
downloadSoftKeys-33e47109a5ddb9f3011d5c66eed92e6a07722c2b.zip
SoftKeys-33e47109a5ddb9f3011d5c66eed92e6a07722c2b.tar.gz
SoftKeys-33e47109a5ddb9f3011d5c66eed92e6a07722c2b.tar.bz2
Make only the stop button rotate the service view, added a basic input
smoother though the display is still jittery, maybe it's a window management problem
Diffstat (limited to 'src')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/InputSmoother.java50
-rw-r--r--src/net/hoopajoo/android/SoftKeys/SoftKeysService.java7
2 files changed, 25 insertions, 32 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/InputSmoother.java b/src/net/hoopajoo/android/SoftKeys/InputSmoother.java
index 812c3b4..12283be 100644
--- a/src/net/hoopajoo/android/SoftKeys/InputSmoother.java
+++ b/src/net/hoopajoo/android/SoftKeys/InputSmoother.java
@@ -50,10 +50,29 @@ public class InputSmoother {
for( PointCheck p : mPoints ) {
p.outlier = false;
}
-
+
+ // currently this just checks to see if we delta'd farther than 10 pixels,
+ // it would be nice to add something smarter like curve fitting someday
+ // but it probably doesn't matter
+ int lastx = mPoints.get( 0 ).x;
+ int lasty = mPoints.get( 0 ).y;
+
+ for( PointCheck p : mPoints ) {
+ if( Math.abs( lastx - p.x ) > 10 ) {
+ p.outlier = true;
+ }
+ if( Math.abs( lasty - p.y ) > 10 ) {
+ p.outlier = true;
+ }
+ lastx = p.x;
+ lasty = p.y;
+ }
+
// set current as the last non-outlier
mCurrent = null;
- for( PointCheck p : new ListReverser<PointCheck>( mPoints ) ) {
+ for( int i = mPoints.size() - 1; i >= 0; i-- ) {
+ PointCheck p = mPoints.get( i );
+
if( mCurrent != null ) {
if( p.outlier == false ) {
mCurrent = p;
@@ -79,31 +98,4 @@ public class InputSmoother {
public int y;
public boolean outlier;
}
-
- class ListReverser<T> implements Iterable<T> {
- private ListIterator<T> listIterator;
-
- public ListReverser(List<T> wrappedList) {
- this.listIterator = wrappedList.listIterator(wrappedList.size());
- }
-
- public Iterator<T> iterator() {
- return new Iterator<T>() {
-
- public boolean hasNext() {
- return listIterator.hasPrevious();
- }
-
- public T next() {
- return listIterator.previous();
- }
-
- public void remove() {
- listIterator.remove();
- }
-
- };
- }
-
- }
}
diff --git a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
index d5e15d7..aea1634 100644
--- a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
+++ b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
@@ -108,7 +108,7 @@ public class SoftKeysService extends Service {
}
};
- OnLongClickListener longpress = new OnLongClickListener() {
+ OnLongClickListener longpress_rotate = new OnLongClickListener() {
@Override
public boolean onLongClick( View v ) {
if( mDraggingView || mDidDrag ) {
@@ -267,10 +267,11 @@ public class SoftKeysService extends Service {
((LinearLayout)mView.findViewById( R.id.button_container )).removeView( container.findViewById( R.id.settings ) ); // no settings in service
// arrange buttons
- Keys.applyButtons( settings, mView, c, longpress, touch, true );
+ Keys.applyButtons( settings, mView, c, null, touch, true );
mView.setVisibility( View.INVISIBLE );
mView.setOnTouchListener( touch );
- mView.setOnLongClickListener( longpress );
+ mView.setOnLongClickListener( longpress_rotate );
+ mView.findViewById( R.id.exit ).setOnLongClickListener( longpress_rotate );
applyTransparency( mView, settings.getInt( "service_transparency", 0 ) );