diff --git a/xwords4/android/XWords4/res/menu/dicts_item_menu.xml b/xwords4/android/XWords4/res/menu/dicts_item_menu.xml
index 9b5be2e11..c1a0e24be 100644
--- a/xwords4/android/XWords4/res/menu/dicts_item_menu.xml
+++ b/xwords4/android/XWords4/res/menu/dicts_item_menu.xml
@@ -4,9 +4,6 @@
-
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
index a1aae15ee..72c2388f2 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
@@ -39,7 +39,8 @@ import android.content.SharedPreferences;
import junit.framework.Assert;
public class DictsActivity extends ListActivity
- implements View.OnClickListener {
+ implements View.OnClickListener,
+ XWListItem.DeleteCallback {
String[] m_dicts;
private class DictListAdapter extends XWListAdapter {
@@ -58,6 +59,12 @@ public class DictsActivity extends ListActivity
= (XWListItem)factory.inflate( R.layout.list_item, null );
view.setPosition( position );
view.setText( m_dicts[position] );
+
+ if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
+ m_dicts[position] ) ) {
+ view.setDeleteCallback( DictsActivity.this );
+ }
+
return view;
}
}
@@ -88,8 +95,8 @@ public class DictsActivity extends ListActivity
@Override
public void onCreateContextMenu( ContextMenu menu, View view,
- ContextMenuInfo menuInfo ) {
-
+ ContextMenuInfo menuInfo )
+ {
super.onCreateContextMenu( menu, view, menuInfo );
MenuInflater inflater = getMenuInflater();
@@ -97,12 +104,6 @@ public class DictsActivity extends ListActivity
AdapterView.AdapterContextMenuInfo info
= (AdapterView.AdapterContextMenuInfo)menuInfo;
-
- String dict = m_dicts[info.position];
- if ( GameUtils.dictIsBuiltin( this, dict ) ) {
- MenuItem item = menu.findItem( R.id.dicts_item_delete );
- item.setVisible( false );
- }
}
@Override
@@ -127,11 +128,6 @@ public class DictsActivity extends ListActivity
editor.putString( key, m_dicts[info.position] );
editor.commit();
break;
- case R.id.dicts_item_delete:
- GameUtils.deleteDict( this, m_dicts[info.position] );
- mkListAdapter();
- handled = true;
- break;
case R.id.dicts_item_details:
Utils.notImpl( this );
break;
@@ -140,6 +136,13 @@ public class DictsActivity extends ListActivity
return handled;
}
+ // DeleteCallback interface
+ public void deleteCalled( int myPosition )
+ {
+ GameUtils.deleteDict( this, m_dicts[myPosition] );
+ mkListAdapter();
+ }
+
private void mkListAdapter()
{
m_dicts = GameUtils.dictList( this );