mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
add an empty view along side list view; all setEmptyView to install it
to be shown when list is empty.
This commit is contained in:
parent
740060f531
commit
693909ec67
3 changed files with 27 additions and 7 deletions
|
@ -7,11 +7,26 @@
|
|||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<ListView android:id="@id/android:list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawSelectorOnTop="false"/>
|
||||
<!-- 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" >
|
||||
|
||||
<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"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<Button android:id="@+id/new_game"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -502,4 +502,8 @@
|
|||
<string name="no_empty_rooms">This game cannot connect without a
|
||||
room name.</string>
|
||||
|
||||
<string name="empty_games_list">Use one of the buttons below to
|
||||
create a game. Then tap the game to play or long-tap it for
|
||||
other options.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -179,14 +179,15 @@ public class GamesList extends XWListActivity
|
|||
m_handler = new Handler();
|
||||
|
||||
setContentView(R.layout.game_list);
|
||||
ListView listView = getListView();
|
||||
listView.setEmptyView( findViewById( R.id.empty_games_list ) );
|
||||
registerForContextMenu( listView );
|
||||
|
||||
boolean isUpgrade = FirstRunDialog.show( this, false );
|
||||
PreferenceManager.setDefaultValues( this, R.xml.xwprefs, isUpgrade );
|
||||
|
||||
// setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
|
||||
|
||||
registerForContextMenu( getListView() );
|
||||
|
||||
Button newGameB = (Button)findViewById(R.id.new_game);
|
||||
newGameB.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue