mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
tweak to intent handling
Change logic to always handle intent when it's safe to commit transactions rather than when there aren't any pending. This still needs work.
This commit is contained in:
parent
95d147d9c3
commit
809e962765
2 changed files with 19 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2009 - 2014 by Eric House (xwords@eehouse.org). All
|
* Copyright 2009 - 2016 by Eric House (xwords@eehouse.org). All
|
||||||
* rights reserved.
|
* rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -56,6 +56,7 @@ public class MainActivity extends XWActivity
|
||||||
private Boolean m_isPortrait;
|
private Boolean m_isPortrait;
|
||||||
private boolean m_safeToCommit;
|
private boolean m_safeToCommit;
|
||||||
private ArrayList<Runnable> m_runWhenSafe = new ArrayList<Runnable>();
|
private ArrayList<Runnable> m_runWhenSafe = new ArrayList<Runnable>();
|
||||||
|
private Intent m_newIntent; // work in progress...
|
||||||
|
|
||||||
// for tracking launchForResult callback recipients
|
// for tracking launchForResult callback recipients
|
||||||
private Map<RequestCode, WeakReference<DelegateBase>> m_pendingCodes
|
private Map<RequestCode, WeakReference<DelegateBase>> m_pendingCodes
|
||||||
|
@ -151,7 +152,7 @@ public class MainActivity extends XWActivity
|
||||||
protected boolean dispatchNewIntent( final Intent intent )
|
protected boolean dispatchNewIntent( final Intent intent )
|
||||||
{
|
{
|
||||||
boolean handled;
|
boolean handled;
|
||||||
if ( 0 == m_runWhenSafe.size() ) {
|
if ( m_safeToCommit ) {
|
||||||
handled = dispatchNewIntentImpl( intent );
|
handled = dispatchNewIntentImpl( intent );
|
||||||
} else {
|
} else {
|
||||||
m_runWhenSafe.add( new Runnable() {
|
m_runWhenSafe.add( new Runnable() {
|
||||||
|
@ -216,8 +217,11 @@ public class MainActivity extends XWActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( BuildConfig.DEBUG && !handled ) {
|
if ( BuildConfig.DEBUG && !handled ) {
|
||||||
DbgUtils.showf( this, "dropping intent %s", intent.toString() );
|
// DbgUtils.showf( this, "dropping intent %s", intent.toString() );
|
||||||
DbgUtils.logdf( "dropping intent %s", intent.toString() );
|
DbgUtils.logdf( "dropping intent %s", intent.toString() );
|
||||||
|
// DbgUtils.printStack();
|
||||||
|
// setIntent( intent ); -- look at handling this in onPostResume()?
|
||||||
|
m_newIntent = intent;
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2014 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2014-2016 by Eric House (xwords@eehouse.org). All rights
|
||||||
|
* reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
@ -85,6 +86,16 @@ public class XWActivity extends FragmentActivity implements Delegator {
|
||||||
m_dlgt.onResume();
|
m_dlgt.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostResume()
|
||||||
|
{
|
||||||
|
if ( XWApp.LOG_LIFECYLE ) {
|
||||||
|
DbgUtils.logf( "%s.onPostResume(this=%H)",
|
||||||
|
getClass().getSimpleName(), this );
|
||||||
|
}
|
||||||
|
super.onPostResume();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
protected void onStart()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue