add empty view so screen is never completely blank

This commit is contained in:
Andy2 2011-05-18 06:28:44 -07:00
parent 55278ab2a2
commit 71afbf617c
3 changed files with 15 additions and 4 deletions

View file

@ -32,8 +32,14 @@
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"
>
</ListView>
/>
<TextView android:id="@+id/empty_list_msg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:text="@string/empty_list_msg"
/>
<Button android:id="@+id/new_game"
android:layout_width="fill_parent"

View file

@ -552,5 +552,6 @@
<string name="empty_games_list2">You can hide this and the button
below in the Appearance section of Settings (accessed via your
device\'s menu key).</string>
<string name="empty_list_msg">Use the menu key, Luke!</string>
</resources>

View file

@ -224,10 +224,14 @@ public class GamesList extends XWListActivity
boolean hide = CommonPrefs.getHideIntro( this );
int hereOrGone = hide ? View.GONE : View.VISIBLE;
for ( int id : new int[]{ R.id.empty_games_list, R.id.new_game } ) {
View view = findViewById( id /*R.id.empty_games_list*/ );
for ( int id : new int[]{ R.id.empty_games_list,
R.id.new_game } ) {
View view = findViewById( id );
view.setVisibility( hereOrGone );
}
View empty = findViewById( R.id.empty_list_msg );
empty.setVisibility( hide ? View.VISIBLE : View.GONE );
getListView().setEmptyView( hide? empty : null );
// TelephonyManager mgr =
// (TelephonyManager)getSystemService( Context.TELEPHONY_SERVICE );