hook up long click to [de]select

This commit is contained in:
Eric House 2014-03-19 21:36:49 -07:00
parent fd817a98da
commit 64a5aab456

View file

@ -45,7 +45,8 @@ import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.jni.GameSummary;
public class StudyList extends XWListActivity
implements OnItemSelectedListener, SelectableItem {
implements OnItemSelectedListener, SelectableItem,
View.OnLongClickListener {
public static final int NO_LANG = -1;
@ -186,6 +187,18 @@ public class StudyList extends XWListActivity
{
}
//////////////////////////////////////////////////
// View.OnLongClickListener interface
//////////////////////////////////////////////////
public boolean onLongClick( View view )
{
boolean success = view instanceof SelectableItem.LongClickHandler;
if ( success ) {
((SelectableItem.LongClickHandler)view).longClicked();
}
return success;
}
//////////////////////////////////////////////////
// SelectableItem interface
//////////////////////////////////////////////////
@ -353,6 +366,7 @@ public class StudyList extends XWListActivity
item.setPosition( position );
item.setText( m_words[position] );
item.setSelected( m_checkeds.contains(position) );
item.setOnLongClickListener( StudyList.this );
DbgUtils.logf( "getView(position=%d) => %H", position, item );
return item;
}