mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
use new params-passing DlgDelegate to add hint about new selecting
feature.
This commit is contained in:
parent
2ec0a7ba8d
commit
4bc554bc40
5 changed files with 56 additions and 21 deletions
|
@ -2176,7 +2176,7 @@
|
||||||
<string name="relay_alert_title">Message from relay</string>
|
<string name="relay_alert_title">Message from relay</string>
|
||||||
|
|
||||||
<string name="not_again_newselect">Tapping a game opens it.\n\nYou
|
<string name="not_again_newselect">Tapping a game opens it.\n\nYou
|
||||||
can instead tap the icon at the left to select or deselect games,
|
can instead tap the icons at the left to select or deselect games,
|
||||||
then act on selected games, e.g. to delete them, using the menu or
|
then act on selected games, e.g. to delete them, using the menu or
|
||||||
\"Actionbar.\"</string>
|
\"Actionbar.\"</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class DlgDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showNotAgainDlgThen( int msgID, int prefsKey,
|
public void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||||
int callbackID )
|
int callbackID, Object[] params )
|
||||||
{
|
{
|
||||||
if ( XWPrefs.getPrefsBoolean( m_activity, prefsKey, false ) ) {
|
if ( XWPrefs.getPrefsBoolean( m_activity, prefsKey, false ) ) {
|
||||||
// If it's set, do the action without bothering with the
|
// If it's set, do the action without bothering with the
|
||||||
|
@ -165,17 +165,24 @@ public class DlgDelegate {
|
||||||
if ( SKIP_CALLBACK != callbackID ) {
|
if ( SKIP_CALLBACK != callbackID ) {
|
||||||
m_clickCallback.dlgButtonClicked( callbackID,
|
m_clickCallback.dlgButtonClicked( callbackID,
|
||||||
AlertDialog.BUTTON_POSITIVE,
|
AlertDialog.BUTTON_POSITIVE,
|
||||||
null );
|
params );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String msg = m_activity.getString( msgID );
|
String msg = m_activity.getString( msgID );
|
||||||
DlgState state =
|
DlgState state =
|
||||||
new DlgState( DIALOG_NOTAGAIN, msg, callbackID, prefsKey );
|
new DlgState( DIALOG_NOTAGAIN, msg, callbackID, prefsKey,
|
||||||
|
params );
|
||||||
addState( state );
|
addState( state );
|
||||||
m_activity.showDialog( DIALOG_NOTAGAIN );
|
m_activity.showDialog( DIALOG_NOTAGAIN );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||||
|
int callbackID )
|
||||||
|
{
|
||||||
|
showNotAgainDlgThen( msgID, prefsKey, callbackID, null );
|
||||||
|
}
|
||||||
|
|
||||||
public void showNotAgainDlgThen( int msgID, int prefsKey )
|
public void showNotAgainDlgThen( int msgID, int prefsKey )
|
||||||
{
|
{
|
||||||
showNotAgainDlgThen( msgID, prefsKey, SKIP_CALLBACK );
|
showNotAgainDlgThen( msgID, prefsKey, SKIP_CALLBACK );
|
||||||
|
|
|
@ -41,6 +41,13 @@ public class DlgState implements Parcelable {
|
||||||
this( id, msg, R.string.button_ok, cbckID, prefsKey );
|
this( id, msg, R.string.button_ok, cbckID, prefsKey );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DlgState( int id, String msg, int cbckID, int prefsKey,
|
||||||
|
Object[] params )
|
||||||
|
{
|
||||||
|
this( id, msg, R.string.button_ok, cbckID, prefsKey );
|
||||||
|
m_params = params;
|
||||||
|
}
|
||||||
|
|
||||||
public DlgState( int id, String msg, int posButton,
|
public DlgState( int id, String msg, int posButton,
|
||||||
int cbckID, int prefsKey )
|
int cbckID, int prefsKey )
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,6 +90,7 @@ public class GamesList extends XWExpandableListActivity
|
||||||
private static final int NEW_FROM_ACTION = 5;
|
private static final int NEW_FROM_ACTION = 5;
|
||||||
private static final int DELETE_GROUP_ACTION = 6;
|
private static final int DELETE_GROUP_ACTION = 6;
|
||||||
private static final int DELETE_SELGAMES_ACTION = 7;
|
private static final int DELETE_SELGAMES_ACTION = 7;
|
||||||
|
private static final int OPEN_GAME_ACTION = 8;
|
||||||
private static final int[] DEBUGITEMS = { R.id.gamel_menu_loaddb
|
private static final int[] DEBUGITEMS = { R.id.gamel_menu_loaddb
|
||||||
, R.id.gamel_menu_storedb
|
, R.id.gamel_menu_storedb
|
||||||
, R.id.gamel_menu_checkupdates
|
, R.id.gamel_menu_checkupdates
|
||||||
|
@ -494,23 +495,9 @@ public class GamesList extends XWExpandableListActivity
|
||||||
// dialog in case it was dismissed. That way it to check for
|
// dialog in case it was dismissed. That way it to check for
|
||||||
// an empty room name.
|
// an empty room name.
|
||||||
if ( !m_gameLaunched ) {
|
if ( !m_gameLaunched ) {
|
||||||
if ( summary.conType == CommsAddrRec.CommsConnType.COMMS_CONN_RELAY
|
showNotAgainDlgThen( R.string.not_again_newselect,
|
||||||
&& summary.roomName.length() == 0 ) {
|
R.string.key_notagain_newselect,
|
||||||
// If it's unconfigured and of the type RelayGameActivity
|
OPEN_GAME_ACTION, rowid, summary );
|
||||||
// can handle send it there, otherwise use the full-on
|
|
||||||
// config.
|
|
||||||
Class clazz;
|
|
||||||
if ( RelayGameActivity.isSimpleGame( summary ) ) {
|
|
||||||
clazz = RelayGameActivity.class;
|
|
||||||
} else {
|
|
||||||
clazz = GameConfig.class;
|
|
||||||
}
|
|
||||||
GameUtils.doConfig( this, rowid, clazz );
|
|
||||||
} else {
|
|
||||||
if ( checkWarnNoDict( rowid ) ) {
|
|
||||||
launchGame( rowid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,6 +572,9 @@ public class GamesList extends XWExpandableListActivity
|
||||||
case DELETE_SELGAMES_ACTION:
|
case DELETE_SELGAMES_ACTION:
|
||||||
deleteSelected();
|
deleteSelected();
|
||||||
break;
|
break;
|
||||||
|
case OPEN_GAME_ACTION:
|
||||||
|
doOpenGame( params );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.fail();
|
Assert.fail();
|
||||||
}
|
}
|
||||||
|
@ -1186,6 +1176,31 @@ public class GamesList extends XWExpandableListActivity
|
||||||
tryAlert( intent );
|
tryAlert( intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doOpenGame( Object[] params )
|
||||||
|
{
|
||||||
|
GameSummary summary = (GameSummary)params[1];
|
||||||
|
long rowid = (Long)params[0];
|
||||||
|
|
||||||
|
if ( summary.conType == CommsAddrRec.CommsConnType.COMMS_CONN_RELAY
|
||||||
|
&& summary.roomName.length() == 0 ) {
|
||||||
|
// If it's unconfigured and of the type RelayGameActivity
|
||||||
|
// can handle send it there, otherwise use the full-on
|
||||||
|
// config.
|
||||||
|
Class clazz;
|
||||||
|
|
||||||
|
if ( RelayGameActivity.isSimpleGame( summary ) ) {
|
||||||
|
clazz = RelayGameActivity.class;
|
||||||
|
} else {
|
||||||
|
clazz = GameConfig.class;
|
||||||
|
}
|
||||||
|
GameUtils.doConfig( this, rowid, clazz );
|
||||||
|
} else {
|
||||||
|
if ( checkWarnNoDict( rowid ) ) {
|
||||||
|
launchGame( rowid );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void onGameDictDownload( Context context, Intent intent )
|
public static void onGameDictDownload( Context context, Intent intent )
|
||||||
{
|
{
|
||||||
intent.setClass( context, GamesList.class );
|
intent.setClass( context, GamesList.class );
|
||||||
|
|
|
@ -84,6 +84,12 @@ public class XWExpandableListActivity extends ExpandableListActivity
|
||||||
m_delegate.doSyncMenuitem();
|
m_delegate.doSyncMenuitem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||||
|
int action, Object... params )
|
||||||
|
{
|
||||||
|
m_delegate.showNotAgainDlgThen( msgID, prefsKey, action, params );
|
||||||
|
}
|
||||||
|
|
||||||
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
protected void showNotAgainDlgThen( int msgID, int prefsKey,
|
||||||
int action )
|
int action )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue