mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-06 20:45:54 +01:00
hook up onClick to launch lookup
This commit is contained in:
parent
64a5aab456
commit
426e939b61
1 changed files with 15 additions and 18 deletions
|
@ -46,7 +46,7 @@ import org.eehouse.android.xw4.jni.GameSummary;
|
||||||
|
|
||||||
public class StudyList extends XWListActivity
|
public class StudyList extends XWListActivity
|
||||||
implements OnItemSelectedListener, SelectableItem,
|
implements OnItemSelectedListener, SelectableItem,
|
||||||
View.OnLongClickListener {
|
View.OnLongClickListener, View.OnClickListener {
|
||||||
|
|
||||||
public static final int NO_LANG = -1;
|
public static final int NO_LANG = -1;
|
||||||
|
|
||||||
|
@ -166,13 +166,6 @@ public class StudyList extends XWListActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onListItemClick( ListView lv, View view, int position, long id )
|
|
||||||
{
|
|
||||||
String[] words = { m_words[position] };
|
|
||||||
launchLookup( words, m_langCodes[m_langPosition], true );
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// AdapterView.OnItemSelectedListener interface
|
// AdapterView.OnItemSelectedListener interface
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
@ -199,6 +192,16 @@ public class StudyList extends XWListActivity
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
// View.OnClickListener interface
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
public void onClick( View view )
|
||||||
|
{
|
||||||
|
XWListItem item = (XWListItem)view;
|
||||||
|
String[] words = { m_words[item.getPosition()] };
|
||||||
|
launchLookup( words, m_langCodes[m_langPosition], true );
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// SelectableItem interface
|
// SelectableItem interface
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
@ -291,7 +294,6 @@ public class StudyList extends XWListActivity
|
||||||
{
|
{
|
||||||
CharSequence newTitle;
|
CharSequence newTitle;
|
||||||
int nSels = m_checkeds.size();
|
int nSels = m_checkeds.size();
|
||||||
DbgUtils.logf( "setTitleBar: nSels=%d", nSels );
|
|
||||||
if ( 0 == nSels ) {
|
if ( 0 == nSels ) {
|
||||||
newTitle = m_origTitle;
|
newTitle = m_origTitle;
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,10 +349,6 @@ public class StudyList extends XWListActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SLWordsAdapter<String> extends ArrayAdapter<String> {
|
private class SLWordsAdapter<String> extends ArrayAdapter<String> {
|
||||||
// public SLWordsAdapter()
|
|
||||||
// {
|
|
||||||
// super( m_words.length );
|
|
||||||
// }
|
|
||||||
|
|
||||||
public SLWordsAdapter( Context context, int ignored, String[] strings) {
|
public SLWordsAdapter( Context context, int ignored, String[] strings) {
|
||||||
super( context, ignored, strings );
|
super( context, ignored, strings );
|
||||||
|
@ -360,16 +358,15 @@ public class StudyList extends XWListActivity
|
||||||
super( context, resource );
|
super( context, resource );
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getView( int position, View convertView,
|
public View getView( int position, View convertView, ViewGroup parent ){
|
||||||
ViewGroup parent ) {
|
XWListItem item =
|
||||||
XWListItem item = XWListItem.inflate( StudyList.this, StudyList.this );
|
XWListItem.inflate( StudyList.this, StudyList.this );
|
||||||
item.setPosition( position );
|
item.setPosition( position );
|
||||||
item.setText( m_words[position] );
|
item.setText( m_words[position] );
|
||||||
item.setSelected( m_checkeds.contains(position) );
|
item.setSelected( m_checkeds.contains(position) );
|
||||||
item.setOnLongClickListener( StudyList.this );
|
item.setOnLongClickListener( StudyList.this );
|
||||||
DbgUtils.logf( "getView(position=%d) => %H", position, item );
|
item.setOnClickListener( StudyList.this );
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue