fix finish() to not exit whole activity in dualpane mode

This commit is contained in:
Eric House 2016-07-13 13:35:31 -07:00
parent a7013f3ede
commit 325304d83d
2 changed files with 15 additions and 3 deletions

View file

@ -234,9 +234,16 @@ public class DelegateBase implements DlgClickNotify,
protected void finish()
{
if ( m_activity instanceof FragActivity ) {
((FragActivity)m_activity).finishFragment();
} else {
boolean handled = false;
if ( m_activity instanceof MainActivity ) {
MainActivity main = (MainActivity)m_activity;
if ( main.inDPMode() ) {
main.finishFragment();
handled = true;
}
}
if ( !handled ) {
m_activity.finish();
}
}

View file

@ -180,6 +180,11 @@ public class MainActivity extends XWActivity
addFragmentImpl( fragment, extras, this );
}
protected void finishFragment()
{
getSupportFragmentManager().popBackStack();
}
//////////////////////////////////////////////////////////////////////
// FragmentManager.OnBackStackChangedListener
//////////////////////////////////////////////////////////////////////