mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
pass lang instead of lang code; include app name in notification text
This commit is contained in:
parent
cd340aba0c
commit
6947c50238
3 changed files with 15 additions and 38 deletions
|
@ -1997,9 +1997,9 @@
|
|||
</string>
|
||||
|
||||
<string name="gamel_menu_checkupdates">Check for updates</string>
|
||||
<string name="new_dict_avail">New Wordlist available</string>
|
||||
<string name="new_dict_availf">%s has been updated</string>
|
||||
<string name="new_app_availf">New app available</string>
|
||||
<string name="new_app_avail">Click to download</string>
|
||||
<string name="new_dict_avail">New wordlist available</string>
|
||||
<string name="new_dict_availf">Tap to update %s</string>
|
||||
<string name="new_app_availf">New version of %s</string>
|
||||
<string name="new_app_avail">Tap to download</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.eehouse.android.xw4;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -320,12 +321,11 @@ public class NetUtils {
|
|||
String sum )
|
||||
{
|
||||
int lang = DictLangCache.getDictLangCode( context, dal );
|
||||
String langStr = DictLangCache.getLangName( context, lang );
|
||||
HttpPost post = makePost( "dictVersion" );
|
||||
List<NameValuePair> nvp = new ArrayList<NameValuePair>();
|
||||
nvp.add( new BasicNameValuePair( "name", dal.name ) );
|
||||
nvp.add( new BasicNameValuePair( "lang",
|
||||
String.format( "%d",
|
||||
lang ) ) );
|
||||
nvp.add( new BasicNameValuePair( "lang", langStr ) );
|
||||
nvp.add( new BasicNameValuePair( "md5sum", sum ) );
|
||||
return runPost( post, nvp );
|
||||
}
|
||||
|
@ -351,10 +351,12 @@ public class NetUtils {
|
|||
versionCode ) ) );
|
||||
String url = runPost( post, nvp );
|
||||
if ( null != url ) {
|
||||
ApplicationInfo ai = pm.getApplicationInfo( packageName, 0);
|
||||
String label = pm.getApplicationLabel( ai ).toString();
|
||||
Intent intent =
|
||||
new Intent( Intent.ACTION_VIEW, Uri.parse(url) );
|
||||
String title = Utils.format( context, R.string.new_app_availf,
|
||||
packageName );
|
||||
String title =
|
||||
Utils.format( context, R.string.new_app_availf, label );
|
||||
String body = context.getString( R.string.new_app_avail );
|
||||
Utils.postNotification( context, intent, title, body,
|
||||
url.hashCode() );
|
||||
|
|
|
@ -68,45 +68,20 @@ def curVersion( req, name, version ):
|
|||
logging.debug( 'Error: bad name ' + name )
|
||||
return result
|
||||
|
||||
# Order determined by language_names in
|
||||
# android/XWords4/res/values/common_rsrc.xml
|
||||
def langStr( lang ):
|
||||
langs = ( '<unknown>'
|
||||
,'English'
|
||||
,'French'
|
||||
,'German'
|
||||
,'Turkish'
|
||||
,'Arabic'
|
||||
,'Spanish'
|
||||
,'Swedish'
|
||||
,'Polish'
|
||||
,'Danish'
|
||||
,'Italian'
|
||||
,'Dutch'
|
||||
,'Catalan'
|
||||
,'Portuguese'
|
||||
,''
|
||||
,'Russian'
|
||||
,''
|
||||
,'Czech'
|
||||
,'Greek'
|
||||
,'Slovak' )
|
||||
return langs[int(lang)]
|
||||
|
||||
# public
|
||||
def dictVersion( req, name, lang, md5sum ):
|
||||
result = ''
|
||||
if not name.endswith(k_suffix): name += k_suffix
|
||||
dictSums = getDictSums()
|
||||
path = langStr(lang) + "/" + name
|
||||
path = lang + "/" + name
|
||||
if not path in dictSums:
|
||||
sum = md5Checksum( dictSums, path )
|
||||
if sum:
|
||||
dictSums[path] = sum
|
||||
s_shelf['sums'] = dictSums
|
||||
if path in dictSums and dictSums[path] != md5sum:
|
||||
logging.debug( dictSums[path] + " vs " + md5sum )
|
||||
result = k_urlbase + "and_wordlists/" + path
|
||||
if path in dictSums:
|
||||
if dictSums[path] != md5sum:
|
||||
result = k_urlbase + "and_wordlists/" + path
|
||||
else:
|
||||
logging.debug( path + " not known" )
|
||||
s_shelf.close()
|
||||
|
|
Loading…
Reference in a new issue