add a new-user hint, displayed the first time the arrow's drawn on the

board, explaining what the arrow's for and how to move and disable it.
Implementation required passing XWActivity into BoardView so the
newbie hint method could be called on it.
This commit is contained in:
Andy2 2011-01-15 21:45:20 -08:00
parent 4948ceab2b
commit af9cc8cfba
5 changed files with 32 additions and 3 deletions

View file

@ -54,6 +54,7 @@
<string name="key_notagain_conndfirst">key_notagain_conndfirst</string>
<string name="key_notagain_conndmid">key_notagain_conndmid</string>
<string name="key_notagain_dicts">key_notagain_dicts</string>
<string name="key_notagain_arrow">key_notagain_arrow</string>
<string name="relayids_extra">org.eehouse.android.xw4.relayids_extra</string>

View file

@ -484,6 +484,14 @@
here. Email me at eehouse@eehouse.org for information on building
and installing your own dictionaries.</string>
<string name="not_again_arrow">Moving tiles to the board:\nYou can
drag tiles between the rack and the board, or you can tap an
empty square to place the board arrow. Rack tiles you tap will
replace the arrow (moving it one square in the direction it
points.) Tap the arrow once to change its orientation; a second
time, to hide it. A checkbox in the Appearance section of
Settings will hide it permanently.</string>
<string name="relay_game_explainf">To start a basic networked two-player
game in %s:</string>

View file

@ -830,7 +830,7 @@ public class BoardActivity extends XWActivity implements UtilCtxt {
} );
m_jniThread.start();
m_view.startHandling( m_jniThread, m_jniGamePtr, m_gi );
m_view.startHandling( this, m_jniThread, m_jniGamePtr, m_gi );
if ( null != m_xport ) {
m_xport.setReceiver( m_jniThread );
}

View file

@ -66,6 +66,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
private Drawable m_origin;
private int m_left, m_top;
private JNIThread m_jniThread;
private XWActivity m_parent;
private String[][] m_scores;
private String[] m_dictChars;
private Rect m_boundsScratch;
@ -286,8 +287,10 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
} // layoutBoardOnce
// BoardHandler interface implementation
public void startHandling( JNIThread thread, int gamePtr, CurGameInfo gi )
public void startHandling( XWActivity parent, JNIThread thread,
int gamePtr, CurGameInfo gi )
{
m_parent = parent;
m_jniThread = thread;
m_jniGamePtr = gamePtr;
m_gi = gi;
@ -506,6 +509,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
return true;
} // drawCell
private boolean m_arrowHintShown = false;
public void drawBoardArrow( Rect rect, int bonus, boolean vert,
int hintAtts, int flags )
{
@ -513,6 +517,18 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
Drawable arrow = vert? m_downArrow : m_rightArrow;
arrow.setBounds( rect );
arrow.draw( m_canvas );
if ( !m_arrowHintShown ) {
m_arrowHintShown = true;
m_viewHandler.post( new Runnable() {
public void run() {
m_parent.
showNotAgainDlgThen( R.string.not_again_arrow,
R.string.key_notagain_arrow,
null );
}
} );
}
}
public boolean trayBegin ( Rect rect, int owner, int dfs )

View file

@ -1,3 +1,4 @@
/* -*- compile-command: "cd ../../../../../../; ant install"; -*- */
/*
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
* rights reserved.
@ -19,8 +20,11 @@
package org.eehouse.android.xw4.jni;
import org.eehouse.android.xw4.XWActivity;
public interface BoardHandler {
void startHandling( JNIThread thread, int gamePtr, CurGameInfo gi );
void startHandling( XWActivity parent, JNIThread thread,
int gamePtr, CurGameInfo gi );
}