mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
remove menuitem to launch dicts browser (and clean up a bit)
This commit is contained in:
parent
a4ce83f9cf
commit
563d447d5e
1 changed files with 7 additions and 15 deletions
|
@ -42,8 +42,6 @@ public class DictsActivity extends XWListActivity {
|
|||
private static SafePopup s_safePopup = null;
|
||||
// I can't provide a subclass of MenuItem to hold DictAndLoc, so
|
||||
// settle for a hash on the side.
|
||||
private static HashMap<MenuItem, DictAndLoc> s_itemData;
|
||||
|
||||
private DictsDelegate m_dlgt;
|
||||
|
||||
@Override
|
||||
|
@ -64,24 +62,21 @@ public class DictsActivity extends XWListActivity {
|
|||
public void doPopup( final Context context, View button,
|
||||
String curDict, int lang ) {
|
||||
|
||||
final HashMap<MenuItem, DictAndLoc> itemData
|
||||
= new HashMap<MenuItem, DictAndLoc>();
|
||||
|
||||
MenuItem.OnMenuItemClickListener listener =
|
||||
new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick( MenuItem item )
|
||||
{
|
||||
DictAndLoc dal = s_itemData.get( item );
|
||||
s_itemData = null;
|
||||
DictAndLoc dal = itemData.get( item );
|
||||
|
||||
if ( null == dal ) {
|
||||
DictsActivity.start( context );
|
||||
} else {
|
||||
DictBrowseDelegate.launch( context, dal.name,
|
||||
dal.loc );
|
||||
}
|
||||
DictBrowseDelegate.launch( context, dal.name,
|
||||
dal.loc );
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
s_itemData = new HashMap<MenuItem, DictAndLoc>();
|
||||
PopupMenu popup = new PopupMenu( context, button );
|
||||
Menu menu = popup.getMenu();
|
||||
|
||||
|
@ -96,12 +91,9 @@ public class DictsActivity extends XWListActivity {
|
|||
MenuItem item = dal.name.equals(curDict)
|
||||
? curItem : menu.add( dal.name );
|
||||
item.setOnMenuItemClickListener( listener );
|
||||
s_itemData.put( item, dal );
|
||||
itemData.put( item, dal );
|
||||
}
|
||||
|
||||
menu.add( R.string.show_wordlist_browser )
|
||||
.setOnMenuItemClickListener( listener );
|
||||
|
||||
popup.show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue