mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
show green border in contracted view too when appropriate, and not
only for net games.
This commit is contained in:
parent
d46c827b4c
commit
545cf9166f
1 changed files with 16 additions and 9 deletions
|
@ -52,15 +52,16 @@ public class GameListAdapter extends XWListAdapter {
|
|||
private View m_view;
|
||||
private View m_hideable;
|
||||
private View m_name;
|
||||
private boolean m_expanded, m_haveTurn;
|
||||
private boolean m_expanded, m_haveTurn, m_haveTurnLocal;
|
||||
private long m_rowid;
|
||||
private ImageButton m_expandButton;
|
||||
public ViewInfo( View view, long rowid, boolean expanded,
|
||||
boolean haveTurn ) {
|
||||
boolean haveTurn, boolean haveTurnLocal ) {
|
||||
m_view = view;
|
||||
m_rowid = rowid;
|
||||
m_expanded = expanded;
|
||||
m_haveTurn = haveTurn;
|
||||
m_haveTurnLocal = haveTurnLocal;
|
||||
m_hideable = (LinearLayout)view.findViewById( R.id.hideable );
|
||||
m_name = (TextView)m_view.findViewById( R.id.game_name );
|
||||
m_expandButton = (ImageButton)view.findViewById( R.id.expander );
|
||||
|
@ -75,8 +76,14 @@ public class GameListAdapter extends XWListAdapter {
|
|||
R.drawable.expander_ic_minimized);
|
||||
m_hideable.setVisibility( m_expanded? View.VISIBLE : View.GONE );
|
||||
|
||||
m_name.setBackgroundColor( m_haveTurn && !m_expanded ? TURN_COLOR :
|
||||
android.R.color.transparent );
|
||||
m_name.setBackgroundColor( android.R.color.transparent );
|
||||
if ( !m_expanded ) {
|
||||
if ( m_haveTurnLocal ) {
|
||||
m_name.setBackgroundColor( TURN_COLOR );
|
||||
} else if ( m_haveTurn ) {
|
||||
m_name.setBackgroundResource( R.drawable.green_border );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick( View view ) {
|
||||
|
@ -164,7 +171,8 @@ public class GameListAdapter extends XWListAdapter {
|
|||
|
||||
LinearLayout list =
|
||||
(LinearLayout)layout.findViewById( R.id.player_list );
|
||||
boolean haveNetTurn = false;
|
||||
boolean haveTurn = false;
|
||||
boolean haveTurnLocal = false;
|
||||
boolean[] isLocal = new boolean[1];
|
||||
for ( int ii = 0; ii < summary.nPlayers; ++ii ) {
|
||||
View tmp = m_factory.inflate( R.layout.player_list_elem,
|
||||
|
@ -174,14 +182,13 @@ public class GameListAdapter extends XWListAdapter {
|
|||
view = (TextView)tmp.findViewById( R.id.item_score );
|
||||
view.setText( String.format( " %d", summary.scores[ii] ) );
|
||||
if ( summary.isNextToPlay( ii, isLocal ) ) {
|
||||
haveTurn = true;
|
||||
if ( isLocal[0] ) {
|
||||
haveTurnLocal = true;
|
||||
tmp.setBackgroundColor( TURN_COLOR );
|
||||
} else {
|
||||
tmp.setBackgroundResource( R.drawable.green_border );
|
||||
}
|
||||
if ( summary.isMultiGame() ) {
|
||||
haveNetTurn = true;
|
||||
}
|
||||
}
|
||||
list.addView( tmp, ii );
|
||||
}
|
||||
|
@ -216,7 +223,7 @@ public class GameListAdapter extends XWListAdapter {
|
|||
|
||||
boolean expanded = DBUtils.getExpanded( m_context, m_rowid );
|
||||
ViewInfo vi = new ViewInfo( layout, m_rowid,
|
||||
expanded, haveNetTurn );
|
||||
expanded, haveTurn, haveTurnLocal );
|
||||
|
||||
synchronized( m_viewsCache ) {
|
||||
m_viewsCache.put( m_rowid, vi );
|
||||
|
|
Loading…
Add table
Reference in a new issue