From 4f180e9e1429eb66bfc624d6a8afeef80e2b8081 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 6 Sep 2012 19:04:40 -0700 Subject: [PATCH] pass rejecting dict name into java layer and display as part of turn lost message. --- xwords4/android/XWords4/jni/utilwrapper.c | 8 ++++++-- xwords4/android/XWords4/res/values/strings.xml | 4 ++-- .../src/org/eehouse/android/xw4/BoardActivity.java | 7 ++++--- .../XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java | 3 ++- .../src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c index 2ebc5ebe2..795f6456a 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.c +++ b/xwords4/android/XWords4/jni/utilwrapper.c @@ -428,14 +428,18 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, XP_U16 turn, XP_Bool turnLost ) { jboolean result = XP_FALSE; - UTIL_CBK_HEADER("warnIllegalWord", "([Ljava/lang/String;IZ)Z" ); + UTIL_CBK_HEADER("warnIllegalWord", + "(Ljava/lang/String;[Ljava/lang/String;IZ)Z" ); XP_ASSERT( bwi->nWords > 0 ); if ( bwi->nWords > 0 ) { jobjectArray jwords = makeStringArray( env, bwi->nWords, (const XP_UCHAR**)bwi->words ); + XP_ASSERT( !!bwi->dictName ); + jstring jname = (*env)->NewStringUTF( env, bwi->dictName ); result = (*env)->CallBooleanMethod( env, util->jutil, mid, - jwords, turn, turnLost ); + jname, jwords, turn, turnLost ); (*env)->DeleteLocalRef( env, jwords ); + (*env)->DeleteLocalRef( env, jname ); } UTIL_CBK_TAIL(); return result; diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 1f865790b..61769251d 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -629,8 +629,8 @@ phonies_disallow is the current setting and a "phony" is played. One of the two following strings will be appended --> - Word[s] %s not found in - wordlist. + Word[s] %1$s not found in + wordlist %2$s. diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 5f595f351..f05e8de19 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -1492,10 +1492,10 @@ public class BoardActivity extends XWActivity // m_view.setVerticalScrollBarEnabled( maxOffset > 0 ); // } @Override - public boolean warnIllegalWord( String[] words, int turn, + public boolean warnIllegalWord( String dict, String[] words, int turn, boolean turnLost ) { - DbgUtils.logf( "warnIllegalWord" ); + DbgUtils.logf( "warnIllegalWord(dict=%s)", dict ); boolean accept = turnLost; StringBuffer sb = new StringBuffer(); @@ -1507,7 +1507,8 @@ public class BoardActivity extends XWActivity sb.append( "; " ); } - String message = getString( R.string.ids_badwords, sb.toString() ); + String message = + getString( R.string.ids_badwords, sb.toString(), dict ); if ( turnLost ) { nonBlockingDialog( DLG_BADWORDS, diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java index 0a853640e..1c5a43aa9 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java @@ -126,7 +126,8 @@ public interface UtilCtxt { // Don't need this unless we have a scroll thumb to indicate position //void yOffsetChange( int maxOffset, int oldOffset, int newOffset ); - boolean warnIllegalWord( String[] words, int turn, boolean turnLost ); + boolean warnIllegalWord( String dict, String[] words, int turn, + boolean turnLost ); void showChat( String msg ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java index a5c3cf9e6..e6ea188e8 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java @@ -242,7 +242,8 @@ public class UtilCtxtImpl implements UtilCtxt { subclassOverride( "notifyGameOver" ); } - public boolean warnIllegalWord( String[] words, int turn, boolean turnLost ) + public boolean warnIllegalWord( String dict, String[] words, int turn, + boolean turnLost ) { subclassOverride( "warnIllegalWord" ); return false;