treat nBytes as a long

This commit is contained in:
Eric House 2014-06-18 06:51:33 -07:00
parent b6d316134d
commit 44e2c988ad

View file

@ -96,9 +96,10 @@ public class DictsDelegate extends ListDelegateBase
public String m_name; public String m_name;
// public boolean m_needsUpdate; // public boolean m_needsUpdate;
public String m_lang; public String m_lang;
public int m_nWords, m_nBytes; public int m_nWords;
public long m_nBytes;
public String m_note; public String m_note;
public DictInfo( String name, String lang, int nWords, int nBytes ) { public DictInfo( String name, String lang, int nWords, long nBytes ) {
m_name = name; m_name = name;
m_lang = lang; m_lang = lang;
m_nWords = nWords; m_nWords = nWords;
@ -490,7 +491,7 @@ public class DictsDelegate extends ListDelegateBase
(DictLoc)obj ); (DictLoc)obj );
} else { } else {
DictInfo info = (DictInfo)obj; DictInfo info = (DictInfo)obj;
int kBytes = (info.m_nBytes + 999) / 1000; long kBytes = (info.m_nBytes + 999) / 1000;
String msg = getString( R.string.dict_info_fmt, info.m_name, String msg = getString( R.string.dict_info_fmt, info.m_name,
info.m_nWords, kBytes, info.m_note ); info.m_nWords, kBytes, info.m_note );
int langCode = DictLangCache.getLangLangCode( m_activity, info.m_lang ); int langCode = DictLangCache.getLangLangCode( m_activity, info.m_lang );
@ -739,9 +740,9 @@ public class DictsDelegate extends ListDelegateBase
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
public void dlgButtonClicked( Action action, int which, Object[] params ) public void dlgButtonClicked( Action action, int which, Object[] params )
{ {
switch( action ) { if ( DialogInterface.BUTTON_POSITIVE == which ) {
case DELETE_DICT_ACTION: switch( action ) {
if ( DialogInterface.BUTTON_POSITIVE == which ) { case DELETE_DICT_ACTION:
XWListItem[] items = (XWListItem[])params[0]; XWListItem[] items = (XWListItem[])params[0];
for ( XWListItem item : items ) { for ( XWListItem item : items ) {
String name = item.getText(); String name = item.getText();
@ -749,24 +750,20 @@ public class DictsDelegate extends ListDelegateBase
deleteDict( name, loc ); deleteDict( name, loc );
} }
clearSelections(); clearSelections();
} break;
break; case DOWNLOAD_DICT_ACTION:
case DOWNLOAD_DICT_ACTION:
if ( DialogInterface.BUTTON_POSITIVE == which ) {
int lang = (Integer)params[0]; int lang = (Integer)params[0];
String name = (String)params[1]; String name = (String)params[1];
DwnldDelegate.downloadDictInBack( m_activity, lang, name, this ); DwnldDelegate.downloadDictInBack( m_activity, lang, name, this );
} break;
break; case UPDATE_DICTS_ACTION:
case UPDATE_DICTS_ACTION:
if ( DialogInterface.BUTTON_POSITIVE == which ) {
String[] urls = m_needUpdates.values(). String[] urls = m_needUpdates.values().
toArray( new String[m_needUpdates.size()] ); toArray( new String[m_needUpdates.size()] );
DwnldDelegate.downloadDictsInBack( m_activity, urls, this ); DwnldDelegate.downloadDictsInBack( m_activity, urls, this );
break;
default:
Assert.fail();
} }
break;
default:
Assert.fail();
} }
} }
@ -1020,7 +1017,7 @@ public class DictsDelegate extends ListDelegateBase
JSONObject dict = dicts.getJSONObject( jj ); JSONObject dict = dicts.getJSONObject( jj );
String name = dict.getString( "xwd" ); String name = dict.getString( "xwd" );
name = DictUtils.removeDictExtn( name ); name = DictUtils.removeDictExtn( name );
int nBytes = dict.optInt( "nBytes", -1 ); long nBytes = dict.optLong( "nBytes", -1 );
int nWords = dict.optInt( "nWords", -1 ); int nWords = dict.optInt( "nWords", -1 );
DictInfo info = new DictInfo( name, langName, nWords, nBytes ); DictInfo info = new DictInfo( name, langName, nWords, nBytes );
if ( DictLangCache.haveDict( m_activity, langName, name ) ) { if ( DictLangCache.haveDict( m_activity, langName, name ) ) {