From 809e96276500759b299192d046dac1f47517c947 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 9 Sep 2016 05:46:08 -0700 Subject: [PATCH] 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. --- .../src/org/eehouse/android/xw4/MainActivity.java | 10 +++++++--- .../src/org/eehouse/android/xw4/XWActivity.java | 13 ++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java index 8401acd48..036bf4052 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java @@ -1,6 +1,6 @@ /* -*- 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. * * 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_safeToCommit; private ArrayList m_runWhenSafe = new ArrayList(); + private Intent m_newIntent; // work in progress... // for tracking launchForResult callback recipients private Map> m_pendingCodes @@ -151,7 +152,7 @@ public class MainActivity extends XWActivity protected boolean dispatchNewIntent( final Intent intent ) { boolean handled; - if ( 0 == m_runWhenSafe.size() ) { + if ( m_safeToCommit ) { handled = dispatchNewIntentImpl( intent ); } else { m_runWhenSafe.add( new Runnable() { @@ -216,8 +217,11 @@ public class MainActivity extends XWActivity } 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.printStack(); + // setIntent( intent ); -- look at handling this in onPostResume()? + m_newIntent = intent; } return handled; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java index 2934ff360..f48f27eec 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java @@ -1,6 +1,7 @@ /* -*- 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 * 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(); } + @Override + protected void onPostResume() + { + if ( XWApp.LOG_LIFECYLE ) { + DbgUtils.logf( "%s.onPostResume(this=%H)", + getClass().getSimpleName(), this ); + } + super.onPostResume(); + } + @Override protected void onStart() {