fix yOffsetChanged to follow new API, but still leave commented out;

set game file name from resource, and make visible in board title and
as part of games list entries.
This commit is contained in:
eehouse 2010-05-12 11:56:01 +00:00
parent 6bbf7f32dd
commit 24c1527232
6 changed files with 25 additions and 6 deletions

View file

@ -185,11 +185,11 @@ and_util_yOffsetChange(XW_UtilCtxt* uc, XP_U16 maxOffset,
#if 0
AndUtil* util = (AndUtil*)uc;
JNIEnv* env = *util->env;
const char* sig = "(II)V";
const char* sig = "(III)V";
jmethodID mid = getMethodID( env, util->jutil, "yOffsetChange", sig );
(*env)->CallVoidMethod( env, util->jutil, mid,
oldOffset, newOffset );
maxOffset, oldOffset, newOffset );
#endif
}

View file

@ -313,4 +313,6 @@
<string name="green">Green</string>
<string name="blue">Blue</string>
<string name="gamef">Game %d</string>
</resources>

View file

@ -631,6 +631,8 @@ public class BoardActivity extends Activity implements UtilCtxt {
m_jniThread.handle( JNICmd.CMD_START );
// check and disable zoom button at limit
m_jniThread.handle( JNICmd.CMD_ZOOM, 0 );
setTitle( Utils.gameName( this, m_path ) );
}
}
} // loadGame
@ -906,6 +908,12 @@ public class BoardActivity extends Activity implements UtilCtxt {
m_jniThread.handle( JNIThread.JNICmd.CMD_POST_OVER );
}
// public void yOffsetChange( int maxOffset, int oldOffset, int newOffset )
// {
// Utils.logf( "yOffsetChange(maxOffset=%d)", maxOffset );
// m_view.setVerticalScrollBarEnabled( maxOffset > 0 );
// }
public boolean warnIllegalWord( String[] words, int turn, boolean turnLost )
{
Utils.logf( "warnIllegalWord" );

View file

@ -69,7 +69,10 @@ public class GameListAdapter extends XWListAdapter {
GameSummary summary = Utils.getSummary( m_context, path );
TextView view = (TextView)layout.findViewById( R.id.players );
view.setText( gi.summarizePlayers( m_context, summary ) );
String gameName = Utils.gameName( m_context, path );
view.setText( String.format( "%s: %s", gameName,
gi.summarizePlayers( m_context,
summary ) ) );
view = (TextView)layout.findViewById( R.id.state );
view.setText( gi.summarizeState( m_context, summary ) );

View file

@ -272,12 +272,13 @@ public class Utils {
public static String newName( Context context )
{
String name = null;
Integer num = 0;
Integer num = 1;
int ii;
String[] files = context.fileList();
String fmt = context.getString( R.string.gamef );
while ( name == null ) {
name = "game " + num.toString() + XWConstants.GAME_EXTN;
name = String.format( fmt + XWConstants.GAME_EXTN, num );
for ( ii = 0; ii < files.length; ++ii ) {
if ( files[ii].equals(name) ) {
++num;
@ -576,6 +577,11 @@ public class Utils {
db.close();
}
public static String gameName( Context context, String path )
{
return path.substring( 0, path.lastIndexOf( XWConstants.GAME_EXTN ) );
}
private static String removeExtn( String str )
{
if ( str.endsWith( XWConstants.DICT_EXTN ) ) {

View file

@ -101,7 +101,7 @@ public interface UtilCtxt {
void notifyGameOver();
// Don't need this unless we have a scroll thumb to indicate position
//void yOffsetChange( int oldOffset, int newOffset );
//void yOffsetChange( int maxOffset, int oldOffset, int newOffset );
boolean warnIllegalWord( String[] words, int turn, boolean turnLost );
}