From ddc4ab9844079e46bed30034dccb56b6ea4ed097 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 5 Sep 2014 21:12:35 -0700 Subject: [PATCH] oops: MultiEventListener installation got dropped with the move to activity delegates; fix --- .../src/org/eehouse/android/xw4/BoardDelegate.java | 1 + .../src/org/eehouse/android/xw4/DelegateBase.java | 13 ++++++++++--- .../org/eehouse/android/xw4/DictBrowseDelegate.java | 1 + .../org/eehouse/android/xw4/GameConfigDelegate.java | 1 + .../src/org/eehouse/android/xw4/PrefsDelegate.java | 1 + .../org/eehouse/android/xw4/RelayGameDelegate.java | 1 + 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java index a81535784..70202d011 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java @@ -543,6 +543,7 @@ public class BoardDelegate extends DelegateBase m_handler = null; ConnStatusHandler.setHandler( null ); waitCloseGame( true ); + super.onPause(); } @Override diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java index 42d46a6c1..ad3e2d3f0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java @@ -74,8 +74,6 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify, public boolean onPrepareOptionsMenu( Menu menu ) { return false; } public boolean onOptionsItemSelected( MenuItem item ) { return false; } protected void onStart() {} - protected void onResume() {} - protected void onPause() {} protected void onStop() {} protected void onDestroy() {} protected void onWindowFocusChanged( boolean hasFocus ) {} @@ -84,6 +82,16 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify, protected void onActivityResult( int requestCode, int resultCode, Intent data ) {} + protected void onResume() + { + XWService.setListener( this ); + } + + protected void onPause() + { + XWService.setListener( null ); + } + public boolean onCreateOptionsMenu( Menu menu, MenuInflater inflater ) { boolean handled = 0 < m_optionsMenuID; @@ -436,5 +444,4 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify, { Assert.fail(); } - } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java index 2e958cad3..809ef8aec 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java @@ -235,6 +235,7 @@ public class DictBrowseDelegate extends ListDelegateBase DBUtils.dictsSetOffset( m_activity, m_name, m_loc, m_browseState ); m_browseState = null; } + super.onPause(); } @Override diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java index 05c3d5ce0..4f35019b0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java @@ -446,6 +446,7 @@ public class GameConfigDelegate extends DelegateBase m_gameLock = null; } m_giOrig = null; // flag for onStart and onResume + super.onPause(); } protected void onSaveInstanceState( Bundle outState ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java index 288d842af..dffaa7fae 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java @@ -166,6 +166,7 @@ public class PrefsDelegate extends DelegateBase protected void onPause() { getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); + super.onPause(); } @Override diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameDelegate.java index 15b46b74e..1f7b841bf 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameDelegate.java @@ -97,6 +97,7 @@ public class RelayGameDelegate extends DelegateBase m_gameLock.unlock(); m_gameLock = null; } + super.onPause(); } public void onClick( View view )