put some of DlgDelegate's methods into an interface that can be passed around to be called by non-activities.

This commit is contained in:
Eric House 2014-01-30 19:14:23 -08:00
parent 647282968a
commit 9dc94c97b2
3 changed files with 12 additions and 6 deletions

View file

@ -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;

View file

@ -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 );
}

View file

@ -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 );
}