From 3865a5f8c6a1ee166bee532777d1dfc14dfcdba4 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 12 Mar 2012 19:52:35 -0700 Subject: [PATCH 1/3] complete changelog --- xwords4/android/XWords4/res/raw/changes | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/res/raw/changes b/xwords4/android/XWords4/res/raw/changes index 4989052b7..c13b39d80 100644 --- a/xwords4/android/XWords4/res/raw/changes +++ b/xwords4/android/XWords4/res/raw/changes @@ -9,7 +9,11 @@

Please remember that this is beta software. Please let me know (at From 5a3f6d6194f818aee9d67649efc0b2a31dfb71fe Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 12 Mar 2012 20:32:21 -0700 Subject: [PATCH 2/3] remove dead code --- .../XWords4/src/org/eehouse/android/xw4/GameListAdapter.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index c39d13288..02cfe0330 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -236,11 +236,6 @@ public class GameListAdapter extends XWListAdapter { m_df = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT ); - int sdk_int = 0; - try { - sdk_int = Integer.decode( android.os.Build.VERSION.SDK ); - } catch ( Exception ex ) {} - m_viewsCache = new HashMap(); } From 326671081ad78d0321483d44db7163518e40a50e Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 12 Mar 2012 20:34:34 -0700 Subject: [PATCH 3/3] Remove support for versions prior to 2.1, as nobody's using them. Remove code to avoid classload crash when multitouch support not present since now it always will be. --- xwords4/android/XWords4/AndroidManifest.xml | 2 +- .../org/eehouse/android/xw4/BoardView.java | 96 ++++++------------- 2 files changed, 31 insertions(+), 67 deletions(-) diff --git a/xwords4/android/XWords4/AndroidManifest.xml b/xwords4/android/XWords4/AndroidManifest.xml index ad34d0c03..2e21438a8 100644 --- a/xwords4/android/XWords4/AndroidManifest.xml +++ b/xwords4/android/XWords4/AndroidManifest.xml @@ -34,7 +34,7 @@ - + = Build.VERSION_CODES.ECLAIR ) { - m_multiHandler = new MultiHandler(); - } else { - DbgUtils.logf( "OS version %d too old for multi-touch", sdk_int ); - } - } catch ( Exception ex ) {} } @Override @@ -202,16 +192,14 @@ public class BoardView extends View implements DrawCtx, BoardHandler, switch ( action ) { case MotionEvent.ACTION_DOWN: - if ( null != m_multiHandler ) { - m_multiHandler.deactivate(); - } + m_lastSpacing = MULTI_INACTIVE; m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy ); break; case MotionEvent.ACTION_MOVE: - if ( null == m_multiHandler || m_multiHandler.inactive() ) { + if ( MULTI_INACTIVE == m_lastSpacing ) { m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_MOVE, xx, yy ); } else { - int zoomBy = m_multiHandler.figureZoom( event ); + int zoomBy = figureZoom( event ); if ( 0 != zoomBy ) { m_jniThread.handle( JNIThread.JNICmd.CMD_ZOOM, zoomBy < 0 ? -2 : 2 ); @@ -223,16 +211,12 @@ public class BoardView extends View implements DrawCtx, BoardHandler, break; case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_2_DOWN: - if ( null != m_multiHandler ) { - m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy ); - m_multiHandler.activate( event ); - } + m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy ); + m_lastSpacing = getSpacing( event ); break; case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_POINTER_2_UP: - if ( null != m_multiHandler ) { - m_multiHandler.deactivate(); - } + m_lastSpacing = MULTI_INACTIVE; break; default: DbgUtils.logf( "onTouchEvent: unknown action: %d", action ); @@ -999,51 +983,31 @@ public class BoardView extends View implements DrawCtx, BoardHandler, return color; } - private class MultiHandler implements MultiHandlerIface { - private static final int INACTIVE = -1; - private int m_lastSpacing = INACTIVE; - - public boolean inactive() - { - return INACTIVE == m_lastSpacing; + private int getSpacing( MotionEvent event ) + { + int result; + if ( 1 == event.getPointerCount() ) { + result = MULTI_INACTIVE; + } else { + float xx = event.getX( 0 ) - event.getX( 1 ); + float yy = event.getY( 0 ) - event.getY( 1 ); + result = (int)FloatMath.sqrt( (xx * xx) + (yy * yy) ); } + return result; + } - public void activate( MotionEvent event ) - { - m_lastSpacing = getSpacing( event ); - } - - public void deactivate() - { - m_lastSpacing = INACTIVE; - } - - public int getSpacing( MotionEvent event ) - { - int result; - if ( 1 == event.getPointerCount() ) { - result = INACTIVE; - } else { - float xx = event.getX( 0 ) - event.getX( 1 ); - float yy = event.getY( 0 ) - event.getY( 1 ); - result = (int)FloatMath.sqrt( (xx * xx) + (yy * yy) ); + private int figureZoom( MotionEvent event ) + { + int zoomDir = 0; + if ( MULTI_INACTIVE != m_lastSpacing ) { + int newSpacing = getSpacing( event ); + int diff = Math.abs( newSpacing - m_lastSpacing ); + if ( diff > PINCH_THRESHOLD ) { + zoomDir = newSpacing < m_lastSpacing? -1 : 1; + m_lastSpacing = newSpacing; } - return result; - } - - public int figureZoom( MotionEvent event ) - { - int zoomDir = 0; - if ( ! inactive() ) { - int newSpacing = getSpacing( event ); - int diff = Math.abs( newSpacing - m_lastSpacing ); - if ( diff > PINCH_THRESHOLD ) { - zoomDir = newSpacing < m_lastSpacing? -1 : 1; - m_lastSpacing = newSpacing; - } - } - return zoomDir; } + return zoomDir; } }