enable turning thumbnail featuren on/off via a line in build.xml

This commit is contained in:
Eric House 2013-10-29 06:49:06 -07:00
parent 8bdde9765d
commit d72526ff84
5 changed files with 39 additions and 21 deletions

View file

@ -63,11 +63,13 @@
<target name="-pre-build"> <target name="-pre-build">
<property name="CHAT_ENABLED" value="true" /> <property name="CHAT_ENABLED" value="true" />
<property name="THUMBNAIL_ENABLED" value="true" />
<exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true"> <exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true">
<arg value="BUILD_TARGET=${build.target}" /> <arg value="BUILD_TARGET=${build.target}" />
<arg value="-j3"/> <arg value="-j3"/>
<arg value="INITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS}" /> <arg value="INITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS}" />
<arg value="CHAT_ENABLED=${CHAT_ENABLED}" /> <arg value="CHAT_ENABLED=${CHAT_ENABLED}" />
<arg value="THUMBNAIL_ENABLED=${THUMBNAIL_ENABLED}" />
</exec> </exec>
<exec dir="." executable="../scripts/mkimages.sh" <exec dir="." executable="../scripts/mkimages.sh"
@ -83,6 +85,7 @@
<arg value="xw4"/> <arg value="xw4"/>
<arg value="${INITIAL_CLIENT_VERS}" /> <arg value="${INITIAL_CLIENT_VERS}" />
<arg value="${CHAT_ENABLED}" /> <arg value="${CHAT_ENABLED}" />
<arg value="${THUMBNAIL_ENABLED}" />
</exec> </exec>
</target> </target>
<!-- <!--

View file

@ -44,6 +44,9 @@ local_DEFINES += \
ifeq ($(CHAT_ENABLED),true) ifeq ($(CHAT_ENABLED),true)
local_DEFINES += -DXWFEATURE_CHAT local_DEFINES += -DXWFEATURE_CHAT
endif endif
ifeq ($(THUMBNAIL_ENABLED),true)
local_DEFINES += -DXWFEATURE_ACTIVERECT
endif
# -DXWFEATURE_SCOREONEPASS \ # -DXWFEATURE_SCOREONEPASS \

View file

@ -184,12 +184,16 @@ public class DBUtils {
summary.lastMoveTime = summary.lastMoveTime =
cursor.getInt(cursor.getColumnIndex(DBHelper.LASTMOVE)); cursor.getInt(cursor.getColumnIndex(DBHelper.LASTMOVE));
byte[] data = if ( GitVersion.THUMBNAIL_SUPPORTED ) {
cursor.getBlob( cursor.getColumnIndex(DBHelper.THUMBNAIL)); byte[] data =
if ( null != data ) { cursor.getBlob( cursor.
Bitmap thumb = BitmapFactory.decodeByteArray( data, 0, getColumnIndex(DBHelper.THUMBNAIL));
data.length ); if ( null != data ) {
summary.setThumbnail( thumb ); Bitmap thumb =
BitmapFactory.decodeByteArray( data, 0,
data.length );
summary.setThumbnail( thumb );
}
} }
String scoresStr = String scoresStr =
@ -322,14 +326,16 @@ public class DBUtils {
} }
} }
Bitmap thumb = summary.getThumbnail(); if ( GitVersion.THUMBNAIL_SUPPORTED ) {
if ( null == thumb ) { Bitmap thumb = summary.getThumbnail();
values.putNull( DBHelper.THUMBNAIL ); if ( null == thumb ) {
} else { values.putNull( DBHelper.THUMBNAIL );
ByteArrayOutputStream bas = new ByteArrayOutputStream(); } else {
thumb.compress( CompressFormat.PNG, 0 , bas ); ByteArrayOutputStream bas = new ByteArrayOutputStream();
byte[] data = bas.toByteArray(); thumb.compress( CompressFormat.PNG, 0 , bas );
values.put( DBHelper.THUMBNAIL, data ); byte[] data = bas.toByteArray();
values.put( DBHelper.THUMBNAIL, data );
}
} }
values.put( DBHelper.SERVERROLE, summary.serverRole.ordinal() ); values.put( DBHelper.SERVERROLE, summary.serverRole.ordinal() );

View file

@ -187,7 +187,9 @@ public class GameListItem extends LinearLayout
R.drawable.expander_ic_maximized : R.drawable.expander_ic_maximized :
R.drawable.expander_ic_minimized); R.drawable.expander_ic_minimized);
m_hideable.setVisibility( m_expanded? View.VISIBLE : View.GONE ); m_hideable.setVisibility( m_expanded? View.VISIBLE : View.GONE );
m_thumb.setVisibility( m_expanded? View.VISIBLE : View.GONE ); if ( GitVersion.THUMBNAIL_SUPPORTED ) {
m_thumb.setVisibility( m_expanded ? View.VISIBLE : View.GONE );
}
m_name.setBackgroundColor( android.R.color.transparent ); m_name.setBackgroundColor( android.R.color.transparent );
m_name.setPct( m_handler, m_haveTurn && !m_expanded, m_name.setPct( m_handler, m_haveTurn && !m_expanded,
@ -295,12 +297,14 @@ public class GameListItem extends LinearLayout
} }
} ); } );
m_thumb = (ImageView)findViewById( R.id.thumbnail ); if ( GitVersion.THUMBNAIL_SUPPORTED ) {
Bitmap bmp = summary.getThumbnail(); m_thumb = (ImageView)findViewById( R.id.thumbnail );
if ( null == bmp ) { Bitmap bmp = summary.getThumbnail();
m_thumb.setVisibility( View.GONE ); if ( null == bmp ) {
} else { m_thumb.setVisibility( View.GONE );
m_thumb.setImageBitmap( bmp ); } else {
m_thumb.setImageBitmap( bmp );
}
} }
tview = (TextView)findViewById( R.id.role ); tview = (TextView)findViewById( R.id.role );

View file

@ -6,6 +6,7 @@ DIR=$1
VARIANT=$2 VARIANT=$2
CLIENT_VERS_RELAY=$3 CLIENT_VERS_RELAY=$3
CHAT_SUPPORTED=$4 CHAT_SUPPORTED=$4
THUMBNAIL_SUPPORTED=$5
cd $(dirname $0) cd $(dirname $0)
cd ../../ cd ../../
@ -35,6 +36,7 @@ class GitVersion {
public static final String VERS = "$SHORTVERS"; public static final String VERS = "$SHORTVERS";
public static final short CLIENT_VERS_RELAY = $CLIENT_VERS_RELAY; public static final short CLIENT_VERS_RELAY = $CLIENT_VERS_RELAY;
public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED; public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED;
public static final boolean THUMBNAIL_SUPPORTED = $THUMBNAIL_SUPPORTED;
} }
EOF EOF