From 5e03e0cc753620d27d00bb6e30900a3b6bc634ba Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 9 Apr 2014 05:52:36 -0700 Subject: [PATCH] fix crash adding first game to newly installed app by counting games and groups the same way getView determines if they exist. --- .../src/org/eehouse/android/xw4/GameListAdapter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index c5809bb8a..53f3ec56b 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -67,8 +67,15 @@ public class GameListAdapter extends XWListAdapter @Override public int getCount() { - return DBUtils.getGroups( m_context ).size() - + DBUtils.countVisibleGames( m_context ); + HashMap groups = DBUtils.getGroups( m_context ); + int count = groups.size(); + for ( GameGroupInfo ggi : groups.values() ) { + if ( ggi.m_expanded ) { + count += ggi.m_count; + } + } + // DbgUtils.logf( "GameListAdapter.getCount() => %d", count ); + return count; } @Override