From 24e015f259802debdb9d38a0e634d8cba98edcf8 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 20 Nov 2013 08:15:18 -0800 Subject: [PATCH] don't make snapshots for non-expanded game list items; make when first expanded instead. --- .../org/eehouse/android/xw4/GameListItem.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java index 54287260b..6b621e357 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java @@ -169,6 +169,9 @@ public class GameListItem extends LinearLayout public void onClick( View view ) { m_expanded = !m_expanded; DBUtils.setExpanded( m_rowid, m_expanded ); + + makeThumbnailIf( m_expanded ); + showHide(); } @@ -243,7 +246,7 @@ public class GameListItem extends LinearLayout return state; } - private void setData( GameSummary summary ) + private void setData( GameSummary summary, boolean expanded ) { if ( null != summary ) { TextView tview; @@ -318,8 +321,6 @@ public class GameListItem extends LinearLayout tview.setVisibility( View.GONE ); } - boolean expanded = DBUtils.getExpanded( m_context, m_rowid ); - update( expanded, summary.lastMoveTime, haveATurn, haveALocalTurn ); } @@ -337,6 +338,16 @@ public class GameListItem extends LinearLayout m_cb.itemToggled( this, m_selected ); } + private void makeThumbnailIf( boolean expanded ) + { + if ( expanded && null != m_activity && null != m_summary + && null == m_summary.getThumbnail() + && XWPrefs.getThumbEnabled( m_context ) ) { + m_summary.setThumbnail( GameUtils.loadMakeBitmap( m_activity, + m_rowid ) ); + } + } + private class LoadItemTask extends AsyncTask { @Override protected GameSummary doInBackground( Void... unused ) @@ -349,15 +360,11 @@ public class GameListItem extends LinearLayout { if ( 0 == --m_loadingCount ) { m_summary = summary; + boolean expanded = DBUtils.getExpanded( m_context, m_rowid ); - if ( null != m_activity && null != summary - && null == summary.getThumbnail() - && XWPrefs.getThumbEnabled( m_context ) ) { - summary.setThumbnail( GameUtils.loadMakeBitmap( m_activity, - m_rowid ) ); - } + makeThumbnailIf( expanded ); - setData( summary ); + setData( summary, expanded ); setLoaded( null != m_summary ); synchronized( s_invalRows ) { s_invalRows.remove( m_rowid );