add methods subclasses will be able to use

This commit is contained in:
Eric House 2014-04-15 20:31:29 -07:00
parent d9a407c9f3
commit 2e89b95e70
2 changed files with 40 additions and 10 deletions

View file

@ -39,6 +39,7 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
private DlgDelegate m_delegate;
private Activity m_activity;
private int m_optionsMenuID = 0;
private View m_rootView;
public DelegateBase( Activity activity, Bundle bundle )
{
@ -64,12 +65,31 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
return handled;
}
protected View setContentView( int resID )
protected Intent getIntent()
{
return m_activity.getIntent();
}
protected void setContentView( int resID )
{
m_activity.setContentView( resID );
View view = Utils.getContentView( m_activity );
LocUtils.xlateView( m_activity, view );
return view;
m_rootView = Utils.getContentView( m_activity );
LocUtils.xlateView( m_activity, m_rootView );
}
protected View findViewById( int resID )
{
return m_rootView.findViewById( resID );
}
protected void setTitle( String title )
{
m_activity.setTitle( title );
}
protected String getTitle()
{
return m_activity.getTitle().toString();
}
protected void startActivityForResult( Intent intent, int requestCode )
@ -77,6 +97,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
m_activity.startActivityForResult( intent, requestCode );
}
protected void startActivity( Intent intent )
{
m_activity.startActivity( intent );
}
protected void finish()
{
m_activity.finish();
@ -87,6 +112,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
return LocUtils.getString( m_activity, resID, params );
}
protected View inflate( int resID )
{
return LocUtils.inflate( m_activity, resID );
}
protected void showDialog( DlgID dlgID )
{
m_delegate.showDialog( dlgID );
@ -197,6 +227,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
m_delegate.showInviteChoicesThen( action );
}
protected void showOKOnlyDialogThen( String msg, Action action )
{
m_delegate.showOKOnlyDialog( msg, action );
}
protected void startProgress( int id )
{
m_delegate.startProgress( id );

View file

@ -83,7 +83,7 @@ public class NewGameDelegate extends DelegateBase {
m_groupID = m_activity.getIntent().getLongExtra( GROUPID_EXTRA, -1 );
m_rootView = setContentView( R.layout.new_game );
setContentView( R.layout.new_game );
TextView desc = (TextView)findViewById( R.id.newgame_local_desc );
m_dict = CommonPrefs.getDefaultHumanDict( m_activity );
@ -475,11 +475,6 @@ public class NewGameDelegate extends DelegateBase {
}
}
private View findViewById( int resID )
{
return m_rootView.findViewById( resID );
}
public static void startActivity( Activity parent, long groupID )
{
Intent intent = new Intent( parent, NewGameActivity.class );