mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
derive GameListGroup from ExpiringLinearLayout
This commit is contained in:
parent
d896670c21
commit
3ff60861f7
4 changed files with 20 additions and 24 deletions
|
@ -8,18 +8,17 @@
|
||||||
android:background="#FF7F7F7F"
|
android:background="#FF7F7F7F"
|
||||||
>
|
>
|
||||||
|
|
||||||
<org.eehouse.android.xw4.ExpiringTextView
|
<TextView android:id="@+id/game_name"
|
||||||
android:id="@+id/game_name"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:gravity="left"
|
||||||
android:gravity="left"
|
android:singleLine="true"
|
||||||
android:singleLine="true"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:paddingTop="3dp"
|
||||||
android:paddingTop="3dp"
|
android:paddingBottom="3dp"
|
||||||
android:paddingBottom="3dp"
|
android:textStyle="italic"
|
||||||
android:textStyle="italic"
|
android:layout_weight="1"
|
||||||
android:layout_weight="1"
|
/>
|
||||||
/>
|
|
||||||
|
|
||||||
<ImageButton android:id="@+id/expander"
|
<ImageButton android:id="@+id/expander"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class ExpiringLinearLayout extends LinearLayout {
|
||||||
protected void onDraw( Canvas canvas )
|
protected void onDraw( Canvas canvas )
|
||||||
{
|
{
|
||||||
super.onDraw( canvas );
|
super.onDraw( canvas );
|
||||||
m_delegate.onDraw( canvas );
|
if ( null != m_delegate ) {
|
||||||
|
m_delegate.onDraw( canvas );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,7 +564,7 @@ public class GameListAdapter extends XWListAdapter
|
||||||
GameListGroup group = getGroupItemFor( groupPosition );
|
GameListGroup group = getGroupItemFor( groupPosition );
|
||||||
if ( null != group ) {
|
if ( null != group ) {
|
||||||
GameGroupInfo ggi = getInfoForGroup( groupPosition );
|
GameGroupInfo ggi = getInfoForGroup( groupPosition );
|
||||||
group.setPct( ggi.m_hasTurn, ggi.m_turnLocal, ggi.m_lastMoveTime );
|
group.setPct( m_handler, ggi.m_hasTurn, ggi.m_turnLocal, ggi.m_lastMoveTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,13 @@ import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
|
import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
|
||||||
|
|
||||||
public class GameListGroup extends LinearLayout
|
public class GameListGroup extends ExpiringLinearLayout
|
||||||
implements SelectableItem.LongClickHandler,
|
implements SelectableItem.LongClickHandler,
|
||||||
View.OnClickListener,
|
View.OnClickListener,
|
||||||
View.OnLongClickListener
|
View.OnLongClickListener
|
||||||
|
@ -44,7 +45,7 @@ public class GameListGroup extends LinearLayout
|
||||||
private boolean m_expanded;
|
private boolean m_expanded;
|
||||||
private SelectableItem m_cb;
|
private SelectableItem m_cb;
|
||||||
private GroupStateListener m_gcb;
|
private GroupStateListener m_gcb;
|
||||||
private ExpiringTextView m_etv;
|
private TextView m_etv;
|
||||||
private boolean m_selected;
|
private boolean m_selected;
|
||||||
private int m_nGames;
|
private int m_nGames;
|
||||||
private DrawSelDelegate m_dsdel;
|
private DrawSelDelegate m_dsdel;
|
||||||
|
@ -81,7 +82,7 @@ public class GameListGroup extends LinearLayout
|
||||||
protected void onFinishInflate()
|
protected void onFinishInflate()
|
||||||
{
|
{
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
m_etv = (ExpiringTextView)findViewById( R.id.game_name );
|
m_etv = (TextView)findViewById( R.id.game_name );
|
||||||
m_expandButton = (ImageButton)findViewById( R.id.expander );
|
m_expandButton = (ImageButton)findViewById( R.id.expander );
|
||||||
|
|
||||||
// click on me OR the button expands/contracts...
|
// click on me OR the button expands/contracts...
|
||||||
|
@ -122,12 +123,6 @@ public class GameListGroup extends LinearLayout
|
||||||
m_etv.setText( text );
|
m_etv.setText( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setPct( boolean haveTurn, boolean haveTurnLocal,
|
|
||||||
long startSecs )
|
|
||||||
{
|
|
||||||
m_etv.setPct( haveTurn, haveTurnLocal, startSecs );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameListAdapter.ClickHandler interface
|
// GameListAdapter.ClickHandler interface
|
||||||
public void longClicked()
|
public void longClicked()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue