mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-20 22:26:54 +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>
|
||||||
|
|
||||||
<string name="gamel_menu_checkupdates">Check for updates</string>
|
<string name="gamel_menu_checkupdates">Check for updates</string>
|
||||||
<string name="new_dict_avail">New Wordlist available</string>
|
<string name="new_dict_avail">New wordlist available</string>
|
||||||
<string name="new_dict_availf">%s has been updated</string>
|
<string name="new_dict_availf">Tap to update %s</string>
|
||||||
<string name="new_app_availf">New app available</string>
|
<string name="new_app_availf">New version of %s</string>
|
||||||
<string name="new_app_avail">Click to download</string>
|
<string name="new_app_avail">Tap to download</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.eehouse.android.xw4;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -320,12 +321,11 @@ public class NetUtils {
|
||||||
String sum )
|
String sum )
|
||||||
{
|
{
|
||||||
int lang = DictLangCache.getDictLangCode( context, dal );
|
int lang = DictLangCache.getDictLangCode( context, dal );
|
||||||
|
String langStr = DictLangCache.getLangName( context, lang );
|
||||||
HttpPost post = makePost( "dictVersion" );
|
HttpPost post = makePost( "dictVersion" );
|
||||||
List<NameValuePair> nvp = new ArrayList<NameValuePair>();
|
List<NameValuePair> nvp = new ArrayList<NameValuePair>();
|
||||||
nvp.add( new BasicNameValuePair( "name", dal.name ) );
|
nvp.add( new BasicNameValuePair( "name", dal.name ) );
|
||||||
nvp.add( new BasicNameValuePair( "lang",
|
nvp.add( new BasicNameValuePair( "lang", langStr ) );
|
||||||
String.format( "%d",
|
|
||||||
lang ) ) );
|
|
||||||
nvp.add( new BasicNameValuePair( "md5sum", sum ) );
|
nvp.add( new BasicNameValuePair( "md5sum", sum ) );
|
||||||
return runPost( post, nvp );
|
return runPost( post, nvp );
|
||||||
}
|
}
|
||||||
|
@ -351,10 +351,12 @@ public class NetUtils {
|
||||||
versionCode ) ) );
|
versionCode ) ) );
|
||||||
String url = runPost( post, nvp );
|
String url = runPost( post, nvp );
|
||||||
if ( null != url ) {
|
if ( null != url ) {
|
||||||
|
ApplicationInfo ai = pm.getApplicationInfo( packageName, 0);
|
||||||
|
String label = pm.getApplicationLabel( ai ).toString();
|
||||||
Intent intent =
|
Intent intent =
|
||||||
new Intent( Intent.ACTION_VIEW, Uri.parse(url) );
|
new Intent( Intent.ACTION_VIEW, Uri.parse(url) );
|
||||||
String title = Utils.format( context, R.string.new_app_availf,
|
String title =
|
||||||
packageName );
|
Utils.format( context, R.string.new_app_availf, label );
|
||||||
String body = context.getString( R.string.new_app_avail );
|
String body = context.getString( R.string.new_app_avail );
|
||||||
Utils.postNotification( context, intent, title, body,
|
Utils.postNotification( context, intent, title, body,
|
||||||
url.hashCode() );
|
url.hashCode() );
|
||||||
|
|
|
@ -68,45 +68,20 @@ def curVersion( req, name, version ):
|
||||||
logging.debug( 'Error: bad name ' + name )
|
logging.debug( 'Error: bad name ' + name )
|
||||||
return result
|
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
|
# public
|
||||||
def dictVersion( req, name, lang, md5sum ):
|
def dictVersion( req, name, lang, md5sum ):
|
||||||
result = ''
|
result = ''
|
||||||
if not name.endswith(k_suffix): name += k_suffix
|
if not name.endswith(k_suffix): name += k_suffix
|
||||||
dictSums = getDictSums()
|
dictSums = getDictSums()
|
||||||
path = langStr(lang) + "/" + name
|
path = lang + "/" + name
|
||||||
if not path in dictSums:
|
if not path in dictSums:
|
||||||
sum = md5Checksum( dictSums, path )
|
sum = md5Checksum( dictSums, path )
|
||||||
if sum:
|
if sum:
|
||||||
dictSums[path] = sum
|
dictSums[path] = sum
|
||||||
s_shelf['sums'] = dictSums
|
s_shelf['sums'] = dictSums
|
||||||
if path in dictSums and dictSums[path] != md5sum:
|
if path in dictSums:
|
||||||
logging.debug( dictSums[path] + " vs " + md5sum )
|
if dictSums[path] != md5sum:
|
||||||
result = k_urlbase + "and_wordlists/" + path
|
result = k_urlbase + "and_wordlists/" + path
|
||||||
else:
|
else:
|
||||||
logging.debug( path + " not known" )
|
logging.debug( path + " not known" )
|
||||||
s_shelf.close()
|
s_shelf.close()
|
||||||
|
|
Loading…
Reference in a new issue