take thumb setting into account (though not in the rigth way yet, and

changes are still reflected only after the list item's been forced to
reload)
This commit is contained in:
Eric House 2013-11-07 07:51:57 -08:00
parent b61e580b40
commit fba7aee83a
2 changed files with 21 additions and 14 deletions

View file

@ -2058,19 +2058,21 @@ public class BoardActivity extends XWActivity
private void takeSnapshot()
{
if ( GitVersion.THUMBNAIL_SUPPORTED ) {
final int size = 150;
Bitmap thumb =
Bitmap.createBitmap( size, size, Bitmap.Config.ARGB_8888 );
Bitmap thumb = null;
int scale = XWPrefs.getThumbScale( this );
if ( 0 < scale ) {
final int size = 15 * (9 + scale);
thumb = Bitmap.createBitmap( size, size, Bitmap.Config.ARGB_8888 );
Rect bounds = new Rect( 0, 0, size, size );
XwJNI.board_figureLayout( m_jniGamePtr, m_gi, 0, 0, 5, 5, false,
bounds, null );
ThumbCanvas canvas = new ThumbCanvas( this, thumb );
XwJNI.board_setDraw( m_jniGamePtr, canvas );
XwJNI.board_invalAll( m_jniGamePtr );
XwJNI.board_draw( m_jniGamePtr );
Rect bounds = new Rect( 0, 0, size, size );
XwJNI.board_figureLayout( m_jniGamePtr, m_gi, 0, 0, 5, 5, false,
bounds, null );
ThumbCanvas canvas = new ThumbCanvas( this, thumb );
XwJNI.board_setDraw( m_jniGamePtr, canvas );
XwJNI.board_invalAll( m_jniGamePtr );
XwJNI.board_draw( m_jniGamePtr );
}
DBUtils.saveThumbnail( this, m_gameLock, thumb );
}
}

View file

@ -445,9 +445,14 @@ public class DBUtils {
ContentValues values = new ContentValues();
String selection = String.format( ROW_ID_FMT, lock.getRowid() );
ByteArrayOutputStream bas = new ByteArrayOutputStream();
thumb.compress( CompressFormat.PNG, 0, bas );
values.put( DBHelper.THUMBNAIL, bas.toByteArray() );
if ( null == thumb ) {
DbgUtils.logf( "clearing thumbnail" );
values.putNull( DBHelper.THUMBNAIL );
} else {
ByteArrayOutputStream bas = new ByteArrayOutputStream();
thumb.compress( CompressFormat.PNG, 0, bas );
values.put( DBHelper.THUMBNAIL, bas.toByteArray() );
}
long result = db.update( DBHelper.TABLE_NAME_SUM,
values, selection, null );