From 9dc94c97b2cebdcfb9f6f8468309fc0f45cca633 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 30 Jan 2014 19:14:23 -0800 Subject: [PATCH] put some of DlgDelegate's methods into an interface that can be passed around to be called by non-activities. --- .../XWords4/src/org/eehouse/android/xw4/DlgDelegate.java | 4 ++++ .../XWords4/src/org/eehouse/android/xw4/XWActivity.java | 7 ++++--- .../org/eehouse/android/xw4/XWExpandableListActivity.java | 7 ++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java index 096256408..11e6f7505 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java @@ -59,6 +59,10 @@ public class DlgDelegate { public interface DlgClickNotify { void dlgButtonClicked( int id, int button, Object[] params ); } + public interface HasDlgDelegate { + void showOKOnlyDialog( int msgID ); + void showOKOnlyDialog( String msg ); + } private Activity m_activity; private DlgClickNotify m_clickCallback; 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 96a9ffc05..3e5d2dee9 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java @@ -31,7 +31,8 @@ import android.widget.TextView; import junit.framework.Assert; public class XWActivity extends Activity - implements DlgDelegate.DlgClickNotify, MultiService.MultiEventListener { + implements DlgDelegate.DlgClickNotify, DlgDelegate.HasDlgDelegate, + MultiService.MultiEventListener { private DlgDelegate m_delegate; @@ -123,12 +124,12 @@ public class XWActivity extends Activity m_delegate.showNotAgainDlgThen( msgID, prefsKey ); } - protected void showOKOnlyDialog( int msgID ) + public void showOKOnlyDialog( int msgID ) { m_delegate.showOKOnlyDialog( msgID ); } - protected void showOKOnlyDialog( String msg ) + public void showOKOnlyDialog( String msg ) { m_delegate.showOKOnlyDialog( msg ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java index 1d2e82728..49e3d0eb4 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpandableListActivity.java @@ -29,7 +29,8 @@ import junit.framework.Assert; public class XWExpandableListActivity extends ExpandableListActivity - implements DlgDelegate.DlgClickNotify, MultiService.MultiEventListener { + implements DlgDelegate.DlgClickNotify, DlgDelegate.HasDlgDelegate, + MultiService.MultiEventListener { private DlgDelegate m_delegate; @@ -107,12 +108,12 @@ public class XWExpandableListActivity extends ExpandableListActivity m_delegate.showAboutDialog(); } - protected void showOKOnlyDialog( int msgID ) + public void showOKOnlyDialog( int msgID ) { m_delegate.showOKOnlyDialog( msgID ); } - protected void showOKOnlyDialog( String msg ) + public void showOKOnlyDialog( String msg ) { m_delegate.showOKOnlyDialog( msg ); }