From 563d447d5e7a3379a3d516cb5179a42ea1cb2808 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 15 May 2015 07:36:48 -0700 Subject: [PATCH] remove menuitem to launch dicts browser (and clean up a bit) --- .../eehouse/android/xw4/DictsActivity.java | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) 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 3cbc3f011..a19be63d6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java @@ -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 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 itemData + = new HashMap(); + 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(); 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(); } }