From 39e502fe710fec19bc77e0ffd2ba781a145f7ad7 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Sun, 24 Oct 2010 17:47:11 -0700 Subject: [PATCH] add not-again hints to all the buttons --- .../XWords4/res/values/common_rsrc.xml | 6 ++ .../android/XWords4/res/values/strings.xml | 16 +++++ .../eehouse/android/xw4/BoardActivity.java | 62 +++++++++---------- .../src/org/eehouse/android/xw4/Toolbar.java | 16 ++++- 4 files changed, 67 insertions(+), 33 deletions(-) diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml index 92c19b382..35b2f37c3 100644 --- a/xwords4/android/XWords4/res/values/common_rsrc.xml +++ b/xwords4/android/XWords4/res/values/common_rsrc.xml @@ -42,6 +42,12 @@ key_notagain_relay key_notagain_newgame key_notagain_newgamenet + key_notagain_hintprev + key_notagain_hintnext + key_notagain_juggle + key_notagain_flip + key_notagain_zoom + key_notagain_undo 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 77f79c1aa..a79a3e5da 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -416,6 +416,22 @@ the game, tap it; to change its configuration or for other options, long-tap it. + This button moves backwards + through the list of possible moves using tiles to the right of + the rack divider. + This button moves forward + through the list of possible moves using tiles to the right of + the rack divider. + This button randomly rearranges + tiles in the rack. + This button flips the board across a + diagonal axis. + This button toggles the board + between zoomed and regular size. Drag it when it is zoomed to + see parts that are hidden. + This button undos/redoes the current + turn. + The new game you have created 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 fbd6c1371..b2b0e13d1 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -803,76 +803,76 @@ public class BoardActivity extends XWActivity implements UtilCtxt { } } // loadGame - private void handleChatButton() - { - Runnable runnable = new Runnable() { - public void run() { - showDialog( GET_MESSAGE ); - } - }; - - showNotAgainDlgThen( R.string.not_again_chat, - R.string.key_notagain_chat, - runnable ); - } - private void populateToolbar() { m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV, - new View.OnClickListener() { - @Override - public void onClick( View view ) { + R.string.not_again_hintprev, + R.string.key_notagain_hintprev, + new Runnable() { + public void run() { m_jniThread.handle( JNIThread.JNICmd .CMD_PREV_HINT ); } } ); m_toolbar.setListener( Toolbar.BUTTON_HINT_NEXT, - new View.OnClickListener() { + R.string.not_again_hintnext, + R.string.key_notagain_hintnext, + new Runnable() { @Override - public void onClick( View view ) { + public void run() { m_jniThread.handle( JNIThread.JNICmd .CMD_NEXT_HINT ); } } ); m_toolbar.setListener( Toolbar.BUTTON_JUGGLE, - new View.OnClickListener() { + R.string.not_again_juggle, + R.string.key_notagain_juggle, + new Runnable() { @Override - public void onClick( View view ) { + public void run() { m_jniThread.handle( JNIThread.JNICmd .CMD_JUGGLE ); } } ); m_toolbar.setListener( Toolbar.BUTTON_FLIP, - new View.OnClickListener() { + R.string.not_again_flip, + R.string.key_notagain_flip, + new Runnable() { @Override - public void onClick( View view ) { + public void run() { m_jniThread.handle( JNIThread.JNICmd .CMD_FLIP ); } } ); m_toolbar.setListener( Toolbar.BUTTON_ZOOM, - new View.OnClickListener() { + R.string.not_again_zoom, + R.string.key_notagain_zoom, + new Runnable() { @Override - public void onClick( View view ) { + public void run() { m_jniThread.handle( JNIThread.JNICmd .CMD_TOGGLEZOOM ); } } ); m_toolbar.setListener( Toolbar.BUTTON_UNDO, - new View.OnClickListener() { + R.string.not_again_undo, + R.string.key_notagain_undo, + new Runnable() { @Override - public void onClick( View view ) { + public void run() { m_jniThread.handle( JNIThread.JNICmd .CMD_UNDO_CUR ); } - }) ; + }); m_toolbar.setListener( Toolbar.BUTTON_CHAT, - new View.OnClickListener() { + R.string.not_again_chat, + R.string.key_notagain_chat, + new Runnable() { @Override - public void onClick( View view ) { - handleChatButton(); + public void run() { + showDialog( GET_MESSAGE ); } - }) ; + }); } // populateToolbar private DialogInterface.OnDismissListener makeODLforBlocking() diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java index 4c735b7a2..d1090cac0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java @@ -23,6 +23,7 @@ package org.eehouse.android.xw4; import android.app.Activity; import android.content.Context; +import android.content.DialogInterface; import android.view.View; import android.widget.LinearLayout; import android.widget.ImageButton; @@ -73,7 +74,7 @@ public class Toolbar { R.id.chat_button_vertical ), }; - private Activity m_activity; + private XWActivity m_activity; private LinearLayout m_horLayout; private LinearLayout m_vertLayout; @@ -83,7 +84,7 @@ public class Toolbar { }; private ORIENTATION m_curOrient = ORIENTATION.ORIENT_UNKNOWN; - public Toolbar( Activity activity, View horLayout, View vertLayout ) + public Toolbar( XWActivity activity, View horLayout, View vertLayout ) { m_activity = activity; m_horLayout = (LinearLayout)horLayout; @@ -99,6 +100,17 @@ public class Toolbar { } } + public void setListener( int index, final int msgID, final int prefsKey, + final Runnable proc ) + { + View.OnClickListener listener = new View.OnClickListener() { + public void onClick( View view ) { + m_activity.showNotAgainDlgThen( msgID, prefsKey, proc ); + } + }; + setListener( index, listener ); + } + public void orientChanged( boolean landscape ) { if ( landscape && m_curOrient == ORIENTATION.ORIENT_LANDSCAPE ) {