mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
make static GamesListItem method responsible for providing new instances.
This commit is contained in:
parent
21e572acfc
commit
4d07046a99
2 changed files with 16 additions and 10 deletions
|
@ -22,15 +22,12 @@ package org.eehouse.android.xw4;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ExpandableListAdapter;
|
import android.widget.ExpandableListAdapter;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.TextView;
|
|
||||||
import java.util.HashMap; // class is not synchronized
|
import java.util.HashMap; // class is not synchronized
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
@ -42,7 +39,6 @@ import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
|
||||||
public class GameListAdapter implements ExpandableListAdapter {
|
public class GameListAdapter implements ExpandableListAdapter {
|
||||||
private Context m_context;
|
private Context m_context;
|
||||||
private ExpandableListView m_list;
|
private ExpandableListView m_list;
|
||||||
private LayoutInflater m_factory;
|
|
||||||
private int m_fieldID;
|
private int m_fieldID;
|
||||||
private Handler m_handler;
|
private Handler m_handler;
|
||||||
private LoadItemCB m_cb;
|
private LoadItemCB m_cb;
|
||||||
|
@ -61,7 +57,6 @@ public class GameListAdapter implements ExpandableListAdapter {
|
||||||
m_handler = handler;
|
m_handler = handler;
|
||||||
m_cb = cb;
|
m_cb = cb;
|
||||||
m_positions = positions;
|
m_positions = positions;
|
||||||
m_factory = LayoutInflater.from( context );
|
|
||||||
|
|
||||||
m_fieldID = fieldToID( fieldName );
|
m_fieldID = fieldToID( fieldName );
|
||||||
}
|
}
|
||||||
|
@ -193,9 +188,9 @@ public class GameListAdapter implements ExpandableListAdapter {
|
||||||
private View getChildView( int groupPosition, int childPosition )
|
private View getChildView( int groupPosition, int childPosition )
|
||||||
{
|
{
|
||||||
long rowid = getRowIDFor( groupPosition, childPosition );
|
long rowid = getRowIDFor( groupPosition, childPosition );
|
||||||
GameListItem result = (GameListItem)
|
GameListItem result =
|
||||||
m_factory.inflate( R.layout.game_list_item, null );
|
GameListItem.makeForRow( m_context, rowid, m_handler,
|
||||||
result.init( m_handler, rowid, groupPosition, m_fieldID, m_cb );
|
groupPosition, m_fieldID, m_cb );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class GameListItem extends LinearLayout
|
||||||
m_loadingCount = 0;
|
m_loadingCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init( Handler handler, long rowid, int groupPosition,
|
private void init( Handler handler, long rowid, int groupPosition,
|
||||||
int fieldID, GameListAdapter.LoadItemCB cb )
|
int fieldID, GameListAdapter.LoadItemCB cb )
|
||||||
{
|
{
|
||||||
m_handler = handler;
|
m_handler = handler;
|
||||||
m_rowid = rowid;
|
m_rowid = rowid;
|
||||||
|
@ -304,6 +304,17 @@ public class GameListItem extends LinearLayout
|
||||||
}
|
}
|
||||||
} // class LoadItemTask
|
} // class LoadItemTask
|
||||||
|
|
||||||
|
public static GameListItem makeForRow( Context context, long rowid,
|
||||||
|
Handler handler, int groupPosition,
|
||||||
|
int fieldID,
|
||||||
|
GameListAdapter.LoadItemCB cb )
|
||||||
|
{
|
||||||
|
GameListItem result =
|
||||||
|
(GameListItem)Utils.inflate( context, R.layout.game_list_item );
|
||||||
|
result.init( handler, rowid, groupPosition, fieldID, cb );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static void inval( long rowid )
|
public static void inval( long rowid )
|
||||||
{
|
{
|
||||||
synchronized( s_invalRows ) {
|
synchronized( s_invalRows ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue