make the empty-list message a header instead since its instructions

matter after there are games in the list.  But hide it whenever there
are four or more games.
This commit is contained in:
Andy2 2011-03-09 18:42:06 -08:00
parent bfc5bb62dc
commit 26a274ab0f
2 changed files with 24 additions and 21 deletions

View file

@ -7,27 +7,20 @@
android:paddingLeft="8dp"
android:paddingRight="8dp">
<!-- FrameLayout required since Activity will pick between the two
view using the latter only if the list is empty. -->
<FrameLayout android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TextView android:id="@+id/empty_games_list"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/empty_games_list"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<ListView android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"
/>
<TextView android:id="@+id/empty_games_list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:text="@string/empty_games_list"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</FrameLayout>
<ListView android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"
>
</ListView>
<Button android:id="@+id/new_game"
android:layout_width="fill_parent"

View file

@ -161,7 +161,6 @@ public class GamesList extends XWListActivity
setContentView(R.layout.game_list);
ListView listView = getListView();
listView.setEmptyView( findViewById( R.id.empty_games_list ) );
registerForContextMenu( listView );
boolean isUpgrade = FirstRunDialog.show( this, false );
@ -244,6 +243,17 @@ public class GamesList extends XWListActivity
super.onDestroy();
}
@Override
public void onContentChanged()
{
int count = DBUtils.gamesList( this ).length;
int hereOrGone = count > 3 ? View.GONE : View.VISIBLE;
View hint = findViewById( R.id.empty_games_list );
hint.setVisibility( hereOrGone );
super.onContentChanged();
}
// DispatchNotify.HandleRelaysIface interface
public void HandleRelaysIDs( final String[] relayIDs )
{