mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +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;
|
private static SafePopup s_safePopup = null;
|
||||||
// I can't provide a subclass of MenuItem to hold DictAndLoc, so
|
// I can't provide a subclass of MenuItem to hold DictAndLoc, so
|
||||||
// settle for a hash on the side.
|
// settle for a hash on the side.
|
||||||
private static HashMap<MenuItem, DictAndLoc> s_itemData;
|
|
||||||
|
|
||||||
private DictsDelegate m_dlgt;
|
private DictsDelegate m_dlgt;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,24 +62,21 @@ public class DictsActivity extends XWListActivity {
|
||||||
public void doPopup( final Context context, View button,
|
public void doPopup( final Context context, View button,
|
||||||
String curDict, int lang ) {
|
String curDict, int lang ) {
|
||||||
|
|
||||||
|
final HashMap<MenuItem, DictAndLoc> itemData
|
||||||
|
= new HashMap<MenuItem, DictAndLoc>();
|
||||||
|
|
||||||
MenuItem.OnMenuItemClickListener listener =
|
MenuItem.OnMenuItemClickListener listener =
|
||||||
new MenuItem.OnMenuItemClickListener() {
|
new MenuItem.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick( MenuItem item )
|
public boolean onMenuItemClick( MenuItem item )
|
||||||
{
|
{
|
||||||
DictAndLoc dal = s_itemData.get( item );
|
DictAndLoc dal = itemData.get( item );
|
||||||
s_itemData = null;
|
|
||||||
|
|
||||||
if ( null == dal ) {
|
DictBrowseDelegate.launch( context, dal.name,
|
||||||
DictsActivity.start( context );
|
dal.loc );
|
||||||
} else {
|
|
||||||
DictBrowseDelegate.launch( context, dal.name,
|
|
||||||
dal.loc );
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
s_itemData = new HashMap<MenuItem, DictAndLoc>();
|
|
||||||
PopupMenu popup = new PopupMenu( context, button );
|
PopupMenu popup = new PopupMenu( context, button );
|
||||||
Menu menu = popup.getMenu();
|
Menu menu = popup.getMenu();
|
||||||
|
|
||||||
|
@ -96,12 +91,9 @@ public class DictsActivity extends XWListActivity {
|
||||||
MenuItem item = dal.name.equals(curDict)
|
MenuItem item = dal.name.equals(curDict)
|
||||||
? curItem : menu.add( dal.name );
|
? curItem : menu.add( dal.name );
|
||||||
item.setOnMenuItemClickListener( listener );
|
item.setOnMenuItemClickListener( listener );
|
||||||
s_itemData.put( item, dal );
|
itemData.put( item, dal );
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.add( R.string.show_wordlist_browser )
|
|
||||||
.setOnMenuItemClickListener( listener );
|
|
||||||
|
|
||||||
popup.show();
|
popup.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue