fix finish() to close a specific fragment

Rather than just pop whatever's on top of the back stack, which might be
the alert whose listener called finish(), use saved commit() ids to pop
down to the fragment itself. This feels like a risky change, and it's
tested only by back-button-dismissing the Wait alert in an unconnected
game in BoardDelegate, so needs some bake time.
This commit is contained in:
Eric House 2017-08-29 07:10:04 -07:00
parent bb4c5502c8
commit 741dbf2bed
2 changed files with 5 additions and 3 deletions

View file

@ -290,7 +290,8 @@ public class DelegateBase implements DlgClickNotify,
if ( main.inDPMode() ) {
if ( !m_finishCalled ) {
m_finishCalled = true;
main.finishFragment();
XWFragment fragment = (XWFragment)m_delegator;
main.finishFragment( fragment.getCommitID() );
}
handled = true;
}

View file

@ -298,11 +298,12 @@ public class MainActivity extends XWActivity
resultCode, data );
}
protected void finishFragment()
protected void finishFragment( int commitID )
{
// Assert.assertTrue( fragment instanceof XWFragment );
// Log.d( TAG, "finishFragment()" );
getSupportFragmentManager().popBackStack/*Immediate*/();
getSupportFragmentManager()
.popBackStack( commitID, FragmentManager.POP_BACK_STACK_INCLUSIVE );
}
//////////////////////////////////////////////////////////////////////