mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
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:
parent
b61e580b40
commit
fba7aee83a
2 changed files with 21 additions and 14 deletions
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue