mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
add and use a showDialog() that takes a DlgID
This commit is contained in:
parent
e0c0ff219f
commit
8084e63d09
4 changed files with 28 additions and 20 deletions
|
@ -36,6 +36,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify {
|
|||
m_delegate = new DlgDelegate( activity, this, bundle );
|
||||
}
|
||||
|
||||
protected void showDialog( DlgID dlgID )
|
||||
{
|
||||
m_delegate.showDialog( dlgID );
|
||||
}
|
||||
|
||||
protected Dialog createDialog( int id )
|
||||
{
|
||||
return m_delegate.createDialog( id );
|
||||
|
|
|
@ -402,7 +402,7 @@ public class DictsDelegate extends DelegateBase
|
|||
Intent intent = m_activity.getIntent();
|
||||
if ( null != intent ) {
|
||||
if ( MultiService.isMissingDictIntent( intent ) ) {
|
||||
m_activity.showDialog( DlgID.DICT_OR_DECLINE.ordinal() );
|
||||
showDialog( DlgID.DICT_OR_DECLINE );
|
||||
} else {
|
||||
boolean downloadNow = intent.getBooleanExtra( DICT_DOLAUNCH, false );
|
||||
if ( downloadNow ) {
|
||||
|
@ -487,10 +487,10 @@ public class DictsDelegate extends DelegateBase
|
|||
deleteSelected();
|
||||
break;
|
||||
case R.id.dicts_move:
|
||||
askMoveSelDicts();
|
||||
showDialog( DlgID.MOVE_DICT );
|
||||
break;
|
||||
case R.id.dicts_select:
|
||||
m_activity.showDialog( DlgID.SET_DEFAULT.ordinal() );
|
||||
showDialog( DlgID.SET_DEFAULT );
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
|
@ -521,15 +521,9 @@ public class DictsDelegate extends DelegateBase
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
// Move dict. Put up dialog asking user to confirm move from XX
|
||||
// to YY. So we need both XX and YY. There may be several
|
||||
// options for YY?
|
||||
private void askMoveSelDicts()
|
||||
{
|
||||
m_activity.showDialog( DlgID.MOVE_DICT.ordinal() );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// OnItemLongClickListener interface
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public boolean onItemLongClick( AdapterView<?> parent, View view,
|
||||
int position, long id ) {
|
||||
boolean success = view instanceof SelectableItem.LongClickHandler;
|
||||
|
@ -597,7 +591,9 @@ public class DictsDelegate extends DelegateBase
|
|||
(Object)items );
|
||||
} // deleteSelected
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// MountEventReceiver.SDCardNotifiee interface
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public void cardMounted( boolean nowMounted )
|
||||
{
|
||||
DbgUtils.logf( "DictsActivity.cardMounted(%b)", nowMounted );
|
||||
|
@ -611,7 +607,9 @@ public class DictsDelegate extends DelegateBase
|
|||
} );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public void dlgButtonClicked( Action action, int which, Object[] params )
|
||||
{
|
||||
switch( action ) {
|
||||
|
|
|
@ -154,6 +154,11 @@ public class DlgDelegate {
|
|||
}
|
||||
outState.putIntArray( IDS, ids );
|
||||
}
|
||||
|
||||
protected void showDialog( DlgID dlgID )
|
||||
{
|
||||
m_activity.showDialog( dlgID.ordinal() );
|
||||
}
|
||||
|
||||
public Dialog createDialog( int id )
|
||||
{
|
||||
|
|
|
@ -182,7 +182,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
if ( DlgID.WARN_NODICT_SUBST == dlgID ) {
|
||||
lstnr = new DialogInterface.OnClickListener() {
|
||||
public void onClick( DialogInterface dlg, int item ) {
|
||||
m_activity.showDialog( DlgID.SHOW_SUBST.ordinal() );
|
||||
showDialog( DlgID.SHOW_SUBST );
|
||||
}
|
||||
};
|
||||
ab.setNeutralButton( R.string.button_substdict, lstnr );
|
||||
|
@ -733,7 +733,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
break;
|
||||
|
||||
case R.id.games_menu_newgroup:
|
||||
m_activity.showDialog( DlgID.NEW_GROUP.ordinal() );
|
||||
showDialog( DlgID.NEW_GROUP );
|
||||
break;
|
||||
|
||||
case R.id.games_game_config:
|
||||
|
@ -803,7 +803,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
showOKOnlyDialog( R.string.no_move_onegroup );
|
||||
} else {
|
||||
m_rowids = selRowIDs;
|
||||
m_activity.showDialog( DlgID.CHANGE_GROUP.ordinal() );
|
||||
showDialog( DlgID.CHANGE_GROUP );
|
||||
}
|
||||
break;
|
||||
case R.id.games_game_new_from:
|
||||
|
@ -844,7 +844,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
|
||||
case R.id.games_game_rename:
|
||||
m_rowid = selRowIDs[0];
|
||||
m_activity.showDialog( DlgID.RENAME_GAME.ordinal() );
|
||||
showDialog( DlgID.RENAME_GAME );
|
||||
break;
|
||||
|
||||
// Group menus
|
||||
|
@ -876,7 +876,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
break;
|
||||
case R.id.games_group_rename:
|
||||
m_groupid = groupID;
|
||||
m_activity.showDialog( DlgID.RENAME_GROUP.ordinal() );
|
||||
showDialog( DlgID.RENAME_GROUP );
|
||||
break;
|
||||
case R.id.games_group_moveup:
|
||||
changeContent = m_adapter.moveGroup( groupID, -1 );
|
||||
|
@ -958,7 +958,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
m_netLaunchInfo = nli;
|
||||
m_missingDictLang = nli.lang;
|
||||
m_missingDictName = nli.dict;
|
||||
m_activity.showDialog( DlgID.WARN_NODICT_NEW.ordinal() );
|
||||
showDialog( DlgID.WARN_NODICT_NEW );
|
||||
}
|
||||
return haveDict;
|
||||
}
|
||||
|
@ -978,9 +978,9 @@ public class GamesListDelegate extends DelegateBase
|
|||
}
|
||||
m_missingDictRowId = rowid;
|
||||
if ( 0 == DictLangCache.getLangCount( m_activity, m_missingDictLang ) ) {
|
||||
m_activity.showDialog( DlgID.WARN_NODICT.ordinal() );
|
||||
showDialog( DlgID.WARN_NODICT );
|
||||
} else if ( null != m_missingDictName ) {
|
||||
m_activity.showDialog( DlgID.WARN_NODICT_SUBST.ordinal() );
|
||||
showDialog( DlgID.WARN_NODICT_SUBST );
|
||||
} else {
|
||||
String dict =
|
||||
DictLangCache.getHaveLang( m_activity, m_missingDictLang)[0];
|
||||
|
@ -1146,7 +1146,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
if ( null == CommonPrefs.getDefaultPlayerName( m_activity, 0, false ) ) {
|
||||
String name = CommonPrefs.getDefaultPlayerName( m_activity, 0, true );
|
||||
CommonPrefs.setDefaultPlayerName( m_activity, name );
|
||||
m_activity.showDialog( DlgID.GET_NAME.ordinal() );
|
||||
showDialog( DlgID.GET_NAME );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue