add board layout for small case that doesn't include toolbar or

exchange-state buttons, and check for presence of Views that may now
be missing.  With this checkin small screen devices don't have access
to toolbar functionality -- new and expanded menu will be required for
them.
This commit is contained in:
Eric House 2012-06-05 07:42:39 -07:00 committed by Eric House
parent 1e9928e7f3
commit b78ea03ea6
3 changed files with 39 additions and 7 deletions

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<org.eehouse.android.xw4.BoardView
android:id="@+id/board_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:focusable="true"
android:clickable="true"
android:longClickable="true"
android:drawSelectorOnTop="false"
/>
</LinearLayout>

View file

@ -457,9 +457,13 @@ public class BoardActivity extends XWActivity
m_view = (BoardView)findViewById( R.id.board_view );
m_tradeButtons = findViewById( R.id.exchange_buttons );
m_exchCommmitButton = (Button)findViewById( R.id.exchange_commit );
m_exchCommmitButton.setOnClickListener( this );
if ( null != m_exchCommmitButton ) {
m_exchCommmitButton.setOnClickListener( this );
}
m_exchCancelButton = (Button)findViewById( R.id.exchange_cancel );
m_exchCancelButton.setOnClickListener( this );
if ( null != m_exchCancelButton ) {
m_exchCancelButton.setOnClickListener( this );
}
m_volKeysZoom = CommonPrefs.getVolKeysZoom( this );
Intent intent = getIntent();
@ -1815,8 +1819,10 @@ public class BoardActivity extends XWActivity
private void adjustTradeVisibility()
{
m_toolbar.setVisibility( m_inTrade? View.GONE : View.VISIBLE );
m_tradeButtons.setVisibility( m_inTrade? View.VISIBLE : View.GONE );
if ( m_inTrade ) {
if ( null != m_tradeButtons ) {
m_tradeButtons.setVisibility( m_inTrade? View.VISIBLE : View.GONE );
}
if ( m_inTrade && null != m_exchCommmitButton ) {
m_exchCommmitButton.setEnabled( m_gsi.tradeTilesSelected );
}
}

View file

@ -87,14 +87,18 @@ public class Toolbar {
public void setVisibility( int vis )
{
m_me.setVisibility( vis );
if ( null != m_me ) {
m_me.setVisibility( vis );
}
}
public void setListener( int index, View.OnClickListener listener )
{
TBButtonInfo info = s_buttonInfo[index];
ImageButton button = (ImageButton)m_activity.findViewById( info.m_id );
button.setOnClickListener( listener );
if ( null != button ) {
button.setOnClickListener( listener );
}
}
public void setListener( int index, final int msgID, final int prefsKey,
@ -114,7 +118,9 @@ public class Toolbar {
int vis = enable ? View.VISIBLE : View.GONE;
ImageButton button = (ImageButton)m_activity.findViewById( info.m_id );
button.setVisibility( vis );
if ( null != button ) {
button.setVisibility( vis );
}
}
}