cleanup: private method to reduce number of params required

This commit is contained in:
Eric House 2014-09-21 21:54:00 -07:00
parent c5b948b464
commit 73e5f946b2

View file

@ -218,8 +218,7 @@ public class DlgDelegate {
public void showOKOnlyDialog( int msgID ) public void showOKOnlyDialog( int msgID )
{ {
showOKOnlyDialog( LocUtils.getString( m_activity, msgID ), showOKOnlyDialog( getString( msgID ), Action.SKIP_CALLBACK );
Action.SKIP_CALLBACK );
} }
public void showDictGoneFinish() public void showDictGoneFinish()
@ -236,8 +235,7 @@ public class DlgDelegate {
final Action action, final Action action,
final Object[] params ) final Object[] params )
{ {
showNotAgainDlgThen( LocUtils.getString( m_activity, msgID ), prefsKey, showNotAgainDlgThen( getString( msgID ), prefsKey, action, params );
action, params );
} }
public void showNotAgainDlgThen( String msg, int prefsKey, public void showNotAgainDlgThen( String msg, int prefsKey,
@ -284,8 +282,7 @@ public class DlgDelegate {
public void showConfirmThen( int msgID, Action action ) public void showConfirmThen( int msgID, Action action )
{ {
showConfirmThen( LocUtils.getString( m_activity, msgID ), showConfirmThen( getString( msgID ), R.string.button_ok, action, null );
R.string.button_ok, action, null );
} }
public void showConfirmThen( String msg, Action action, Object[] params ) public void showConfirmThen( String msg, Action action, Object[] params )
@ -301,8 +298,7 @@ public class DlgDelegate {
public void showConfirmThen( int msg, int posButton, Action action, public void showConfirmThen( int msg, int posButton, Action action,
Object[] params ) Object[] params )
{ {
showConfirmThen( LocUtils.getString( m_activity, msg ), posButton, action, showConfirmThen( getString( msg ), posButton, action, params );
params );
} }
public void showConfirmThen( String msg, int posButton, Action action, public void showConfirmThen( String msg, int posButton, Action action,
@ -359,12 +355,12 @@ public class DlgDelegate {
public void startProgress( int titleID, int msgID, OnCancelListener canLstnr ) public void startProgress( int titleID, int msgID, OnCancelListener canLstnr )
{ {
startProgress( titleID, LocUtils.getString( m_activity, msgID ), canLstnr ); startProgress( titleID, getString( msgID ), canLstnr );
} }
public void startProgress( int titleID, String msg, OnCancelListener canLstnr ) public void startProgress( int titleID, String msg, OnCancelListener canLstnr )
{ {
String title = LocUtils.getString( m_activity, titleID ); String title = getString( titleID );
m_progress = ProgressDialog.show( m_activity, title, msg, true, true ); m_progress = ProgressDialog.show( m_activity, title, msg, true, true );
if ( null != canLstnr ) { if ( null != canLstnr ) {
@ -375,7 +371,7 @@ public class DlgDelegate {
public void setProgressMsg( int id ) public void setProgressMsg( int id )
{ {
m_progress.setMessage( LocUtils.getString( m_activity, id ) ); m_progress.setMessage( getString( id ) );
} }
public void stopProgress() public void stopProgress()
@ -399,17 +395,14 @@ public class DlgDelegate {
boolean asToast = true; boolean asToast = true;
switch( event ) { switch( event ) {
case BAD_PROTO: case BAD_PROTO:
msg = LocUtils.getString( m_activity, R.string.bt_bad_proto_fmt, msg = getString( R.string.bt_bad_proto_fmt, (String)args[0] );
(String)args[0] );
break; break;
case MESSAGE_RESEND: case MESSAGE_RESEND:
msg = LocUtils.getString( m_activity, R.string.bt_resend_fmt, msg = getString( R.string.bt_resend_fmt, (String)args[0],
(String)args[0], (Long)args[1], (Long)args[1], (Integer)args[2] );
(Integer)args[2] );
break; break;
case MESSAGE_FAILOUT: case MESSAGE_FAILOUT:
msg = LocUtils.getString( m_activity, R.string.bt_fail_fmt, msg = getString( R.string.bt_fail_fmt, (String)args[0] );
(String)args[0] );
asToast = false; asToast = false;
break; break;
case RELAY_ALERT: case RELAY_ALERT:
@ -440,15 +433,13 @@ public class DlgDelegate {
{ {
final View view = LocUtils.inflate( m_activity, R.layout.about_dlg ); final View view = LocUtils.inflate( m_activity, R.layout.about_dlg );
TextView vers = (TextView)view.findViewById( R.id.version_string ); TextView vers = (TextView)view.findViewById( R.id.version_string );
vers.setText( String.format( LocUtils.getString( m_activity, vers.setText( String.format( getString( R.string.about_vers_fmt ),
R.string.about_vers_fmt ), getString( R.string.app_version ),
LocUtils.getString( m_activity,
R.string.app_version ),
BuildConstants.GIT_REV, BuildConstants.GIT_REV,
BuildConstants.BUILD_STAMP ) ); BuildConstants.BUILD_STAMP ) );
TextView xlator = (TextView)view.findViewById( R.id.about_xlator ); TextView xlator = (TextView)view.findViewById( R.id.about_xlator );
String str = LocUtils.getString( m_activity, R.string.xlator ); String str = getString( R.string.xlator );
if ( str.length() > 0 ) { if ( str.length() > 0 ) {
xlator.setText( str ); xlator.setText( str );
} else { } else {
@ -649,4 +640,13 @@ public class DlgDelegate {
m_dlgStates.put( state.m_id, state ); m_dlgStates.put( state.m_id, state );
} }
private String getString( int id )
{
return LocUtils.getString( m_activity, id );
}
private String getString( int id, Object... params )
{
return LocUtils.getString( m_activity, id, params );
}
} }