mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
only show lookup menuitem when there's a single word selected, and include that word in the menu title
This commit is contained in:
parent
e2cd275459
commit
73a1083dff
3 changed files with 11 additions and 5 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/slmenu_lookup_sel"
|
||||
android:title="@string/slmenu_lookup_sel"
|
||||
android:icon="@drawable/search__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
|
|
|
@ -2230,6 +2230,5 @@
|
|||
<string name="slmenu_select_all">Select all</string>
|
||||
<string name="slmenu_deselect_all">Unselect all</string>
|
||||
<string name="sel_itemsf">Selected: %d</string>
|
||||
<string name="slmenu_lookup_sel">Look up</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -98,9 +98,16 @@ public class StudyList extends XWListActivity
|
|||
int nSel = m_checkeds.size();
|
||||
Utils.setItemVisible( menu, R.id.slmenu_copy_sel, 0 < nSel );
|
||||
Utils.setItemVisible( menu, R.id.slmenu_clear_sel, 0 < nSel );
|
||||
Utils.setItemVisible( menu, R.id.slmenu_select_all, m_words.length > nSel );
|
||||
Utils.setItemVisible( menu, R.id.slmenu_select_all,
|
||||
m_words.length > nSel );
|
||||
Utils.setItemVisible( menu, R.id.slmenu_deselect_all, 0 < nSel );
|
||||
Utils.setItemVisible( menu, R.id.slmenu_lookup_sel, 0 < nSel );
|
||||
boolean enable = 1 == nSel;
|
||||
if ( enable ) {
|
||||
String title =
|
||||
getString( R.string.button_lookupf, getSelWords()[0] );
|
||||
menu.findItem( R.id.slmenu_lookup_sel ).setTitle( title );
|
||||
}
|
||||
Utils.setItemVisible( menu, R.id.slmenu_lookup_sel, enable );
|
||||
return super.onPrepareOptionsMenu( menu );
|
||||
}
|
||||
|
||||
|
@ -130,7 +137,8 @@ public class StudyList extends XWListActivity
|
|||
clearSels();
|
||||
break;
|
||||
case R.id.slmenu_lookup_sel:
|
||||
launchLookup( getSelWords(), m_langCodes[m_langPosition], true );
|
||||
String[] oneWord = new String[]{ getSelWords()[0] };
|
||||
launchLookup( oneWord, m_langCodes[m_langPosition], true );
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue