mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
get translations working in dicts browser (save title)
This commit is contained in:
parent
67ca205774
commit
7f48783fb2
2 changed files with 30 additions and 18 deletions
|
@ -248,8 +248,8 @@ public class DictsDelegate extends DelegateBase
|
||||||
case MOVE_DICT:
|
case MOVE_DICT:
|
||||||
final XWListItem[] selItems = getSelItems();
|
final XWListItem[] selItems = getSelItems();
|
||||||
final int[] moveTo = { -1 };
|
final int[] moveTo = { -1 };
|
||||||
message = m_activity.getString( R.string.move_dict_fmt,
|
message = LocUtils.getString( m_activity, R.string.move_dict_fmt,
|
||||||
getJoinedNames( selItems ) );
|
getJoinedNames( selItems ) );
|
||||||
|
|
||||||
OnClickListener newSelLstnr =
|
OnClickListener newSelLstnr =
|
||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
|
@ -310,8 +310,9 @@ public class DictsDelegate extends DelegateBase
|
||||||
};
|
};
|
||||||
String name = row.getText();
|
String name = row.getText();
|
||||||
String lang = DictLangCache.getLangName( m_activity, name);
|
String lang = DictLangCache.getLangName( m_activity, name);
|
||||||
message = m_activity.getString( R.string.set_default_message_fmt,
|
message = LocUtils.getString( m_activity,
|
||||||
name, lang );
|
R.string.set_default_message_fmt,
|
||||||
|
name, lang );
|
||||||
dialog = new LocUtils.AlertBuilder( m_activity )
|
dialog = new LocUtils.AlertBuilder( m_activity )
|
||||||
.setTitle( R.string.query_title )
|
.setTitle( R.string.query_title )
|
||||||
.setMessage( message )
|
.setMessage( message )
|
||||||
|
@ -378,12 +379,11 @@ public class DictsDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Resources res = m_activity.getResources();
|
m_locNames = LocUtils.getStringArray( m_activity, R.array.loc_names );
|
||||||
m_locNames = res.getStringArray( R.array.loc_names );
|
|
||||||
|
|
||||||
m_downloadStr = m_activity.getString( R.string.download_dicts );
|
m_downloadStr = LocUtils.getString( m_activity, R.string.download_dicts );
|
||||||
|
|
||||||
m_activity.setContentView( R.layout.dict_browse );
|
setContentView( R.layout.dict_browse );
|
||||||
m_expView = m_activity.getExpandableListView();
|
m_expView = m_activity.getExpandableListView();
|
||||||
m_expView.setOnItemLongClickListener( this );
|
m_expView.setOnItemLongClickListener( this );
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ public class DictsDelegate extends DelegateBase
|
||||||
SharedPreferences sp
|
SharedPreferences sp
|
||||||
= PreferenceManager.getDefaultSharedPreferences( m_activity );
|
= PreferenceManager.getDefaultSharedPreferences( m_activity );
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
SharedPreferences.Editor editor = sp.edit();
|
||||||
String key = m_activity.getString( keyId );
|
String key = LocUtils.getString( m_activity, keyId );
|
||||||
String name = view.getText();
|
String name = view.getText();
|
||||||
editor.putString( key, name );
|
editor.putString( key, name );
|
||||||
editor.commit();
|
editor.commit();
|
||||||
|
@ -538,8 +538,9 @@ public class DictsDelegate extends DelegateBase
|
||||||
private void deleteSelected()
|
private void deleteSelected()
|
||||||
{
|
{
|
||||||
XWListItem[] items = getSelItems();
|
XWListItem[] items = getSelItems();
|
||||||
String msg = m_activity.getString( R.string.confirm_delete_dict_fmt,
|
String msg = LocUtils.getString( m_activity,
|
||||||
getJoinedNames( items ) );
|
R.string.confirm_delete_dict_fmt,
|
||||||
|
getJoinedNames( items ) );
|
||||||
|
|
||||||
// When and what to warn about. First off, if there's another
|
// When and what to warn about. First off, if there's another
|
||||||
// identical dict, simply confirm. Or if nobody's using this
|
// identical dict, simply confirm. Or if nobody's using this
|
||||||
|
@ -563,12 +564,14 @@ public class DictsDelegate extends DelegateBase
|
||||||
if ( 1 == langDals.length ) { // last in this language?
|
if ( 1 == langDals.length ) { // last in this language?
|
||||||
if ( 0 < nUsingLang ) {
|
if ( 0 < nUsingLang ) {
|
||||||
newMsg =
|
newMsg =
|
||||||
m_activity.getString( R.string.confirm_deleteonly_dict_fmt,
|
LocUtils.getString( m_activity, R.string
|
||||||
dict, langName );
|
.confirm_deleteonly_dict_fmt,
|
||||||
|
dict, langName );
|
||||||
}
|
}
|
||||||
} else if ( 0 < DBUtils.countGamesUsingDict( m_activity, dict ) ) {
|
} else if ( 0 < DBUtils.countGamesUsingDict( m_activity, dict ) ) {
|
||||||
newMsg = m_activity.getString( R.string.confirm_deletemore_dict_fmt,
|
newMsg = LocUtils.getString( m_activity, R.string.
|
||||||
langName );
|
confirm_deletemore_dict_fmt,
|
||||||
|
langName );
|
||||||
}
|
}
|
||||||
if ( null != newMsg ) {
|
if ( null != newMsg ) {
|
||||||
msg += "\n\n" + newMsg;
|
msg += "\n\n" + newMsg;
|
||||||
|
@ -717,8 +720,9 @@ public class DictsDelegate extends DelegateBase
|
||||||
{
|
{
|
||||||
int nSels = m_selDicts.size();
|
int nSels = m_selDicts.size();
|
||||||
if ( 0 < nSels ) {
|
if ( 0 < nSels ) {
|
||||||
m_activity.setTitle( LocUtils.getString( m_activity, R.string.sel_items_fmt,
|
m_activity.setTitle( LocUtils.getString( m_activity,
|
||||||
nSels ) );
|
R.string.sel_items_fmt,
|
||||||
|
nSels ) );
|
||||||
} else {
|
} else {
|
||||||
m_activity.setTitle( m_origTitle );
|
m_activity.setTitle( m_origTitle );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -31,9 +32,9 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -121,6 +122,13 @@ public class LocUtils {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] getStringArray( Context context, int resID )
|
||||||
|
{
|
||||||
|
Resources res = context.getResources();
|
||||||
|
String[] arr = res.getStringArray( resID );
|
||||||
|
return xlateStrings( context, arr );
|
||||||
|
}
|
||||||
|
|
||||||
public static String[] xlateStrings( Context context, String[] strs )
|
public static String[] xlateStrings( Context context, String[] strs )
|
||||||
{
|
{
|
||||||
String[] result = new String[strs.length];
|
String[] result = new String[strs.length];
|
||||||
|
|
Loading…
Add table
Reference in a new issue