mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
Merge branch 'android_branch' into android_invite
Conflicts: xwords4/android/XWords4/res/values/strings.xml
This commit is contained in:
commit
8b130521fa
13 changed files with 305 additions and 154 deletions
|
@ -7,11 +7,11 @@
|
|||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<ListView android:id="@id/android:list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawSelectorOnTop="false"/>
|
||||
<ExpandableListView android:id="@id/android:list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawSelectorOnTop="false"/>
|
||||
|
||||
<Button android:id="@+id/download"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<string name="strs_move_across">mou (des de %s horitzontal)</string>
|
||||
<string name="strs_move_down">mou (des de %s avall)</string>
|
||||
<string name="strs_tray_at_start">Faristol a l\'inici: %s</string>
|
||||
<string name="strss_traded_for">Ha canviat %s per %s.</string>
|
||||
<string formatted="false" name="strss_traded_for">Ha canviat %s per %s.</string>
|
||||
<string name="str_phony_rejected">Hi ha una o més paraules no vàlides a la jugada; torn perdut!</string>
|
||||
<string name="strd_cumulative_score">Puntuació acumulada: %d</string>
|
||||
<string name="strs_new_tiles">Fitxes noves: %s</string>
|
||||
|
@ -276,14 +276,15 @@
|
|||
<string name="vs">vs.</string>
|
||||
<string name="dictionary">Diccionari:</string>
|
||||
<string name="summary_fmt_listening">%s està escoltant</string>
|
||||
<string name="summary_fmt_relay">%s via repetidor, sala \"%s\"</string>
|
||||
<string name="summary_fmt_sms">%s via SMS, s\'està marcant %s</string>
|
||||
<string formatted="false" name="summary_fmt_relay">%s via
|
||||
repetidor, sala \"%s\"</string>
|
||||
<string formatted="false" name="summary_fmt_sms">%s via SMS, s\'està marcant %s</string>
|
||||
<string name="gameOver">Final de partida</string>
|
||||
<string name="movesf">%d torns jugats</string>
|
||||
|
||||
<!-- about dialog stuff -->
|
||||
<string name="about_versf">Crosswords per a l\'Android, Versió %s,
|
||||
rev %s.</string>
|
||||
<string formatted="false" name="about_versf">Crosswords per a
|
||||
l\'Android, Versió %s, rev %s.</string>
|
||||
<string name="about_copyright">Copyright (C) 1998-2011 d\'Eric
|
||||
House. Aquest programari es troba sota la Llicència Pública General GNU.</string>
|
||||
|
||||
|
|
|
@ -105,12 +105,12 @@
|
|||
<string name="strs_move_across">tah (od %s napříč)</string>
|
||||
<string name="strs_move_down">tah (od %s dolů)</string>
|
||||
<string name="strs_tray_at_start">Zásobník při startu: %s</string>
|
||||
<string name="strss_traded_for">Vyměnil %s za %s.</string>
|
||||
<string formatted="false" name="strss_traded_for">Vyměnil %s za %s.</string>
|
||||
<string name="str_phony_rejected">Nepovolené slovo; tah ztracen!</string>
|
||||
<string name="strd_cumulative_score">Souhrnné skóre: %d</string>
|
||||
<string name="strs_new_tiles">Nové kameny: %s</string>
|
||||
<string name="str_passed">Prošel</string>
|
||||
<string name="strsd_summaryscored">%s:%d</string>
|
||||
<string formatted="false" name="strsd_summaryscored">%s:%d</string>
|
||||
<string name="str_lostturn">Tah byl ztracen</string>
|
||||
<string name="str_commit_confirm">Potvrdit tento tah?\n</string>
|
||||
<string name="str_local_name">%s</string>
|
||||
|
@ -253,13 +253,13 @@
|
|||
<string name="vs">proti</string>
|
||||
<string name="dictionary">Slovník:</string>
|
||||
<string name="summary_fmt_listening">%s listening</string>
|
||||
<string name="summary_fmt_relay">%s přes Relay, místnost \"%s\"</string>
|
||||
<string name="summary_fmt_sms">%s přes SMS, dialing %s</string>
|
||||
<string formatted="false" name="summary_fmt_relay">%s přes Relay, místnost \"%s\"</string>
|
||||
<string formatted="false" name="summary_fmt_sms">%s přes SMS, dialing %s</string>
|
||||
<string name="gameOver">Hra skončena</string>
|
||||
<string name="movesf">Bylo zahráno %d tahů</string>
|
||||
|
||||
<!-- about dialog stuff -->
|
||||
<string name="about_versf">Crosswords pro Android, Verze %s,
|
||||
<string formatted="false" name="about_versf">Crosswords pro Android, Verze %s,
|
||||
revize %s.</string>
|
||||
<string name="about_copyright">Copyright (C) 1998-2011 Eric
|
||||
House. Tento software je vydán pod licencí GNU Public License.</string>
|
||||
|
|
|
@ -104,12 +104,12 @@
|
|||
<string name="strs_move_across">ťah (od %s naprieč)</string>
|
||||
<string name="strs_move_down">ťah (od %s dolu)</string>
|
||||
<string name="strs_tray_at_start">Zásobník pri štarte: %s</string>
|
||||
<string name="strss_traded_for">Vymenil %s za %s.</string>
|
||||
<string formatted="false" name="strss_traded_for">Vymenil %s za %s.</string>
|
||||
<string name="str_phony_rejected">Nepovolené slovo; ťah stratený!</string>
|
||||
<string name="strd_cumulative_score">Celkové skóre: %d</string>
|
||||
<string name="strs_new_tiles">Nové kamene: %s</string>
|
||||
<string name="str_passed">Prešiel</string>
|
||||
<string name="strsd_summaryscored">%s:%d</string>
|
||||
<string formatted="false" name="strsd_summaryscored">%s:%d</string>
|
||||
<string name="str_lostturn">Ťah bol stratený</string>
|
||||
<string name="str_commit_confirm">Potvrdiť tento ťah?\n</string>
|
||||
<string name="str_local_name">%s</string>
|
||||
|
@ -251,13 +251,13 @@
|
|||
<string name="vs">proti</string>
|
||||
<string name="dictionary">Slovník:</string>
|
||||
<string name="summary_fmt_listening">%s listening</string>
|
||||
<string name="summary_fmt_relay">%s cez Relay, miestnosť \"%s\"</string>
|
||||
<string name="summary_fmt_sms">%s cez SMS, dialing %s</string>
|
||||
<string formatted="false" name="summary_fmt_relay">%s cez Relay, miestnosť \"%s\"</string>
|
||||
<string formatted="false" name="summary_fmt_sms">%s cez SMS, dialing %s</string>
|
||||
<string name="gameOver">Hra skončená</string>
|
||||
<string name="movesf">Bolo zahraných %d ťahov</string>
|
||||
|
||||
<!-- about dialog stuff -->
|
||||
<string name="about_versf">Crosswords pre Android, Verzia %s,
|
||||
<string formatted="false" name="about_versf">Crosswords pre Android, Verzia %s,
|
||||
revize %s.</string>
|
||||
<string name="about_copyright">Copyright (C) 1998-2011 Eric
|
||||
House. Tento software je vydaný pod licenciou GNU Public License.</string>
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
</string-array>
|
||||
|
||||
<string-array name="language_names">
|
||||
<item>Unknown</item>
|
||||
<item></item> <!-- Unknown -->
|
||||
<item>English</item>
|
||||
<item>French</item>
|
||||
<item>German</item>
|
||||
|
@ -128,9 +128,9 @@
|
|||
<item>Dutch</item>
|
||||
<item>Catalan</item>
|
||||
<item>Portuguese</item>
|
||||
<item>E</item>
|
||||
<item></item> <!-- E -->
|
||||
<item>Russian</item>
|
||||
<item>10</item>
|
||||
<item></item> <!-- 10 -->
|
||||
<item>Czech</item>
|
||||
<item>Greek</item>
|
||||
<item>Slovak</item>
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<string name="menu_delete">Delete</string>
|
||||
<string name="button_new_game">Add game</string>
|
||||
<!-- <string name="button_new_game_net">Add multi-device game</string> -->
|
||||
|
||||
<string name="list_item_play">Play game</string>
|
||||
<string name="list_item_config">Game settings...</string>
|
||||
<string name="list_item_hide">Hide</string>
|
||||
<string name="list_item_delete">Delete</string>
|
||||
|
@ -33,12 +30,9 @@
|
|||
<string name="list_item_move_to_bottom">Move to bottom</string>
|
||||
|
||||
<string name="resolve_edit">Edit note</string>
|
||||
<string name="resolve_title">Edit title</string>
|
||||
|
||||
<string name="play">Play game</string>
|
||||
|
||||
<string name="title_create">Create game</string>
|
||||
<string name="title_edit">Edit game</string>
|
||||
<string name="title_games_list">Crosswords</string>
|
||||
<string name="title_dicts_list">Dictionaries (wordcount)</string>
|
||||
<string name="title_newgame">New game</string>
|
||||
|
@ -66,13 +60,9 @@
|
|||
<string name="button_retry">Retry</string>
|
||||
|
||||
<string name="player_label">Name:</string>
|
||||
<string name="game_config_open">Open</string>
|
||||
<string name="game_config_revert">Revert changes</string>
|
||||
|
||||
<string name="error_title">Error</string>
|
||||
<string name="info_title">FYI...</string>
|
||||
<string name="newbie_title">New user info</string>
|
||||
<string name="error_message">Error loading game</string>
|
||||
<string name="query_title">A question...</string>
|
||||
<string name="query_trade">Are you sure you want to exchange the selected tiles?</string>
|
||||
|
||||
|
@ -85,14 +75,10 @@
|
|||
|
||||
<!-- system menu for main board view -->
|
||||
<string name="board_menu_done">Turn done</string>
|
||||
<string name="board_menu_juggle">Shuffle</string>
|
||||
<string name="board_menu_flip">Flip</string>
|
||||
<string name="board_menu_trade">Exchange tiles</string>
|
||||
<string name="board_menu_trade_commit">Exchange done</string>
|
||||
<string name="board_menu_trade_cancel">Cancel exchange</string>
|
||||
<string name="board_menu_tray">Hide rack</string>
|
||||
<string name="board_submenu_undo">Undo</string>
|
||||
<string name="board_menu_undo_current">Undo current</string>
|
||||
<string name="board_menu_undo_last">Undo last</string>
|
||||
<string name="board_menu_values">Show values</string>
|
||||
<string name="board_submenu_game">Game</string>
|
||||
|
@ -101,8 +87,6 @@
|
|||
<string name="board_menu_game_history">Game history</string>
|
||||
<string name="board_menu_game_final">Final scores</string>
|
||||
<string name="board_menu_game_resend">Resend messages</string>
|
||||
<string name="board_submenu_file">File</string>
|
||||
<string name="board_menu_file_new">New game</string>
|
||||
<string name="board_menu_file_about">About Crosswords</string>
|
||||
|
||||
<string name="gamel_menu_delete_all">Delete all</string>
|
||||
|
@ -120,18 +104,18 @@
|
|||
<string name="strs_move_across">move (from %s across)\n</string>
|
||||
<string name="strs_move_down">move (from %s down)\n</string>
|
||||
<string name="strs_tray_at_start">Rack at start: %s\n</string>
|
||||
<string name="strss_traded_for">Exchanged %s for %s.</string>
|
||||
<string name="strss_traded_for">Exchanged %1$s for %2$s.</string>
|
||||
<string name="str_phony_rejected">Illegal word in move; turn lost!</string>
|
||||
<string name="strd_cumulative_score">Cumulative score: %d\n</string>
|
||||
<string name="strs_new_tiles">New tiles: %s</string>
|
||||
<string name="str_passed">Passed</string>
|
||||
<string name="strsd_summaryscored">%s:%d</string>
|
||||
<string formatted="false" name="strsd_summaryscored">%s:%d</string>
|
||||
<string name="strd_traded">Traded %d</string>
|
||||
<string name="str_lostturn">Lost turn</string>
|
||||
<string name="str_commit_confirm">Commit the current move?\n</string>
|
||||
<string name="str_local_name">%s</string>
|
||||
<string name="str_nonlocal_name">%s (remote)</string>
|
||||
<string name="str_game_namef">%s (%s)</string>
|
||||
<string formatted="false" name="str_game_namef">%s (%s)</string>
|
||||
<string name="str_bonus_all">Bonus for using all tiles: 50\n</string>
|
||||
<string name="strd_turn_score">Score for turn: %d\n</string>
|
||||
|
||||
|
@ -161,23 +145,16 @@
|
|||
<string name="player_edit_title">Edit player</string>
|
||||
|
||||
<string name="players_label_standalone">Players</string>
|
||||
<string name="players_label_host">Players (%d local, %d off-device)</string>
|
||||
<string name="players_label_guest">Players -- local only</string>
|
||||
<string formatted="false" name="players_label_host">Players (%d local, %d off-device)</string>
|
||||
<string name="game_locked">Lock settings</string>
|
||||
<string name="button_add_player">Add player</string>
|
||||
<string name="button_juggle_players">Shuffle players</string>
|
||||
|
||||
<string name="list_item_up">Up one</string>
|
||||
<string name="list_item_down">Down one</string>
|
||||
<string name="dicts_item_select_human">Make default (human)</string>
|
||||
<string name="dicts_item_select_robot">Make default (robot)</string>
|
||||
<string name="dicts_item_delete">Delete dictionary</string>
|
||||
<string name="dicts_item_details">Details</string>
|
||||
|
||||
<string name="dict_label">Dictionary</string>
|
||||
<string name="dict_lang_labelf">Dictionary (in %s)</string>
|
||||
<string name="role_label">Device role</string>
|
||||
<string name="connection_label">Connection</string>
|
||||
<string name="connect_label">Connection (via internet)</string>
|
||||
<string name="room_public">Make new room public</string>
|
||||
<string name="join_room">Join public room</string>
|
||||
|
@ -268,13 +245,6 @@
|
|||
<string name="confirm_revert_all">Are you sure you want to restore
|
||||
all preferences to their default values?</string>
|
||||
|
||||
<string name="room_label">Room</string>
|
||||
<string name="phone_label">Host phone number</string>
|
||||
<string name="bluetooth_label">Bluetooth support coming soon....</string>
|
||||
<string name="role_edit_title">Connection</string>
|
||||
<string name="connect_prompt">How will Host and Guest devices
|
||||
communicate?</string>
|
||||
|
||||
<string name="prefs_defaults">New game defaults</string>
|
||||
<string name="prefs_defaults_summary">Default settings for new
|
||||
games</string>
|
||||
|
@ -295,9 +265,6 @@
|
|||
<string name="phonies_spinner_prompt">How to handle \"phonies\"
|
||||
(words not in dictionary)</string>
|
||||
<string name="board_size">Board size</string>
|
||||
<string name="default_timerenabled">Use game timer</string>
|
||||
|
||||
<string name="manage_dicts">Choose</string>
|
||||
|
||||
<string name="prefs_colors">Individual colors</string>
|
||||
<string name="prefs_colors_summary">Edit colors used on the board</string>
|
||||
|
@ -327,22 +294,17 @@
|
|||
<string name="logging_on">Enable logging</string>
|
||||
<string name="relay_port">Relay game port</string>
|
||||
<string name="proxy_port">Relay device port</string>
|
||||
<string name="sms_port">SMS port</string>
|
||||
|
||||
<string name="sms_phone_label">sms_phone_label</string>
|
||||
<string name="sms_port_label">sms_port_label</string>
|
||||
<string name="bt_label">bt_label</string>
|
||||
<string name="list_item_view">list_item_view</string>
|
||||
<string name="key_player">key_player</string>
|
||||
<string name="tab_relay">Internet/Relay</string>
|
||||
<string name="tab_sms">SMS (broken)</string>
|
||||
<string name="tab_bluetooth">Bluetooth (pending)</string>
|
||||
|
||||
<string name="msg_relay_waiting">Device %d connected to relay in
|
||||
room \"%s\". Waiting for %d player[s].</string>
|
||||
<string formatted="false" name="msg_relay_waiting">Device %d
|
||||
connected to relay in room \"%s\". Waiting for %d
|
||||
player[s].</string>
|
||||
<string name="msg_relay_all_heref">All players are here in room
|
||||
\"%s\".</string>
|
||||
<string name="title_relay_status">Connection status.</string>
|
||||
|
||||
<string name="relay_alert">Connection problem</string>
|
||||
<string name="msg_too_many">You are providing more players than the host expects.</string>
|
||||
|
@ -365,20 +327,14 @@
|
|||
<string name="force_expl">In a multi-device game there must be at
|
||||
least one player from and another not from this device. Please
|
||||
check off-device players.</string>
|
||||
<string name="added_player">Player added to meet two-player
|
||||
minimum for multi-device games.</string>
|
||||
<string name="forced_consistent">Modified first player.</string>
|
||||
|
||||
<string name="vs">vs.</string>
|
||||
<string name="dictionary">Dictionary:</string>
|
||||
<string name="summary_fmt_listening">%s listening</string>
|
||||
<string name="summary_fmt_relay">Connecting via Relay, room \"%s\"</string>
|
||||
<string name="summary_fmt_sms">%s via SMS, dialing %s</string>
|
||||
<string name="gameOver">Game over</string>
|
||||
<string name="movesf">%d moves played</string>
|
||||
|
||||
<!-- about dialog stuff -->
|
||||
<string name="about_versf">Crosswords for Android, Version %s,
|
||||
<string formatted="false" name="about_versf">Crosswords for Android, Version %s,
|
||||
rev %s.</string>
|
||||
<string name="about_copyright">Copyright (C) 1998-2011 by Eric
|
||||
House. This free/open source software is released under the GNU Public
|
||||
|
@ -402,7 +358,7 @@
|
|||
|
||||
<string name="no_dictf">Unable to open game because no %s
|
||||
dictionary found.</string>
|
||||
<string name="no_dict_substf">Unable to open game because
|
||||
<string formatted="false" name="no_dict_substf">Unable to open game because
|
||||
dictionary %s not found. You can download a replacement or
|
||||
substitute another %s dictionary.</string>
|
||||
|
||||
|
@ -434,10 +390,11 @@
|
|||
<string name="notify_vibrate">Vibrate</string>
|
||||
<string name="notify_other_summary">When opponent moves arrive</string>
|
||||
|
||||
<string name="public_names_progress">Fetching public rooms for
|
||||
<string formatted="false" name="public_names_progress">Fetching public rooms for
|
||||
%d-player games in %s.</string>
|
||||
<string name="no_name_found_f">No public rooms found for %d-player
|
||||
games in %s. Try refreshing or creating your own.</string>
|
||||
<string formatted="false" name="no_name_found_f">No public rooms
|
||||
found for %d-player games in %s. Try refreshing or creating your
|
||||
own.</string>
|
||||
|
||||
<string name="chat_local_id">Me: </string>
|
||||
<string name="chat_other_id">Not me: </string>
|
||||
|
@ -473,11 +430,6 @@
|
|||
messaging between devices in this game. Messages will be kept
|
||||
until you delete the game that contains them.</string>
|
||||
|
||||
<string name="not_again_relay">Multi-device games work through an
|
||||
internet relay that connects devices in \"rooms\". To play
|
||||
against a friend, make sure you both specify the same room name.
|
||||
Or try joining or creating a public room.</string>
|
||||
|
||||
<string name="not_again_newgame">The new game you have created has
|
||||
two players. Player 1 is a robot; Player 2 is you. Tap the game
|
||||
to play; long-tap (hold your finger on the game) to change its
|
||||
|
|
|
@ -83,7 +83,7 @@ public class DictLangCache {
|
|||
|
||||
public static String getLangName( Context context, int code )
|
||||
{
|
||||
String[] namesArray = getNamesArray( context );
|
||||
String[] namesArray = getLangNames( context );
|
||||
if ( code < 0 || code >= namesArray.length ) {
|
||||
code = 0;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public class DictLangCache {
|
|||
public static int getLangLangCode( Context context, String lang )
|
||||
{
|
||||
int code = 0;
|
||||
String[] namesArray = getNamesArray( context );
|
||||
String[] namesArray = getLangNames( context );
|
||||
for ( int ii = 0; ii < namesArray.length; ++ii ) {
|
||||
if ( namesArray[ii].equals( lang ) ) {
|
||||
code = ii;
|
||||
|
@ -224,7 +224,7 @@ public class DictLangCache {
|
|||
}
|
||||
}
|
||||
|
||||
private static String[] listLangs( Context context )
|
||||
public static String[] listLangs( Context context )
|
||||
{
|
||||
return listLangs( context, GameUtils.dictList( context ) );
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ public class DictLangCache {
|
|||
return m_dictsAdapter;
|
||||
}
|
||||
|
||||
private static String[] getNamesArray( Context context )
|
||||
public static String[] getLangNames( Context context )
|
||||
{
|
||||
if ( null == s_langNames ) {
|
||||
Resources res = context.getResources();
|
||||
|
|
|
@ -24,6 +24,8 @@ import android.app.Activity;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ListActivity;
|
||||
import android.app.ExpandableListActivity;
|
||||
import android.database.DataSetObserver;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
@ -39,6 +41,9 @@ import android.view.MenuItem;
|
|||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.widget.ExpandableListAdapter;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.net.Uri;
|
||||
import junit.framework.Assert;
|
||||
|
@ -47,52 +52,149 @@ import org.eehouse.android.xw4.jni.XwJNI;
|
|||
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
|
||||
import org.eehouse.android.xw4.jni.CommonPrefs;
|
||||
|
||||
public class DictsActivity extends XWListActivity
|
||||
implements View.OnClickListener,
|
||||
XWListItem.DeleteCallback {
|
||||
public class DictsActivity extends ExpandableListActivity
|
||||
implements View.OnClickListener, XWListItem.DeleteCallback {
|
||||
|
||||
private static final String DICT_DOLAUNCH = "do_launch";
|
||||
private static final String DICT_LANG_EXTRA = "use_lang";
|
||||
private static final String DICT_NAME_EXTRA = "use_dict";
|
||||
|
||||
private String[] m_dicts;
|
||||
private static final int PICK_STORAGE = DlgDelegate.DIALOG_LAST + 1;
|
||||
private int m_lang = 0;
|
||||
private String[] m_langs;
|
||||
private String m_name = null;
|
||||
private String m_download;
|
||||
private ExpandableListView m_expView;
|
||||
|
||||
private class DictListAdapter extends XWListAdapter {
|
||||
private DlgDelegate m_delegate;
|
||||
LayoutInflater m_factory;
|
||||
|
||||
private class DictListAdapter implements ExpandableListAdapter {
|
||||
private Context m_context;
|
||||
|
||||
public DictListAdapter( Context context ) {
|
||||
super( context, m_dicts.length );
|
||||
//super( context, m_dicts.length );
|
||||
m_context = context;
|
||||
}
|
||||
|
||||
public Object getItem( int position) { return m_dicts[position]; }
|
||||
public View getView( final int position, View convertView,
|
||||
ViewGroup parent ) {
|
||||
LayoutInflater factory = LayoutInflater.from( DictsActivity.this );
|
||||
final XWListItem view
|
||||
= (XWListItem)factory.inflate( R.layout.list_item, null );
|
||||
view.setPosition( position );
|
||||
public boolean areAllItemsEnabled() { return false; }
|
||||
|
||||
// append language name
|
||||
view.setText( DictLangCache.
|
||||
annotatedDictName( DictsActivity.this,
|
||||
m_dicts[position] ) );
|
||||
if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
||||
m_dicts[position] ) ) {
|
||||
public Object getChild(int groupPosition, int childPosition)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getChildId( int groupPosition, int childPosition )
|
||||
{
|
||||
return childPosition;
|
||||
}
|
||||
|
||||
public View getChildView( int groupPosition, int childPosition,
|
||||
boolean isLastChild, View convertView,
|
||||
ViewGroup parent)
|
||||
{
|
||||
int lang = (int)getGroupId( groupPosition );
|
||||
String[] dicts = DictLangCache.getHaveLang( m_context, lang );
|
||||
String text;
|
||||
boolean canDelete = false;
|
||||
if ( null != dicts && childPosition < dicts.length ) {
|
||||
text = dicts[childPosition];
|
||||
canDelete = !GameUtils.dictIsBuiltin( DictsActivity.this,
|
||||
text );
|
||||
} else {
|
||||
text = m_download;
|
||||
}
|
||||
XWListItem view =
|
||||
(XWListItem)m_factory.inflate( R.layout.list_item, null );
|
||||
view.setText( text );
|
||||
if ( canDelete ) {
|
||||
view.setDeleteCallback( DictsActivity.this );
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public int getChildrenCount( int groupPosition )
|
||||
{
|
||||
int lang = (int)getGroupId( groupPosition );
|
||||
String[] dicts = DictLangCache.getHaveLang( m_context, lang );
|
||||
int result = 0; // 1; // 1 for the download option
|
||||
if ( null != dicts ) {
|
||||
result += dicts.length;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public long getCombinedChildId( long groupId, long childId )
|
||||
{
|
||||
return groupId << 16 | childId;
|
||||
}
|
||||
|
||||
public long getCombinedGroupId( long groupId )
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public Object getGroup( int groupPosition )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getGroupCount()
|
||||
{
|
||||
return m_langs.length;
|
||||
}
|
||||
|
||||
public long getGroupId( int groupPosition )
|
||||
{
|
||||
int lang = DictLangCache.getLangLangCode( m_context,
|
||||
m_langs[groupPosition] );
|
||||
return lang;
|
||||
}
|
||||
|
||||
public View getGroupView( int groupPosition, boolean isExpanded,
|
||||
View convertView, ViewGroup parent )
|
||||
{
|
||||
View row = LayoutInflater.from(DictsActivity.this).
|
||||
inflate(android.R.layout.simple_expandable_list_item_1, null );
|
||||
TextView view = (TextView)row.findViewById( android.R.id.text1 );
|
||||
view.setText( m_langs[groupPosition] );
|
||||
return view;
|
||||
}
|
||||
|
||||
public boolean hasStableIds() { return false; }
|
||||
public boolean isChildSelectable( int groupPosition, int childPosition ) { return true; }
|
||||
public boolean isEmpty() { return false; }
|
||||
public void onGroupCollapsed(int groupPosition){}
|
||||
public void onGroupExpanded(int groupPosition){}
|
||||
public void registerDataSetObserver( DataSetObserver obs ){}
|
||||
public void unregisterDataSetObserver( DataSetObserver obs ){}
|
||||
|
||||
// public Object getItem( int position) { return m_dicts[position]; }
|
||||
// public View getView( final int position, View convertView,
|
||||
// ViewGroup parent ) {
|
||||
// LayoutInflater factory = LayoutInflater.from( DictsActivity.this );
|
||||
// final XWListItem view
|
||||
// = (XWListItem)factory.inflate( R.layout.list_item, null );
|
||||
// view.setPosition( position );
|
||||
|
||||
// // append language name
|
||||
// view.setText( DictLangCache.
|
||||
// annotatedDictName( DictsActivity.this,
|
||||
// m_dicts[position] ) );
|
||||
// if ( !GameUtils.dictIsBuiltin( DictsActivity.this,
|
||||
// m_dicts[position] ) ) {
|
||||
// view.setDeleteCallback( DictsActivity.this );
|
||||
// }
|
||||
|
||||
// return view;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
Dialog dialog;
|
||||
switch( id ) {
|
||||
case PICK_STORAGE:
|
||||
DialogInterface.OnClickListener lstnrSD;
|
||||
|
@ -111,24 +213,40 @@ public class DictsActivity extends XWListActivity
|
|||
.setNegativeButton( R.string.button_sd, lstnrSD )
|
||||
.create();
|
||||
break;
|
||||
default:
|
||||
dialog = m_delegate.onCreateDialog( id );
|
||||
break;
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
public void onPrepareDialog( int id, Dialog dialog )
|
||||
{
|
||||
m_delegate.onPrepareDialog( id, dialog );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
m_delegate = new DlgDelegate( this );
|
||||
m_factory = LayoutInflater.from( this );
|
||||
|
||||
m_download = getString( R.string.download_dicts );
|
||||
|
||||
setContentView( R.layout.dict_browse );
|
||||
registerForContextMenu( getListView() );
|
||||
m_expView = getExpandableListView();
|
||||
registerForContextMenu( m_expView );
|
||||
|
||||
Button download = (Button)findViewById( R.id.download );
|
||||
download.setOnClickListener( this );
|
||||
|
||||
mkListAdapter();
|
||||
|
||||
showNotAgainDlg( R.string.not_again_dicts,
|
||||
R.string.key_notagain_dicts );
|
||||
// showNotAgainDlg( R.string.not_again_dicts,
|
||||
// R.string.key_notagain_dicts );
|
||||
|
||||
Intent intent = getIntent();
|
||||
if ( null != intent ) {
|
||||
|
@ -146,6 +264,7 @@ public class DictsActivity extends XWListActivity
|
|||
{
|
||||
super.onResume();
|
||||
mkListAdapter();
|
||||
expandGroups();
|
||||
}
|
||||
|
||||
public void onClick( View v )
|
||||
|
@ -159,33 +278,44 @@ public class DictsActivity extends XWListActivity
|
|||
{
|
||||
super.onCreateContextMenu( menu, view, menuInfo );
|
||||
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate( R.menu.dicts_item_menu, menu );
|
||||
ExpandableListView.ExpandableListContextMenuInfo info
|
||||
= (ExpandableListView.ExpandableListContextMenuInfo)menuInfo;
|
||||
long packedPosition = info.packedPosition;
|
||||
int childPosition = ExpandableListView.
|
||||
getPackedPositionChild( packedPosition );
|
||||
// int groupPosition = ExpandableListView.
|
||||
// getPackedPositionGroup( packedPosition );
|
||||
// Utils.logf( "onCreateContextMenu: group: %d; child: %d",
|
||||
// groupPosition, childPosition );
|
||||
|
||||
AdapterView.AdapterContextMenuInfo info
|
||||
= (AdapterView.AdapterContextMenuInfo)menuInfo;
|
||||
// We don't have a menu yet for languages, just for their dict
|
||||
// children
|
||||
if ( childPosition >= 0 ) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate( R.menu.dicts_item_menu, menu );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected( MenuItem item )
|
||||
{
|
||||
boolean handled = false;
|
||||
AdapterView.AdapterContextMenuInfo info;
|
||||
ExpandableListContextMenuInfo info = null;
|
||||
try {
|
||||
info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
|
||||
info = (ExpandableListContextMenuInfo)item.getMenuInfo();
|
||||
} catch (ClassCastException e) {
|
||||
Utils.logf( "bad menuInfo:" + e.toString() );
|
||||
return false;
|
||||
}
|
||||
|
||||
XWListItem row = (XWListItem)info.targetView;
|
||||
int id = item.getItemId();
|
||||
int position = info.position;
|
||||
switch( id ) {
|
||||
case R.id.dicts_item_select_human:
|
||||
setDefault( R.string.key_default_dict, position );
|
||||
setDefault( R.string.key_default_dict, row );
|
||||
break;
|
||||
case R.id.dicts_item_select_robot:
|
||||
setDefault( R.string.key_default_robodict, position );
|
||||
setDefault( R.string.key_default_robodict, row );
|
||||
break;
|
||||
case R.id.dicts_item_details:
|
||||
Utils.notImpl( this );
|
||||
|
@ -195,22 +325,23 @@ public class DictsActivity extends XWListActivity
|
|||
return handled;
|
||||
}
|
||||
|
||||
private void setDefault( int keyId, int position )
|
||||
private void setDefault( int keyId, final XWListItem text )
|
||||
{
|
||||
SharedPreferences sp
|
||||
= PreferenceManager.getDefaultSharedPreferences( this );
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
String key = getString( keyId );
|
||||
editor.putString( key, m_dicts[position] );
|
||||
String name = text.getText();
|
||||
editor.putString( key, name );
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
// DeleteCallback interface
|
||||
public void deleteCalled( final int myPosition )
|
||||
public void deleteCalled( int myPosition, final String dict )
|
||||
{
|
||||
final String dict = m_dicts[myPosition];
|
||||
int lang = DictLangCache.getDictLangCode( this, dict );
|
||||
int nGames = DBUtils.countGamesUsing( this, lang );
|
||||
int code = DictLangCache.getDictLangCode( this, dict );
|
||||
String lang = DictLangCache.getLangName( this, code );
|
||||
int nGames = DBUtils.countGamesUsing( this, code );
|
||||
String msg = String.format( getString( R.string.confirm_delete_dictf ),
|
||||
dict );
|
||||
DialogInterface.OnClickListener action =
|
||||
|
@ -222,16 +353,15 @@ public class DictsActivity extends XWListActivity
|
|||
|
||||
if ( nGames > 0 ) {
|
||||
int fmt;
|
||||
if ( 1 == DictLangCache.getHaveLang( this, lang ).length ) {
|
||||
if ( 1 == DictLangCache.getHaveLang( this, code ).length ) {
|
||||
fmt = R.string.confirm_deleteonly_dictf;
|
||||
} else {
|
||||
fmt = R.string.confirm_deletemore_dictf;
|
||||
}
|
||||
String langName = DictLangCache.getLangName( this, lang );
|
||||
msg += String.format( getString(fmt), langName );
|
||||
msg += String.format( getString(fmt), lang );
|
||||
}
|
||||
|
||||
showConfirmThen( msg, action );
|
||||
m_delegate.showConfirmThen( msg, action );
|
||||
}
|
||||
|
||||
private void deleteDict( String dict )
|
||||
|
@ -260,8 +390,17 @@ public class DictsActivity extends XWListActivity
|
|||
|
||||
private void mkListAdapter()
|
||||
{
|
||||
m_dicts = GameUtils.dictList( this );
|
||||
setListAdapter( new DictListAdapter( this ) );
|
||||
m_langs = DictLangCache.listLangs( this );
|
||||
//m_langs = DictLangCache.getLangNames( this );
|
||||
ExpandableListAdapter adapter = new DictListAdapter( this );
|
||||
setListAdapter( adapter );
|
||||
}
|
||||
|
||||
private void expandGroups()
|
||||
{
|
||||
for ( int ii = 0; ii < m_langs.length; ++ii ) {
|
||||
m_expView.expandGroup( ii );
|
||||
}
|
||||
}
|
||||
|
||||
private static Intent mkDownloadIntent( Context context,
|
||||
|
|
|
@ -395,10 +395,7 @@ public class GameConfig extends XWActivity
|
|||
m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner );
|
||||
m_smartnessSpinner = (Spinner)findViewById( R.id.smart_robot );
|
||||
|
||||
String fmt = getString( m_notNetworkedGame ?
|
||||
R.string.title_game_configf
|
||||
: R.string.title_gamenet_configf );
|
||||
setTitle( String.format( fmt, GameUtils.gameName( this, m_path ) ) );
|
||||
setTitle();
|
||||
} // onCreate
|
||||
|
||||
@Override
|
||||
|
@ -414,7 +411,6 @@ public class GameConfig extends XWActivity
|
|||
GameUtils.loadMakeGame( this, gamePtr, m_giOrig, m_gameLock );
|
||||
m_gameStarted = XwJNI.model_getNMoves( gamePtr ) > 0
|
||||
|| XwJNI.comms_isConnected( gamePtr );
|
||||
m_giOrig.setInProgress( m_gameStarted );
|
||||
|
||||
if ( m_gameStarted ) {
|
||||
if ( null == m_gameLockedCheck ) {
|
||||
|
@ -442,6 +438,7 @@ public class GameConfig extends XWActivity
|
|||
m_car = new CommsAddrRec( m_carOrig );
|
||||
|
||||
m_notNetworkedGame = DeviceRole.SERVER_STANDALONE == m_gi.serverRole;
|
||||
setTitle();
|
||||
|
||||
if ( !m_notNetworkedGame ) {
|
||||
m_joinPublicCheck =
|
||||
|
@ -501,7 +498,7 @@ public class GameConfig extends XWActivity
|
|||
}
|
||||
|
||||
// DeleteCallback interface
|
||||
public void deleteCalled( int myPosition )
|
||||
public void deleteCalled( int myPosition, final String name )
|
||||
{
|
||||
if ( m_gi.delete( myPosition ) ) {
|
||||
loadPlayers();
|
||||
|
@ -973,8 +970,18 @@ public class GameConfig extends XWActivity
|
|||
|
||||
private void refreshNames()
|
||||
{
|
||||
new RefreshNamesTask( this, this, m_gi.dictLang,
|
||||
m_gi.nPlayers, m_roomChoose ).execute();
|
||||
if ( !m_isLocked ) {
|
||||
new RefreshNamesTask( this, this, m_gi.dictLang,
|
||||
m_gi.nPlayers, m_roomChoose ).execute();
|
||||
}
|
||||
}
|
||||
|
||||
private void setTitle()
|
||||
{
|
||||
String fmt = getString( m_notNetworkedGame ?
|
||||
R.string.title_game_configf
|
||||
: R.string.title_gamenet_configf );
|
||||
setTitle( String.format( fmt, GameUtils.gameName( this, m_path ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -189,8 +189,6 @@ public class GameUtils {
|
|||
}
|
||||
XwJNI.game_dispose( gamePtr );
|
||||
|
||||
gi.setInProgress( false );
|
||||
|
||||
gamePtr = XwJNI.initJNI();
|
||||
XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(),
|
||||
CommonPrefs.get( context ), dictBytes,
|
||||
|
@ -783,7 +781,6 @@ public class GameUtils {
|
|||
}
|
||||
|
||||
if ( forceNew || !madeGame ) {
|
||||
gi.setInProgress( false );
|
||||
XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(),
|
||||
cp, dictBytes, dictNames, langName );
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class XWListItem extends LinearLayout {
|
|||
DeleteCallback m_cb;
|
||||
|
||||
public interface DeleteCallback {
|
||||
void deleteCalled( int myPosition );
|
||||
void deleteCalled( int myPosition, String name );
|
||||
}
|
||||
|
||||
public XWListItem( Context cx, AttributeSet as ) {
|
||||
|
@ -51,6 +51,12 @@ public class XWListItem extends LinearLayout {
|
|||
view.setText( text );
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
TextView view = (TextView)getChildAt( 0 );
|
||||
return view.getText().toString();
|
||||
}
|
||||
|
||||
public void setDeleteCallback( DeleteCallback cb )
|
||||
{
|
||||
m_cb = cb;
|
||||
|
@ -58,7 +64,7 @@ public class XWListItem extends LinearLayout {
|
|||
button.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View view ) {
|
||||
m_cb.deleteCalled( m_position );
|
||||
m_cb.deleteCalled( m_position, getText() );
|
||||
}
|
||||
} );
|
||||
button.setVisibility( View.VISIBLE );
|
||||
|
|
|
@ -56,7 +56,6 @@ public class CurGameInfo {
|
|||
|
||||
// private int[] m_visiblePlayers;
|
||||
// private int m_nVisiblePlayers;
|
||||
private boolean m_inProgress;
|
||||
private int m_smartness;
|
||||
private Context m_context;
|
||||
|
||||
|
@ -67,7 +66,6 @@ public class CurGameInfo {
|
|||
|
||||
public CurGameInfo( Context context, boolean isNetworked )
|
||||
{
|
||||
m_inProgress = false;
|
||||
m_context = context;
|
||||
nPlayers = 2;
|
||||
gameSeconds = 60 * nPlayers *
|
||||
|
@ -101,7 +99,6 @@ public class CurGameInfo {
|
|||
public CurGameInfo( Context context, CurGameInfo src )
|
||||
{
|
||||
m_context = context;
|
||||
m_inProgress = src.m_inProgress;
|
||||
gameID = src.gameID;
|
||||
nPlayers = src.nPlayers;
|
||||
gameSeconds = src.gameSeconds;
|
||||
|
@ -132,11 +129,6 @@ public class CurGameInfo {
|
|||
}
|
||||
}
|
||||
|
||||
public void setInProgress( boolean inProgress )
|
||||
{
|
||||
m_inProgress = inProgress;
|
||||
}
|
||||
|
||||
public void setLang( int lang )
|
||||
{
|
||||
if ( 0 == lang ) {
|
||||
|
|
57
xwords4/android/scripts/strings_check.sh
Executable file
57
xwords4/android/scripts/strings_check.sh
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -u -e
|
||||
|
||||
declare -A ENG_IDS
|
||||
LOCS=""
|
||||
SEARCH_SOURCE=""
|
||||
|
||||
ENG=~/dev/git/ANDROID_BRANCH/xwords4/android/XWords4/res/values/strings.xml
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 [--loc <path_to_strings.xml>]*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
list_ids() {
|
||||
XML_FILE=$1
|
||||
xmlstarlet sel -T -t -m "/resources/string" -v @name -o " " $XML_FILE
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--loc)
|
||||
[ $# -gt 1 ] || usage
|
||||
[ -e $2 ] || usage
|
||||
LOCS="$LOCS $2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# echo "checking $ENG for ids not in any .java file"
|
||||
for ID in $(list_ids $ENG); do
|
||||
ENG_IDS[$ID]=1
|
||||
done
|
||||
|
||||
if [ -n "$SEARCH_SOURCE" ]; then
|
||||
if grep -q R.string.$ID $(find . -name '*.java'); then
|
||||
:
|
||||
elif grep -q "@string/$ID" $(find . -name '*.xml'); then
|
||||
:
|
||||
else
|
||||
echo "$ID appears to be unused"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for LOC in $LOCS; do
|
||||
IDS="${!ENG_IDS[*]}"
|
||||
for ID in $IDS; do
|
||||
grep -q $ID $LOC || echo "$ID not found in $LOC"
|
||||
done
|
||||
done
|
Loading…
Reference in a new issue