mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
Merge branch 'android_branch' into android_bt
This commit is contained in:
commit
d96395c808
4 changed files with 36 additions and 73 deletions
|
@ -35,7 +35,7 @@
|
||||||
<!-- <uses-permission android:name="android.permission.RECEIVE_SMS" /> -->
|
<!-- <uses-permission android:name="android.permission.RECEIVE_SMS" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.SEND_SMS" /> -->
|
<!-- <uses-permission android:name="android.permission.SEND_SMS" /> -->
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
|
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />
|
||||||
|
|
||||||
<application android:icon="@drawable/icon48x48"
|
<application android:icon="@drawable/icon48x48"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fix new crash drawing board on some versions of Android </li>
|
<li>Fix new crash drawing board on some versions of Android </li>
|
||||||
|
|
||||||
<li>in Wordlist screen remember which languages are expanded</li>
|
<li>In Wordlist screen remember which languages are expanded</li>
|
||||||
|
|
||||||
|
<li>In Word Lookup dialog fix contrast on some versions of Android</li>
|
||||||
|
|
||||||
|
<li>Fix old crash when two buttons pressed at about the same time</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Please remember that this is beta software. Please let me know (at
|
<p>Please remember that this is beta software. Please let me know (at
|
||||||
|
|
|
@ -46,13 +46,10 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
|
|
||||||
public interface MultiHandlerIface {
|
public interface MultiHandlerIface {
|
||||||
boolean inactive();
|
boolean inactive();
|
||||||
void activate( MotionEvent event );
|
|
||||||
void deactivate();
|
|
||||||
int figureZoom( MotionEvent event );
|
|
||||||
int getSpacing( MotionEvent event );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float MIN_FONT_DIPS = 14.0f;
|
private static final float MIN_FONT_DIPS = 14.0f;
|
||||||
|
private static final int MULTI_INACTIVE = -1;
|
||||||
|
|
||||||
private static Bitmap s_bitmap; // the board
|
private static Bitmap s_bitmap; // the board
|
||||||
private static final int IN_TRADE_ALPHA = 0x3FFFFFFF;
|
private static final int IN_TRADE_ALPHA = 0x3FFFFFFF;
|
||||||
|
@ -96,6 +93,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
private Handler m_viewHandler;
|
private Handler m_viewHandler;
|
||||||
|
|
||||||
private MultiHandlerIface m_multiHandler = null;
|
private MultiHandlerIface m_multiHandler = null;
|
||||||
|
private int m_lastSpacing = MULTI_INACTIVE;
|
||||||
|
|
||||||
|
|
||||||
// FontDims: exists to translate space available to the largest
|
// FontDims: exists to translate space available to the largest
|
||||||
// font we can draw within that space taking advantage of our use
|
// font we can draw within that space taking advantage of our use
|
||||||
|
@ -182,15 +181,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
m_viewHandler = new Handler();
|
m_viewHandler = new Handler();
|
||||||
|
|
||||||
try {
|
|
||||||
int sdk_int = Integer.decode( Build.VERSION.SDK );
|
|
||||||
if ( sdk_int >= 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
|
@Override
|
||||||
|
@ -202,16 +192,14 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
|
|
||||||
switch ( action ) {
|
switch ( action ) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
if ( null != m_multiHandler ) {
|
m_lastSpacing = MULTI_INACTIVE;
|
||||||
m_multiHandler.deactivate();
|
|
||||||
}
|
|
||||||
m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy );
|
m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_DOWN, xx, yy );
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
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 );
|
m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_MOVE, xx, yy );
|
||||||
} else {
|
} else {
|
||||||
int zoomBy = m_multiHandler.figureZoom( event );
|
int zoomBy = figureZoom( event );
|
||||||
if ( 0 != zoomBy ) {
|
if ( 0 != zoomBy ) {
|
||||||
m_jniThread.handle( JNIThread.JNICmd.CMD_ZOOM,
|
m_jniThread.handle( JNIThread.JNICmd.CMD_ZOOM,
|
||||||
zoomBy < 0 ? -2 : 2 );
|
zoomBy < 0 ? -2 : 2 );
|
||||||
|
@ -223,16 +211,12 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
case MotionEvent.ACTION_POINTER_2_DOWN:
|
case MotionEvent.ACTION_POINTER_2_DOWN:
|
||||||
if ( null != m_multiHandler ) {
|
|
||||||
m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy );
|
m_jniThread.handle( JNIThread.JNICmd.CMD_PEN_UP, xx, yy );
|
||||||
m_multiHandler.activate( event );
|
m_lastSpacing = getSpacing( event );
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
case MotionEvent.ACTION_POINTER_2_UP:
|
case MotionEvent.ACTION_POINTER_2_UP:
|
||||||
if ( null != m_multiHandler ) {
|
m_lastSpacing = MULTI_INACTIVE;
|
||||||
m_multiHandler.deactivate();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
|
DbgUtils.logf( "onTouchEvent: unknown action: %d", action );
|
||||||
|
@ -999,30 +983,11 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MultiHandler implements MultiHandlerIface {
|
private int getSpacing( MotionEvent event )
|
||||||
private static final int INACTIVE = -1;
|
|
||||||
private int m_lastSpacing = INACTIVE;
|
|
||||||
|
|
||||||
public boolean inactive()
|
|
||||||
{
|
|
||||||
return INACTIVE == m_lastSpacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void activate( MotionEvent event )
|
|
||||||
{
|
|
||||||
m_lastSpacing = getSpacing( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deactivate()
|
|
||||||
{
|
|
||||||
m_lastSpacing = INACTIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSpacing( MotionEvent event )
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
if ( 1 == event.getPointerCount() ) {
|
if ( 1 == event.getPointerCount() ) {
|
||||||
result = INACTIVE;
|
result = MULTI_INACTIVE;
|
||||||
} else {
|
} else {
|
||||||
float xx = event.getX( 0 ) - event.getX( 1 );
|
float xx = event.getX( 0 ) - event.getX( 1 );
|
||||||
float yy = event.getY( 0 ) - event.getY( 1 );
|
float yy = event.getY( 0 ) - event.getY( 1 );
|
||||||
|
@ -1031,10 +996,10 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int figureZoom( MotionEvent event )
|
private int figureZoom( MotionEvent event )
|
||||||
{
|
{
|
||||||
int zoomDir = 0;
|
int zoomDir = 0;
|
||||||
if ( ! inactive() ) {
|
if ( MULTI_INACTIVE != m_lastSpacing ) {
|
||||||
int newSpacing = getSpacing( event );
|
int newSpacing = getSpacing( event );
|
||||||
int diff = Math.abs( newSpacing - m_lastSpacing );
|
int diff = Math.abs( newSpacing - m_lastSpacing );
|
||||||
if ( diff > PINCH_THRESHOLD ) {
|
if ( diff > PINCH_THRESHOLD ) {
|
||||||
|
@ -1044,6 +1009,5 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
}
|
}
|
||||||
return zoomDir;
|
return zoomDir;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,11 +240,6 @@ public class GameListAdapter extends XWListAdapter {
|
||||||
m_df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
|
m_df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
|
||||||
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<Long,ViewInfo>();
|
m_viewsCache = new HashMap<Long,ViewInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue