add not-again hints to all the buttons

This commit is contained in:
Andy2 2010-10-24 17:47:11 -07:00
parent e909e4b343
commit 39e502fe71
4 changed files with 67 additions and 33 deletions

View file

@ -42,6 +42,12 @@
<string name="key_notagain_relay">key_notagain_relay</string>
<string name="key_notagain_newgame">key_notagain_newgame</string>
<string name="key_notagain_newgamenet">key_notagain_newgamenet</string>
<string name="key_notagain_hintprev">key_notagain_hintprev</string>
<string name="key_notagain_hintnext">key_notagain_hintnext</string>
<string name="key_notagain_juggle">key_notagain_juggle</string>
<string name="key_notagain_flip">key_notagain_flip</string>
<string name="key_notagain_zoom">key_notagain_zoom</string>
<string name="key_notagain_undo">key_notagain_undo</string>
<string name="relayids_extra">org.eehouse.android.xw4.relayids_extra</string>

View file

@ -416,6 +416,22 @@
the game, tap it; to change its configuration or for other
options, long-tap it.</string>
<string name="not_again_hintprev">This button moves backwards
through the list of possible moves using tiles to the right of
the rack divider.</string>
<string name="not_again_hintnext">This button moves forward
through the list of possible moves using tiles to the right of
the rack divider.</string>
<string name="not_again_juggle">This button randomly rearranges
tiles in the rack.</string>
<string name="not_again_flip">This button flips the board across a
diagonal axis.</string>
<string name="not_again_zoom">This button toggles the board
between zoomed and regular size. Drag it when it is zoomed to
see parts that are hidden.</string>
<string name="not_again_undo">This button undos/redoes the current
turn.</string>
<string name="not_again_newgamenet">The new game you have created </string>
</resources>

View file

@ -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()

View file

@ -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 ) {