mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-24 07:58:34 +01:00
in popup from dict icon in game toolbar, show only those wordlists in
same language as game, and show "wordlist browser" item last rather than first.
This commit is contained in:
parent
1d6d8e46a3
commit
520611399b
2 changed files with 12 additions and 8 deletions
|
@ -937,7 +937,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
String curDict = m_gi.dictName( m_view.getCurPlayer() );
|
String curDict = m_gi.dictName( m_view.getCurPlayer() );
|
||||||
View button = m_toolbar.getViewFor( Toolbar.BUTTON_BROWSE_DICT );
|
View button = m_toolbar.getViewFor( Toolbar.BUTTON_BROWSE_DICT );
|
||||||
if ( Action.BUTTON_BROWSEALL_ACTION == action &&
|
if ( Action.BUTTON_BROWSEALL_ACTION == action &&
|
||||||
DictsActivity.handleDictsPopup( m_activity, button, curDict ) ) {
|
DictsActivity.handleDictsPopup( m_activity, button,
|
||||||
|
curDict, m_gi.dictLang ) ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DictBrowseDelegate.launch( m_activity, curDict );
|
DictBrowseDelegate.launch( m_activity, curDict );
|
||||||
|
|
|
@ -36,7 +36,8 @@ import org.eehouse.android.xw4.loc.LocUtils;
|
||||||
public class DictsActivity extends XWListActivity {
|
public class DictsActivity extends XWListActivity {
|
||||||
|
|
||||||
private static interface SafePopup {
|
private static interface SafePopup {
|
||||||
public void doPopup( Context context, View button, String curDict );
|
public void doPopup( Context context, View button,
|
||||||
|
String curDict, int lang );
|
||||||
}
|
}
|
||||||
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
|
||||||
|
@ -61,7 +62,7 @@ public class DictsActivity extends XWListActivity {
|
||||||
|
|
||||||
private static class SafePopupImpl implements SafePopup {
|
private static class SafePopupImpl implements SafePopup {
|
||||||
public void doPopup( final Context context, View button,
|
public void doPopup( final Context context, View button,
|
||||||
String curDict ) {
|
String curDict, int lang ) {
|
||||||
|
|
||||||
MenuItem.OnMenuItemClickListener listener =
|
MenuItem.OnMenuItemClickListener listener =
|
||||||
new MenuItem.OnMenuItemClickListener() {
|
new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@ -83,8 +84,6 @@ public class DictsActivity extends XWListActivity {
|
||||||
s_itemData = new HashMap<MenuItem, DictAndLoc>();
|
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();
|
||||||
menu.add( R.string.show_wordlist_browser )
|
|
||||||
.setOnMenuItemClickListener( listener );
|
|
||||||
|
|
||||||
// Add at top but save until have dal info
|
// Add at top but save until have dal info
|
||||||
MenuItem curItem =
|
MenuItem curItem =
|
||||||
|
@ -92,19 +91,23 @@ public class DictsActivity extends XWListActivity {
|
||||||
R.string.cur_menu_marker_fmt,
|
R.string.cur_menu_marker_fmt,
|
||||||
curDict ) );
|
curDict ) );
|
||||||
|
|
||||||
DictAndLoc[] dals = DictUtils.dictList( context );
|
DictAndLoc[] dals = DictLangCache.getDALsHaveLang( context, lang );
|
||||||
for ( DictAndLoc dal : dals ) {
|
for ( DictAndLoc dal : dals ) {
|
||||||
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 );
|
s_itemData.put( item, dal );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu.add( R.string.show_wordlist_browser )
|
||||||
|
.setOnMenuItemClickListener( listener );
|
||||||
|
|
||||||
popup.show();
|
popup.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean handleDictsPopup( Context context, View button,
|
public static boolean handleDictsPopup( Context context, View button,
|
||||||
String curDict )
|
String curDict, int lang )
|
||||||
{
|
{
|
||||||
if ( null == s_safePopup ) {
|
if ( null == s_safePopup ) {
|
||||||
int sdkVersion = Integer.valueOf( android.os.Build.VERSION.SDK );
|
int sdkVersion = Integer.valueOf( android.os.Build.VERSION.SDK );
|
||||||
|
@ -115,7 +118,7 @@ public class DictsActivity extends XWListActivity {
|
||||||
|
|
||||||
boolean canHandle = null != s_safePopup;
|
boolean canHandle = null != s_safePopup;
|
||||||
if ( canHandle ) {
|
if ( canHandle ) {
|
||||||
s_safePopup.doPopup( context, button, curDict );
|
s_safePopup.doPopup( context, button, curDict, lang );
|
||||||
}
|
}
|
||||||
return canHandle;
|
return canHandle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue