From 33d5246b7a4d3c4b410dbdb482a85a95df40102b Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sat, 15 Jan 2011 21:45:20 -0800 Subject: [PATCH] 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. --- .../android/XWords4/res/values/common_rsrc.xml | 1 + xwords4/android/XWords4/res/values/strings.xml | 8 ++++++++ .../org/eehouse/android/xw4/BoardActivity.java | 2 +- .../src/org/eehouse/android/xw4/BoardView.java | 18 +++++++++++++++++- .../eehouse/android/xw4/jni/BoardHandler.java | 6 +++++- 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 0d9e4b96a..fd8cd9e03 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -54,6 +54,7 @@ key_notagain_conndfirst key_notagain_conndmid key_notagain_dicts + key_notagain_arrow org.eehouse.android.xw4.relayids_extra diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 808b87952..90be8b49e 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -488,6 +488,14 @@ here. Email me at eehouse@eehouse.org for information on building and installing your own dictionaries. + 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. + To start a basic networked two-player game in %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 7e4840048..524d639a9 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -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 ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java index d3cd11639..f25ca08ed 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java @@ -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 ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java index b803e2ff8..bdadcdecd 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java @@ -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 ); }