mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
menus are broken: you don't get access to an AttributeSet when inflating them. So replace string references with strings equal to the name of the id (xxx in R.string.xxx); next I'll need to harvest the strings from R.java and map them to their numbers in a way that's runtime-accessible.
This commit is contained in:
parent
2afe048095
commit
f2bfd36780
4 changed files with 44 additions and 30 deletions
|
@ -2,113 +2,113 @@
|
|||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/games_menu_newgame"
|
||||
android:title="@string/button_new_game"
|
||||
android:title="loc:button_new_game"
|
||||
android:icon="@drawable/content_new__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_newgroup"
|
||||
android:title="@string/button_new_group"
|
||||
android:title="loc:button_new_group"
|
||||
android:icon="@drawable/new_group__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_prefs"
|
||||
android:title="@string/menu_prefs"
|
||||
android:title="loc:menu_prefs"
|
||||
android:icon="@drawable/prefs__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/games_menu_rateme"
|
||||
android:title="@string/menu_rateme"
|
||||
android:title="loc:menu_rateme"
|
||||
/>
|
||||
|
||||
<item android:id="@+id/games_menu_dicts"
|
||||
android:title="@string/gamel_menu_dicts"
|
||||
android:title="loc:gamel_menu_dicts"
|
||||
android:icon="@drawable/dict__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_study"
|
||||
android:title="@string/gamel_menu_study"
|
||||
android:title="loc:gamel_menu_study"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_email"
|
||||
android:title="@string/board_menu_file_email"
|
||||
android:title="loc:board_menu_file_email"
|
||||
android:icon="@drawable/email__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_about"
|
||||
android:title="@string/board_menu_file_about"
|
||||
android:title="loc:board_menu_file_about"
|
||||
android:icon="@android:drawable/ic_menu_info_details"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_resend"
|
||||
android:title="@string/board_menu_game_resend"
|
||||
android:title="loc:board_menu_game_resend"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_checkmoves"
|
||||
android:title="@string/gamel_menu_checkmoves"
|
||||
android:title="loc:gamel_menu_checkmoves"
|
||||
android:icon="@drawable/stat_notify_sync"
|
||||
/>
|
||||
|
||||
<!-- Game items -->
|
||||
<item android:id="@+id/games_game_delete"
|
||||
android:title="@string/list_item_delete"
|
||||
android:title="loc:list_item_delete"
|
||||
android:icon="@drawable/content_discard__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_game_config"
|
||||
android:title="@string/list_item_config"
|
||||
android:title="loc:list_item_config"
|
||||
android:icon="@drawable/content_edit"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_game_move"
|
||||
android:title="@string/list_item_move"
|
||||
android:title="loc:list_item_move"
|
||||
android:icon="@drawable/relabel__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_game_reset"
|
||||
android:title="@string/list_item_reset"
|
||||
android:title="loc:list_item_reset"
|
||||
android:icon="@drawable/reset__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_game_new_from"
|
||||
android:title="@string/list_item_new_from"
|
||||
android:title="loc:list_item_new_from"
|
||||
/>
|
||||
<item android:id="@+id/games_game_rename"
|
||||
android:title="@string/list_item_rename"
|
||||
android:title="loc:list_item_rename"
|
||||
/>
|
||||
<item android:id="@+id/games_game_copy"
|
||||
android:title="@string/list_item_copy"
|
||||
android:title="loc:list_item_copy"
|
||||
/>
|
||||
|
||||
<!-- Group items -->
|
||||
<item android:id="@+id/games_group_moveup"
|
||||
android:title="@string/list_group_moveup"
|
||||
android:title="loc:list_group_moveup"
|
||||
android:icon="@drawable/up__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_group_movedown"
|
||||
android:title="@string/list_group_movedown"
|
||||
android:title="loc:list_group_movedown"
|
||||
android:icon="@drawable/down__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_group_delete"
|
||||
android:title="@string/list_group_delete"
|
||||
android:title="loc:list_group_delete"
|
||||
android:icon="@drawable/content_discard__gen"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/games_group_default"
|
||||
android:title="@string/list_group_default"
|
||||
android:title="loc:list_group_default"
|
||||
/>
|
||||
<item android:id="@+id/games_group_rename"
|
||||
android:title="@string/list_group_rename"
|
||||
android:title="loc:list_group_rename"
|
||||
/>
|
||||
|
||||
<!-- Debug only menuitems -->
|
||||
<item android:id="@+id/games_menu_checkupdates"
|
||||
android:title="@string/gamel_menu_checkupdates"
|
||||
android:title="loc:gamel_menu_checkupdates"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_storedb"
|
||||
android:title="@string/gamel_menu_storedb"
|
||||
android:title="loc:gamel_menu_storedb"
|
||||
/>
|
||||
<item android:id="@+id/games_menu_loaddb"
|
||||
android:title="@string/gamel_menu_loaddb"
|
||||
android:title="loc:gamel_menu_loaddb"
|
||||
/>
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -125,10 +125,7 @@ public class GamesListActivity extends ListActivity {
|
|||
@Override
|
||||
public boolean onCreateOptionsMenu( Menu menu )
|
||||
{
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate( R.menu.games_list_menu, menu );
|
||||
|
||||
return true;
|
||||
return m_dlgt.onCreateOptionsMenu( menu );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,6 +58,7 @@ import junit.framework.Assert;
|
|||
|
||||
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||
import org.eehouse.android.xw4.jni.*;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class GamesListDelegate extends DelegateBase
|
||||
implements OnItemLongClickListener,
|
||||
|
@ -622,6 +623,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
{
|
||||
MenuInflater inflater = m_activity.getMenuInflater();
|
||||
inflater.inflate( R.menu.games_list_menu, menu );
|
||||
LocUtils.xlateMenu( menu );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ package org.eehouse.android.xw4.loc;
|
|||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -47,6 +49,19 @@ public class LocUtils {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void xlateMenu( Menu menu )
|
||||
{
|
||||
int count = menu.size();
|
||||
DbgUtils.logf( "xlateMenu: menu has %d items", count );
|
||||
for ( int ii = 0; ii < count; ++ii ) {
|
||||
MenuItem item = menu.getItem( ii );
|
||||
String title = item.getTitle().toString();
|
||||
DbgUtils.logf( "xlateMenu: %d; %s", ii, title );
|
||||
if ( title.startsWith( "loc:" ) ) {
|
||||
item.setTitle( title.substring( 4 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue