mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
dispatch backPressed to the right-most fragment before, if still
unhandled, letting super interpret it as a pop-fragment action.
This commit is contained in:
parent
4fc2dd97b3
commit
54e5e61e4d
10 changed files with 33 additions and 9 deletions
|
@ -87,7 +87,7 @@ public class DelegateBase implements DlgClickNotify,
|
||||||
protected void onStop() {}
|
protected void onStop() {}
|
||||||
protected void onDestroy() {}
|
protected void onDestroy() {}
|
||||||
protected void onWindowFocusChanged( boolean hasFocus ) {}
|
protected void onWindowFocusChanged( boolean hasFocus ) {}
|
||||||
protected boolean onBackPressed() { return false; }
|
protected boolean handleBackPressed() { return false; }
|
||||||
public void orientationChanged() {}
|
public void orientationChanged() {}
|
||||||
|
|
||||||
protected void requestWindowFeature( int feature ) {}
|
protected void requestWindowFeature( int feature ) {}
|
||||||
|
|
|
@ -571,7 +571,8 @@ public class DictsDelegate extends ListDelegateBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onBackPressed()
|
@Override
|
||||||
|
protected boolean handleBackPressed()
|
||||||
{
|
{
|
||||||
boolean handled = 0 < m_selDicts.size();
|
boolean handled = 0 < m_selDicts.size();
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
|
|
|
@ -59,4 +59,13 @@ public class DualpaneDelegate extends DelegateBase {
|
||||||
DbgUtils.logf( "DualpaneDelegate.handleNewIntent() => %b", handled );
|
DbgUtils.logf( "DualpaneDelegate.handleNewIntent() => %b", handled );
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean handleBackPressed()
|
||||||
|
{
|
||||||
|
MainActivity main = (MainActivity)m_activity;
|
||||||
|
boolean handled = main.dispatchBackPressed();
|
||||||
|
DbgUtils.logf( "DualpaneDelegate.handleBackPressed() => %b", handled );
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class DwnldDelegate extends ListDelegateBase {
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBackPressed()
|
protected boolean handleBackPressed()
|
||||||
{
|
{
|
||||||
// cancel any tasks that remain
|
// cancel any tasks that remain
|
||||||
for ( Iterator<DownloadFilesTask> iter = m_dfts.iterator();
|
for ( Iterator<DownloadFilesTask> iter = m_dfts.iterator();
|
||||||
|
@ -315,7 +315,7 @@ public class DwnldDelegate extends ListDelegateBase {
|
||||||
DownloadFilesTask dft = iter.next();
|
DownloadFilesTask dft = iter.next();
|
||||||
dft.cancel( true );
|
dft.cancel( true );
|
||||||
}
|
}
|
||||||
return super.onBackPressed();
|
return super.handleBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mkListAdapter()
|
private void mkListAdapter()
|
||||||
|
|
|
@ -755,7 +755,7 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
} // onClick
|
} // onClick
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBackPressed()
|
protected boolean handleBackPressed()
|
||||||
{
|
{
|
||||||
boolean consumed = false;
|
boolean consumed = false;
|
||||||
if ( ! isFinishing() ) {
|
if ( ! isFinishing() ) {
|
||||||
|
|
|
@ -1303,7 +1303,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBackPressed()
|
protected boolean handleBackPressed()
|
||||||
{
|
{
|
||||||
boolean handled = 0 < m_selGames.size() || 0 < m_selGroupIDs.size();
|
boolean handled = 0 < m_selGames.size() || 0 < m_selGroupIDs.size();
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
|
|
|
@ -145,6 +145,19 @@ public class MainActivity extends XWActivity
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The right-most pane only gets a chance to handle on-back-pressed.
|
||||||
|
*/
|
||||||
|
protected boolean dispatchBackPressed()
|
||||||
|
{
|
||||||
|
View child = m_root.getChildAt( m_root.getChildCount() - 1 );
|
||||||
|
Fragment frag = getSupportFragmentManager()
|
||||||
|
.findFragmentById( child.getId() );
|
||||||
|
boolean handled = ((XWFragment)frag).getDelegate()
|
||||||
|
.handleBackPressed();
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Delegator interface
|
// Delegator interface
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class StudyListDelegate extends ListDelegateBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBackPressed()
|
protected boolean handleBackPressed()
|
||||||
{
|
{
|
||||||
boolean handled = 0 < m_checkeds.size();
|
boolean handled = 0 < m_checkeds.size();
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class XWActivity extends FragmentActivity implements Delegator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if ( !m_dlgt.onBackPressed() ) {
|
if ( !m_dlgt.handleBackPressed() ) {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class LocDelegate extends ListDelegateBase
|
||||||
m_activity = delegator.getActivity();
|
m_activity = delegator.getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onBackPressed()
|
@Override
|
||||||
|
protected boolean handleBackPressed()
|
||||||
{
|
{
|
||||||
LocUtils.saveLocalData( m_activity );
|
LocUtils.saveLocalData( m_activity );
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue