mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-09 22:00:39 +01:00
Toward launching fragment for result. Fires an assert on returning
since that's not done yet.
This commit is contained in:
parent
b68775b620
commit
f6cbe2ec61
4 changed files with 30 additions and 9 deletions
|
@ -207,7 +207,11 @@ public class DelegateBase implements DlgClickNotify,
|
|||
|
||||
protected void setResult( int result, Intent intent )
|
||||
{
|
||||
m_activity.setResult( result, intent );
|
||||
if ( m_activity instanceof FragActivity ) {
|
||||
Assert.fail();
|
||||
} else {
|
||||
m_activity.setResult( result, intent );
|
||||
}
|
||||
}
|
||||
|
||||
protected void setResult( int result )
|
||||
|
|
|
@ -300,4 +300,10 @@ public class FragActivity extends FragmentActivity
|
|||
{
|
||||
getThis().addFragmentImpl( fragment, bundle, parent );
|
||||
}
|
||||
|
||||
public static void addFragmentForResult( Fragment fragment, Bundle bundle,
|
||||
RequestCode requestCode, Delegator parent )
|
||||
{
|
||||
getThis().addFragmentImpl( fragment, bundle, parent );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1196,14 +1196,24 @@ public class GameConfigDelegate extends DelegateBase
|
|||
return DeviceRole.SERVER_STANDALONE == m_giOrig.serverRole;
|
||||
}
|
||||
|
||||
public static void editForResult( Activity parent, RequestCode requestCode,
|
||||
public static void editForResult( Delegator delegator,
|
||||
RequestCode requestCode,
|
||||
long rowID )
|
||||
{
|
||||
Intent intent = new Intent( parent, GameConfigActivity.class );
|
||||
intent.setAction( Intent.ACTION_EDIT );
|
||||
intent.putExtra( GameUtils.INTENT_KEY_ROWID, rowID );
|
||||
intent.putExtra( INTENT_FORRESULT_ROWID, true );
|
||||
parent.startActivityForResult( intent, requestCode.ordinal() );
|
||||
Activity activity = delegator.getActivity();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong( GameUtils.INTENT_KEY_ROWID, rowID );
|
||||
bundle.putBoolean( INTENT_FORRESULT_ROWID, true );
|
||||
|
||||
if ( activity instanceof FragActivity ) {
|
||||
FragActivity.addFragmentForResult( new GameConfigFrag(), bundle,
|
||||
requestCode, delegator );
|
||||
} else {
|
||||
Intent intent = new Intent( activity, GameConfigActivity.class );
|
||||
intent.setAction( Intent.ACTION_EDIT );
|
||||
intent.putExtras( bundle );
|
||||
activity.startActivityForResult( intent, requestCode.ordinal() );
|
||||
}
|
||||
}
|
||||
|
||||
private void setConnLabel()
|
||||
|
|
|
@ -2483,8 +2483,9 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
|
||||
if ( doConfigure ) {
|
||||
// configure it
|
||||
GameConfigDelegate.editForResult( m_activity, RequestCode
|
||||
.CONFIG_GAME, rowID );
|
||||
GameConfigDelegate.editForResult( getDelegator(),
|
||||
RequestCode.CONFIG_GAME,
|
||||
rowID );
|
||||
} else {
|
||||
// launch it
|
||||
GameUtils.launchGame( getDelegator(), rowID );
|
||||
|
|
Loading…
Add table
Reference in a new issue