mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
make alert builders take varargs to simplify calling
Required making the string res id the last arg rather than first, but let me clean up a bunch of code. Should be no behavior change at all.
This commit is contained in:
parent
c00bbf8ef1
commit
11ea30c882
23 changed files with 179 additions and 202 deletions
|
@ -52,7 +52,7 @@ public class BTCheckBoxPreference extends ConfirmingCheckBoxPreference {
|
|||
msg += LocUtils.getQuantityString( activity, R.plurals.warn_bt_games_fmt,
|
||||
count, count );
|
||||
}
|
||||
activity.makeConfirmThenBuilder( msg, Action.DISABLE_BT_DO )
|
||||
activity.makeConfirmThenBuilder( Action.DISABLE_BT_DO, msg )
|
||||
.setPosButton( R.string.button_disable_bt )
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ public class BTInviteDelegate extends InviteDelegate
|
|||
String msg = getQuantityString( R.plurals.confirm_clear_bt_fmt,
|
||||
count, count )
|
||||
+ getString( R.string.confirm_clear_bt_postscript );
|
||||
makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show();
|
||||
makeConfirmThenBuilder( Action.CLEAR_ACTION, msg ).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -272,8 +272,8 @@ public class BTInviteDelegate extends InviteDelegate
|
|||
hideProgress();
|
||||
|
||||
if ( sPersistedRef[0].empty() || 0 == mNDevsThisScan ) {
|
||||
makeNotAgainBuilder( R.string.not_again_emptybtscan,
|
||||
R.string.key_notagain_emptybtscan )
|
||||
makeNotAgainBuilder( R.string.key_notagain_emptybtscan,
|
||||
R.string.not_again_emptybtscan )
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
@ -291,8 +291,8 @@ public class BTInviteDelegate extends InviteDelegate
|
|||
mNDevsThisScan = 0;
|
||||
showProgress( count, 2 * SCAN_SECONDS );
|
||||
} else {
|
||||
makeConfirmThenBuilder( R.string.bt_no_devs,
|
||||
Action.OPEN_BT_PREFS_ACTION )
|
||||
makeConfirmThenBuilder( Action.OPEN_BT_PREFS_ACTION,
|
||||
R.string.bt_no_devs )
|
||||
.setPosButton( R.string.button_go_settings )
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -1015,7 +1015,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
|||
activity.runOnUiThread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
activity.makeNotAgainBuilder( msgID, keyID )
|
||||
activity.makeNotAgainBuilder( keyID, msgID )
|
||||
.show();
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -352,9 +352,9 @@ public class BoardDelegate extends DelegateBase
|
|||
@Override
|
||||
public void onClick( DialogInterface dialog,
|
||||
int whichButton ) {
|
||||
makeNotAgainBuilder( R.string.not_again_lookup,
|
||||
R.string.key_na_lookup,
|
||||
Action.LOOKUP_ACTION )
|
||||
makeNotAgainBuilder( R.string.key_na_lookup,
|
||||
Action.LOOKUP_ACTION,
|
||||
R.string.not_again_lookup )
|
||||
.show();
|
||||
}
|
||||
};
|
||||
|
@ -553,10 +553,9 @@ public class BoardDelegate extends DelegateBase
|
|||
s_themeNAShown = true;
|
||||
if ( CommonPrefs.darkThemeEnabled( m_activity ) ) {
|
||||
String prefsName = LocUtils.getString( m_activity, R.string.theme_which );
|
||||
String msg = LocUtils
|
||||
.getString( m_activity, R.string.not_again_boardThemes_fmt,
|
||||
prefsName );
|
||||
makeNotAgainBuilder( msg, R.string.key_na_boardThemes )
|
||||
makeNotAgainBuilder( R.string.key_na_boardThemes,
|
||||
R.string.not_again_boardThemes_fmt,
|
||||
prefsName )
|
||||
.setTitle( R.string. new_feature_title )
|
||||
.setActionPair( Action.LAUNCH_THEME_CONFIG, R.string.button_settings )
|
||||
.show();
|
||||
|
@ -872,9 +871,8 @@ public class BoardDelegate extends DelegateBase
|
|||
int nTiles = XwJNI.model_getNumTilesInTray( m_jniGamePtr,
|
||||
m_view.getCurPlayer() );
|
||||
if ( m_gi.traySize > nTiles ) {
|
||||
makeNotAgainBuilder( R.string.not_again_done,
|
||||
R.string.key_notagain_done,
|
||||
Action.COMMIT_ACTION )
|
||||
makeNotAgainBuilder( R.string.key_notagain_done,
|
||||
Action.COMMIT_ACTION, R.string.not_again_done )
|
||||
.show();
|
||||
} else {
|
||||
onPosButton( Action.COMMIT_ACTION, null );
|
||||
|
@ -917,8 +915,8 @@ public class BoardDelegate extends DelegateBase
|
|||
int strID = ABUtils.haveActionBar() ? R.string.not_again_trading_menu
|
||||
: R.string.not_again_trading_buttons;
|
||||
msg += getString( strID );
|
||||
makeNotAgainBuilder( msg, R.string.key_notagain_trading,
|
||||
Action.START_TRADE_ACTION )
|
||||
makeNotAgainBuilder( R.string.key_notagain_trading,
|
||||
Action.START_TRADE_ACTION, msg )
|
||||
.show();
|
||||
break;
|
||||
|
||||
|
@ -939,7 +937,8 @@ public class BoardDelegate extends DelegateBase
|
|||
cmd = JNICmd.CMD_UNDO_CUR;
|
||||
break;
|
||||
case R.id.board_menu_undo_last:
|
||||
makeConfirmThenBuilder( R.string.confirm_undo_last, Action.UNDO_LAST_ACTION )
|
||||
makeConfirmThenBuilder( Action.UNDO_LAST_ACTION,
|
||||
R.string.confirm_undo_last )
|
||||
.show();
|
||||
break;
|
||||
|
||||
|
@ -1133,8 +1132,8 @@ public class BoardDelegate extends DelegateBase
|
|||
if ( 0 < params.length && (Boolean)params[0] ) {
|
||||
deleteAndClose();
|
||||
} else {
|
||||
makeConfirmThenBuilder( R.string.confirm_delete,
|
||||
Action.DELETE_ACTION )
|
||||
makeConfirmThenBuilder( Action.DELETE_ACTION,
|
||||
R.string.confirm_delete )
|
||||
.setParams(true)
|
||||
.show();
|
||||
}
|
||||
|
@ -1371,12 +1370,12 @@ public class BoardDelegate extends DelegateBase
|
|||
break;
|
||||
case NEWGAME_DUP_REJECTED:
|
||||
doStopProgress = true;
|
||||
final String msg =
|
||||
getString( R.string.err_dup_invite_fmt, (String)args[0] );
|
||||
post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
makeOkOnlyBuilder( msg ).show();
|
||||
makeOkOnlyBuilder( R.string.err_dup_invite_fmt,
|
||||
(String)args[0] )
|
||||
.show();
|
||||
}
|
||||
} );
|
||||
break;
|
||||
|
@ -1626,7 +1625,7 @@ public class BoardDelegate extends DelegateBase
|
|||
if ( m_connTypes.contains(CommsConnType.COMMS_CONN_SMS) ) {
|
||||
msg += " " + getString( R.string.confirm_drop_relay_sms );
|
||||
}
|
||||
makeConfirmThenBuilder( msg, Action.DROP_MQTT_ACTION ).show();
|
||||
makeConfirmThenBuilder( Action.DROP_MQTT_ACTION, msg ).show();
|
||||
}
|
||||
|
||||
private void dropConViaAndRestart( CommsConnType typ )
|
||||
|
@ -1759,10 +1758,8 @@ public class BoardDelegate extends DelegateBase
|
|||
@Override
|
||||
public void run() {
|
||||
String fmtd = TextUtils.join( ", ", wordsToArray( words ) );
|
||||
String msg = LocUtils
|
||||
.getString( m_activity, R.string.word_blocked_by_phony,
|
||||
fmtd, dict );
|
||||
makeOkOnlyBuilder( msg ).show();
|
||||
makeOkOnlyBuilder( R.string.word_blocked_by_phony, fmtd, dict )
|
||||
.show();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -1880,8 +1877,8 @@ public class BoardDelegate extends DelegateBase
|
|||
post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
makeNotAgainBuilder( R.string.not_again_turnchanged,
|
||||
R.string.key_notagain_turnchanged )
|
||||
makeNotAgainBuilder( R.string.key_notagain_turnchanged,
|
||||
R.string.not_again_turnchanged )
|
||||
.show();
|
||||
}
|
||||
} );
|
||||
|
@ -1921,7 +1918,7 @@ public class BoardDelegate extends DelegateBase
|
|||
runOnUiThread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
makeNotAgainBuilder( msg, key )
|
||||
makeNotAgainBuilder( key, msg )
|
||||
.show();
|
||||
}
|
||||
} );
|
||||
|
@ -2389,7 +2386,7 @@ public class BoardDelegate extends DelegateBase
|
|||
int explID = banned
|
||||
? R.string.banned_nbs_perms : R.string.missing_sms_perms;
|
||||
DlgDelegate.Builder builder =
|
||||
makeConfirmThenBuilder( explID, Action.DROP_SMS_ACTION );
|
||||
makeConfirmThenBuilder( Action.DROP_SMS_ACTION, explID );
|
||||
if ( banned ) {
|
||||
builder.setActionPair( Action.PERMS_BANNED_INFO,
|
||||
R.string.button_more_info )
|
||||
|
@ -2637,8 +2634,8 @@ public class BoardDelegate extends DelegateBase
|
|||
if ( null != m_connTypes && alertOrderAt( StartAlertOrder.NO_MEANS ) ) {
|
||||
if ( m_connTypes.contains( CommsConnType.COMMS_CONN_SMS ) ) {
|
||||
if ( !XWPrefs.getNBSEnabled( m_activity ) ) {
|
||||
makeConfirmThenBuilder( R.string.warn_sms_disabled,
|
||||
Action.ENABLE_NBS_ASK )
|
||||
makeConfirmThenBuilder( Action.ENABLE_NBS_ASK,
|
||||
R.string.warn_sms_disabled )
|
||||
.setPosButton( R.string.button_enable_sms )
|
||||
.setNegButton( R.string.button_later )
|
||||
.show();
|
||||
|
@ -2653,7 +2650,7 @@ public class BoardDelegate extends DelegateBase
|
|||
m_dropMQTTOnDismiss = false;
|
||||
String msg = getString( R.string.warn_mqtt_disabled )
|
||||
+ "\n\n" + getString( R.string.warn_mqtt_remove );
|
||||
makeConfirmThenBuilder( msg, Action.ENABLE_MQTT_DO_OR )
|
||||
makeConfirmThenBuilder( Action.ENABLE_MQTT_DO_OR, msg )
|
||||
.setPosButton( R.string.button_enable_mqtt )
|
||||
.setNegButton( R.string.newgame_drop_mqtt )
|
||||
.show();
|
||||
|
@ -2852,9 +2849,8 @@ public class BoardDelegate extends DelegateBase
|
|||
|
||||
private void showArchiveNA( boolean rematchAfter )
|
||||
{
|
||||
makeNotAgainBuilder( R.string.not_again_archive,
|
||||
R.string.key_na_archive,
|
||||
Action.ARCHIVE_ACTION )
|
||||
makeNotAgainBuilder( R.string.key_na_archive, Action.ARCHIVE_ACTION,
|
||||
R.string.not_again_archive )
|
||||
.setParams( rematchAfter )
|
||||
.show();
|
||||
}
|
||||
|
@ -2943,8 +2939,8 @@ public class BoardDelegate extends DelegateBase
|
|||
} else if ( 2 != gi.nPlayers ) {
|
||||
Assert.assertNotNull( dlgt );
|
||||
if ( null != dlgt ) {
|
||||
dlgt.makeNotAgainBuilder( R.string.not_again_rematch_two_only,
|
||||
R.string.key_na_rematch_two_only )
|
||||
dlgt.makeNotAgainBuilder( R.string.key_na_rematch_two_only,
|
||||
R.string.not_again_rematch_two_only )
|
||||
.show();
|
||||
}
|
||||
doIt = false;
|
||||
|
@ -3158,8 +3154,8 @@ public class BoardDelegate extends DelegateBase
|
|||
NBSProto.inviteRemote( m_activity, phone, nli );
|
||||
recordInviteSent( InviteMeans.SMS_DATA, phone );
|
||||
} else if ( askOk ) {
|
||||
makeConfirmThenBuilder( R.string.warn_sms_disabled,
|
||||
Action.ENABLE_NBS_ASK )
|
||||
makeConfirmThenBuilder( Action.ENABLE_NBS_ASK,
|
||||
R.string.warn_sms_disabled )
|
||||
.setPosButton( R.string.button_enable_sms )
|
||||
.setNegButton( R.string.button_later )
|
||||
.setParams( nli, phone )
|
||||
|
|
|
@ -222,8 +222,8 @@ public class ChatDelegate extends DelegateBase {
|
|||
boolean handled = true;
|
||||
switch ( item.getItemId() ) {
|
||||
case R.id.chat_menu_clear:
|
||||
makeConfirmThenBuilder( R.string.confirm_clear_chat,
|
||||
Action.CLEAR_ACTION )
|
||||
makeConfirmThenBuilder( Action.CLEAR_ACTION,
|
||||
R.string.confirm_clear_chat )
|
||||
.show();
|
||||
break;
|
||||
case R.id.chat_menu_send:
|
||||
|
|
|
@ -186,7 +186,7 @@ public class ConnViaViewLayout extends LinearLayout {
|
|||
}
|
||||
|
||||
DlgDelegate.Builder builder = 0 != keyID
|
||||
? m_dlgDlgt.makeNotAgainBuilder( msgID, keyID )
|
||||
? m_dlgDlgt.makeNotAgainBuilder( keyID, msgID )
|
||||
: m_dlgDlgt.makeOkOnlyBuilder( msgID )
|
||||
.setActionPair( Action.PERMS_BANNED_INFO,
|
||||
R.string.button_more_info )
|
||||
|
|
|
@ -535,33 +535,33 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
}
|
||||
|
||||
public Builder
|
||||
makeNotAgainBuilder( String msg, int key, Action action )
|
||||
makeNotAgainBuilder( int key, Action action, String msg )
|
||||
{
|
||||
return m_dlgDelegate.makeNotAgainBuilder( msg, key, action );
|
||||
return m_dlgDelegate.makeNotAgainBuilder( key, action, msg );
|
||||
}
|
||||
|
||||
public Builder
|
||||
makeNotAgainBuilder( int msgId, int key, Action action )
|
||||
makeNotAgainBuilder( int key, Action action, int msgId, Object... params )
|
||||
{
|
||||
return m_dlgDelegate.makeNotAgainBuilder( msgId, key, action );
|
||||
return m_dlgDelegate.makeNotAgainBuilder( key, action, msgId, params );
|
||||
}
|
||||
|
||||
public Builder makeNotAgainBuilder( String msg, int key )
|
||||
public Builder makeNotAgainBuilder( int key, String msg )
|
||||
{
|
||||
return m_dlgDelegate.makeNotAgainBuilder( msg, key );
|
||||
return m_dlgDelegate.makeNotAgainBuilder( key, msg );
|
||||
}
|
||||
|
||||
public Builder makeNotAgainBuilder( int msgID, int key )
|
||||
public Builder makeNotAgainBuilder( int key, int msgID, Object... params )
|
||||
{
|
||||
return m_dlgDelegate.makeNotAgainBuilder( msgID, key );
|
||||
return m_dlgDelegate.makeNotAgainBuilder( key, msgID, params );
|
||||
}
|
||||
|
||||
public Builder makeConfirmThenBuilder( String msg, Action action ) {
|
||||
return m_dlgDelegate.makeConfirmThenBuilder( msg, action );
|
||||
public Builder makeConfirmThenBuilder( Action action, String msg ) {
|
||||
return m_dlgDelegate.makeConfirmThenBuilder( action, msg );
|
||||
}
|
||||
|
||||
public Builder makeConfirmThenBuilder( int msgId, Action action ) {
|
||||
return m_dlgDelegate.makeConfirmThenBuilder( msgId, action );
|
||||
public Builder makeConfirmThenBuilder( Action action, int msgId, Object... params ) {
|
||||
return m_dlgDelegate.makeConfirmThenBuilder( action, msgId, params );
|
||||
}
|
||||
|
||||
protected boolean post( Runnable runnable )
|
||||
|
@ -586,9 +586,9 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
m_dlgDelegate.showInviteChoicesThen( action, nli, nMissing );
|
||||
}
|
||||
|
||||
public Builder makeOkOnlyBuilder( int msgID )
|
||||
public Builder makeOkOnlyBuilder( int msgID, Object... params )
|
||||
{
|
||||
return m_dlgDelegate.makeOkOnlyBuilder( msgID );
|
||||
return m_dlgDelegate.makeOkOnlyBuilder( msgID, params );
|
||||
}
|
||||
|
||||
public Builder makeOkOnlyBuilder( String msg )
|
||||
|
@ -699,8 +699,8 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
|
||||
protected void askNoAddrsDelete()
|
||||
{
|
||||
makeConfirmThenBuilder( R.string.connstat_net_noaddr,
|
||||
Action.DELETE_AND_EXIT )
|
||||
makeConfirmThenBuilder( Action.DELETE_AND_EXIT,
|
||||
R.string.connstat_net_noaddr )
|
||||
.setPosButton( R.string.list_item_delete )
|
||||
.setNegButton( R.string.button_close_game )
|
||||
.show();
|
||||
|
@ -733,10 +733,11 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
final String msg = getString( fmtId, (String)args[0] );
|
||||
final int key = notAgainKey;
|
||||
runOnUiThread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Builder builder = 0 == key
|
||||
? makeOkOnlyBuilder( msg )
|
||||
: makeNotAgainBuilder( msg, key )
|
||||
: makeNotAgainBuilder( key, msg )
|
||||
;
|
||||
builder.show();
|
||||
}
|
||||
|
|
|
@ -616,8 +616,7 @@ public class DictBrowseDelegate extends DelegateBase
|
|||
byte[][] choices = XwJNI.dict_strToTiles( m_dict, strPat );
|
||||
if ( null == choices || 0 == choices.length ) {
|
||||
String langName = DictLangCache.getLangNameForISOCode( m_activity, m_lang );
|
||||
String msg = getString( R.string.no_tiles_exist, strPat, langName );
|
||||
makeOkOnlyBuilder( msg )
|
||||
makeOkOnlyBuilder( R.string.no_tiles_exist, strPat, langName )
|
||||
.setActionPair( Action.SHOW_TILES, R.string.show_tiles_button )
|
||||
.show();
|
||||
pending = true;
|
||||
|
@ -781,7 +780,7 @@ public class DictBrowseDelegate extends DelegateBase
|
|||
initList( wrapper );
|
||||
setFindPats( m_browseState.m_pats );
|
||||
} else {
|
||||
makeOkOnlyBuilder(R.string.alrt_bad_filter )
|
||||
makeOkOnlyBuilder( R.string.alrt_bad_filter )
|
||||
.show();
|
||||
}
|
||||
newFeatureAlert();
|
||||
|
@ -795,7 +794,7 @@ public class DictBrowseDelegate extends DelegateBase
|
|||
{
|
||||
if ( ! m_filterAlertShown ) {
|
||||
m_filterAlertShown = true;
|
||||
makeNotAgainBuilder( R.string.new_feature_filter, R.string.key_na_newFeatureFilter )
|
||||
makeNotAgainBuilder( R.string.key_na_newFeatureFilter, R.string.new_feature_filter )
|
||||
.setActionPair( Action.SHOW_FAQ, R.string.button_faq )
|
||||
.setParams( (Object)FAQ_PARAMS )
|
||||
.show();
|
||||
|
|
|
@ -498,7 +498,7 @@ public class DictsDelegate extends ListDelegateBase
|
|||
|
||||
m_origTitle = getTitle();
|
||||
|
||||
makeNotAgainBuilder( R.string.not_again_dicts, R.string.key_na_dicts )
|
||||
makeNotAgainBuilder( R.string.key_na_dicts, R.string.not_again_dicts )
|
||||
.show();
|
||||
|
||||
Perms23.tryGetPermsNA( this, Perm.STORAGE, R.string.dicts_storage_rationale,
|
||||
|
@ -860,7 +860,7 @@ public class DictsDelegate extends ListDelegateBase
|
|||
}
|
||||
}
|
||||
|
||||
makeConfirmThenBuilder( msg, Action.DELETE_DICT_ACTION )
|
||||
makeConfirmThenBuilder( Action.DELETE_DICT_ACTION, msg )
|
||||
.setPosButton( R.string.button_delete )
|
||||
.setParams( (Object)names )
|
||||
.show();
|
||||
|
@ -1407,9 +1407,8 @@ public class DictsDelegate extends ListDelegateBase
|
|||
String[] names = m_needUpdates.keySet()
|
||||
.toArray(new String[m_needUpdates.size()]);
|
||||
String joined = TextUtils.join( ", ", names );
|
||||
makeConfirmThenBuilder( getString( R.string.update_dicts_fmt,
|
||||
joined ),
|
||||
Action.UPDATE_DICTS_ACTION )
|
||||
makeConfirmThenBuilder( Action.UPDATE_DICTS_ACTION,
|
||||
R.string.update_dicts_fmt, joined )
|
||||
.setPosButton( R.string.button_download )
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -180,9 +180,9 @@ public class DlgDelegate {
|
|||
return this;
|
||||
}
|
||||
|
||||
Builder setMessageID( int msgID )
|
||||
Builder setMessageID( int msgID, Object... params )
|
||||
{
|
||||
mState.setMsg( getString( msgID ) );
|
||||
mState.setMsg( getString( msgID, params ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -266,10 +266,10 @@ public class DlgDelegate {
|
|||
return builder;
|
||||
}
|
||||
|
||||
public Builder makeOkOnlyBuilder( int msgID )
|
||||
public Builder makeOkOnlyBuilder( int msgID, Object... params )
|
||||
{
|
||||
Builder builder = new Builder( DlgID.DIALOG_OKONLY )
|
||||
.setMessageID( msgID )
|
||||
.setMessageID( msgID, params )
|
||||
;
|
||||
return builder;
|
||||
}
|
||||
|
@ -282,17 +282,17 @@ public class DlgDelegate {
|
|||
;
|
||||
}
|
||||
|
||||
public Builder makeConfirmThenBuilder( String msg, Action action )
|
||||
public Builder makeConfirmThenBuilder( Action action, String msg )
|
||||
{
|
||||
return makeConfirmThenBuilder( action )
|
||||
.setMessage( msg )
|
||||
;
|
||||
}
|
||||
|
||||
public Builder makeConfirmThenBuilder( int msgID, Action action )
|
||||
public Builder makeConfirmThenBuilder( Action action, int msgID, Object... params )
|
||||
{
|
||||
return makeConfirmThenBuilder( action )
|
||||
.setMessageID( msgID )
|
||||
.setMessageID( msgID, params )
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class DlgDelegate {
|
|||
;
|
||||
}
|
||||
|
||||
public Builder makeNotAgainBuilder( String msg, int key, Action action )
|
||||
public Builder makeNotAgainBuilder( int key, Action action, String msg )
|
||||
{
|
||||
return makeNotAgainBuilder( key )
|
||||
.setMessage( msg )
|
||||
|
@ -313,25 +313,26 @@ public class DlgDelegate {
|
|||
;
|
||||
}
|
||||
|
||||
public Builder makeNotAgainBuilder( int msgID, int key, Action action )
|
||||
public Builder makeNotAgainBuilder( int key, Action action,
|
||||
int msgID, Object... params )
|
||||
{
|
||||
return makeNotAgainBuilder( key )
|
||||
.setMessageID( msgID )
|
||||
.setMessageID( msgID, params )
|
||||
.setAction( action )
|
||||
;
|
||||
}
|
||||
|
||||
public Builder makeNotAgainBuilder( String msg, int key )
|
||||
public Builder makeNotAgainBuilder( int key, String msg )
|
||||
{
|
||||
return makeNotAgainBuilder( key )
|
||||
.setMessage( msg )
|
||||
;
|
||||
}
|
||||
|
||||
public Builder makeNotAgainBuilder( int msgID, int key )
|
||||
public Builder makeNotAgainBuilder( int key, int msgID, Object... params )
|
||||
{
|
||||
return makeNotAgainBuilder( key )
|
||||
.setMessageID( msgID )
|
||||
.setMessageID( msgID, params )
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -371,10 +372,10 @@ public class DlgDelegate {
|
|||
void inviteChoiceMade( Action action, InviteMeans means, Object... params );
|
||||
}
|
||||
public interface HasDlgDelegate {
|
||||
Builder makeOkOnlyBuilder( int msgID );
|
||||
Builder makeOkOnlyBuilder( int msgID, Object... params );
|
||||
Builder makeOkOnlyBuilder( String msg );
|
||||
Builder makeNotAgainBuilder( int msgID, int prefsKey, Action action );
|
||||
Builder makeNotAgainBuilder( int msgID, int prefsKey );
|
||||
Builder makeNotAgainBuilder( int prefsKey, Action action, int msgID, Object... params );
|
||||
Builder makeNotAgainBuilder( int prefsKey, int msgID, Object... params );
|
||||
}
|
||||
|
||||
private Activity m_activity;
|
||||
|
|
|
@ -259,15 +259,15 @@ public class GameConfigDelegate extends DelegateBase
|
|||
public void warnDisabled( CommsConnType typ ) {
|
||||
switch( typ ) {
|
||||
case COMMS_CONN_SMS:
|
||||
makeConfirmThenBuilder( R.string.warn_sms_disabled,
|
||||
Action.ENABLE_NBS_ASK )
|
||||
makeConfirmThenBuilder( Action.ENABLE_NBS_ASK,
|
||||
R.string.warn_sms_disabled )
|
||||
.setPosButton( R.string.button_enable_sms )
|
||||
.setNegButton( R.string.button_later )
|
||||
.show();
|
||||
break;
|
||||
case COMMS_CONN_BT:
|
||||
makeConfirmThenBuilder( R.string.warn_bt_disabled,
|
||||
Action.ENABLE_BT_DO )
|
||||
makeConfirmThenBuilder( Action.ENABLE_BT_DO,
|
||||
R.string.warn_bt_disabled )
|
||||
.setPosButton( R.string.button_enable_bt )
|
||||
.setNegButton( R.string.button_later )
|
||||
.show();
|
||||
|
@ -278,7 +278,7 @@ public class GameConfigDelegate extends DelegateBase
|
|||
case COMMS_CONN_MQTT:
|
||||
String msg = getString( R.string.warn_mqtt_disabled )
|
||||
+ "\n\n" + getString( R.string.warn_mqtt_later );
|
||||
makeConfirmThenBuilder( msg, Action.ENABLE_MQTT_DO )
|
||||
makeConfirmThenBuilder( Action.ENABLE_MQTT_DO, msg )
|
||||
.setPosButton( R.string.button_enable_mqtt )
|
||||
.setNegButton( R.string.button_later )
|
||||
.show();
|
||||
|
@ -672,8 +672,8 @@ public class GameConfigDelegate extends DelegateBase
|
|||
int position, long id ) {
|
||||
if ( curSel[0] != position ) {
|
||||
curSel[0] = position;
|
||||
makeNotAgainBuilder( R.string.not_again_traysize,
|
||||
R.string.key_na_traysize )
|
||||
makeNotAgainBuilder( R.string.key_na_traysize,
|
||||
R.string.not_again_traysize )
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
@ -825,9 +825,9 @@ public class GameConfigDelegate extends DelegateBase
|
|||
loadPlayersList();
|
||||
break;
|
||||
case R.id.game_locked_check:
|
||||
makeNotAgainBuilder( R.string.not_again_unlock,
|
||||
R.string.key_notagain_unlock,
|
||||
Action.LOCKED_CHANGE_ACTION )
|
||||
makeNotAgainBuilder( R.string.key_notagain_unlock,
|
||||
Action.LOCKED_CHANGE_ACTION,
|
||||
R.string.not_again_unlock )
|
||||
.show();
|
||||
break;
|
||||
case R.id.change_connection:
|
||||
|
@ -841,8 +841,8 @@ public class GameConfigDelegate extends DelegateBase
|
|||
saveChanges();
|
||||
|
||||
if ( !localOnlyGame() && 0 == m_conTypes.size() ) {
|
||||
makeConfirmThenBuilder( R.string.config_no_connvia,
|
||||
Action.DELETE_AND_EXIT )
|
||||
makeConfirmThenBuilder( Action.DELETE_AND_EXIT,
|
||||
R.string.config_no_connvia )
|
||||
.setPosButton( R.string.button_discard )
|
||||
.setNegButton( R.string.button_edit )
|
||||
.show();
|
||||
|
|
|
@ -756,11 +756,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
mkListAdapter();
|
||||
showNewGroupIf();
|
||||
} else {
|
||||
String msg = LocUtils
|
||||
.getString( m_activity,
|
||||
R.string.duplicate_group_name_fmt,
|
||||
name );
|
||||
makeOkOnlyBuilder( msg ).show();
|
||||
makeOkOnlyBuilder( R.string.duplicate_group_name_fmt,
|
||||
name ).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -848,8 +845,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
boolean solo = (Boolean)params[0];
|
||||
dialog = mkNewNetGameDialog( solo );
|
||||
if ( !solo && XwJNI.hasKnownPlayers() ) {
|
||||
makeNotAgainBuilder( R.string.not_again_quicknetgame,
|
||||
R.string.key_na_quicknetgame )
|
||||
makeNotAgainBuilder( R.string.key_na_quicknetgame,
|
||||
R.string.not_again_quicknetgame )
|
||||
.setTitle( R.string.new_feature_title )
|
||||
.show();
|
||||
}
|
||||
|
@ -1132,8 +1129,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
m_offeredHideButtons = true; // don't do expensive check again
|
||||
} else {
|
||||
m_offeredHideButtons = true;
|
||||
makeNotAgainBuilder( R.string.not_again_hidenewgamebuttons,
|
||||
R.string.key_notagain_hidenewgamebuttons )
|
||||
makeNotAgainBuilder( R.string.key_notagain_hidenewgamebuttons,
|
||||
R.string.not_again_hidenewgamebuttons )
|
||||
.setActionPair( Action.SET_HIDE_NEWGAME_BUTTONS,
|
||||
R.string.set_pref )
|
||||
.show();
|
||||
|
@ -1158,10 +1155,9 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
&& Perm.SEND_SMS.isBanned(m_activity) ) {
|
||||
int smsGameCount = DBUtils.countOpenGamesUsingNBS( m_activity );
|
||||
if ( 0 < smsGameCount ) {
|
||||
String msg = LocUtils.getString( m_activity,
|
||||
R.string.not_again_nbsGamesOnUpgrade,
|
||||
smsGameCount );
|
||||
makeNotAgainBuilder( msg, R.string.key_notagain_nbsGamesOnUpgrade )
|
||||
makeNotAgainBuilder( R.string.key_notagain_nbsGamesOnUpgrade,
|
||||
R.string.not_again_nbsGamesOnUpgrade,
|
||||
smsGameCount )
|
||||
.setActionPair( Action.PERMS_BANNED_INFO,
|
||||
R.string.button_more_info )
|
||||
.show();
|
||||
|
@ -1292,14 +1288,13 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
{
|
||||
if ( ! BoardDelegate.gameIsOpen( rowid ) ) {
|
||||
if ( Quarantine.safeToOpen( rowid ) ) {
|
||||
makeNotAgainBuilder( R.string.not_again_newselect,
|
||||
R.string.key_notagain_newselect,
|
||||
Action.OPEN_GAME )
|
||||
makeNotAgainBuilder( R.string.key_notagain_newselect,
|
||||
Action.OPEN_GAME, R.string.not_again_newselect )
|
||||
.setParams( rowid, summary )
|
||||
.show();
|
||||
} else {
|
||||
makeConfirmThenBuilder( R.string.unsafe_open_warning,
|
||||
Action.QUARANTINE_CLEAR )
|
||||
makeConfirmThenBuilder( Action.QUARANTINE_CLEAR,
|
||||
R.string.unsafe_open_warning )
|
||||
.setPosButton( R.string.unsafe_open_disregard )
|
||||
.setNegButton( 0 )
|
||||
.setActionPair( Action.QUARANTINE_DELETE,
|
||||
|
@ -1581,9 +1576,9 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
} else {
|
||||
ArrayList<SaveWhat> what = view.getSaveWhat();
|
||||
String name = ZipUtils.getFileName( m_activity, uri );
|
||||
String msg = getString( R.string.backup_overwrite_confirm_fmt,
|
||||
name );
|
||||
makeConfirmThenBuilder( msg, Action.BACKUP_OVERWRITE )
|
||||
makeConfirmThenBuilder( Action.BACKUP_OVERWRITE,
|
||||
R.string.backup_overwrite_confirm_fmt,
|
||||
name )
|
||||
.setParams(what, uri.toString())
|
||||
.show();
|
||||
}
|
||||
|
@ -1683,9 +1678,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
} else {
|
||||
String name = ZipUtils.getFileName( m_activity, uri );
|
||||
if ( null != name ) {
|
||||
String msg = getString( R.string.backup_bad_file_fmt,
|
||||
name );
|
||||
makeOkOnlyBuilder( msg )
|
||||
makeOkOnlyBuilder( R.string.backup_bad_file_fmt, name )
|
||||
.setActionPair( Action.BACKUP_RETRY,
|
||||
R.string.button_pick_again )
|
||||
.show();
|
||||
|
@ -1712,9 +1705,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
boolean handled = 0 < m_mySIS.selGames.size()
|
||||
|| 0 < m_mySIS.selGroupIDs.size();
|
||||
if ( handled ) {
|
||||
makeNotAgainBuilder( R.string.not_again_backclears,
|
||||
R.string.key_notagain_backclears,
|
||||
Action.CLEAR_SELS )
|
||||
makeNotAgainBuilder( R.string.key_notagain_backclears,
|
||||
Action.CLEAR_SELS, R.string.not_again_backclears )
|
||||
.show();
|
||||
}
|
||||
return handled;
|
||||
|
@ -1917,9 +1909,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
showDialogFragment( DlgID.BACKUP_LOADSTORE );
|
||||
break;
|
||||
case R.id.games_menu_loaddb:
|
||||
makeNotAgainBuilder( R.string.not_again_loaddb,
|
||||
R.string.key_notagain_loaddb,
|
||||
Action.BACKUP_LOADDB )
|
||||
makeNotAgainBuilder( R.string.key_notagain_loaddb,
|
||||
Action.BACKUP_LOADDB, R.string.not_again_loaddb )
|
||||
.show();
|
||||
break;
|
||||
|
||||
|
@ -1940,8 +1931,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
Log.setStoreLogs( false );
|
||||
break;
|
||||
case R.id.games_menu_clearLogStorage:
|
||||
makeConfirmThenBuilder( R.string.logstore_clear_confirm,
|
||||
Action.CLEAR_LOG_DB )
|
||||
makeConfirmThenBuilder( Action.CLEAR_LOG_DB,
|
||||
R.string.logstore_clear_confirm )
|
||||
.setPosButton( R.string.loc_item_clear )
|
||||
.show();
|
||||
break;
|
||||
|
@ -2181,9 +2172,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
break;
|
||||
case R.id.games_game_new_from:
|
||||
dropSels = true; // will select the new game instead
|
||||
makeNotAgainBuilder( R.string.not_again_newfrom,
|
||||
R.string.key_notagain_newfrom,
|
||||
Action.NEW_FROM )
|
||||
makeNotAgainBuilder( R.string.key_notagain_newfrom,
|
||||
Action.NEW_FROM, R.string.not_again_newfrom )
|
||||
.setParams(selRowIDs[0])
|
||||
.show();
|
||||
break;
|
||||
|
@ -2265,20 +2255,19 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
{
|
||||
boolean handled = 0 < groupIDs.length;
|
||||
if ( handled ) {
|
||||
String msg;
|
||||
long groupID = groupIDs[0];
|
||||
switch( itemID ) {
|
||||
case R.id.games_group_delete:
|
||||
long dftGroup = XWPrefs.getDefaultNewGameGroup( m_activity );
|
||||
if ( groupID == dftGroup ) {
|
||||
msg = getString( R.string.cannot_delete_default_group_fmt,
|
||||
m_adapter.groupName( dftGroup ) );
|
||||
makeOkOnlyBuilder( msg ).show();
|
||||
makeOkOnlyBuilder( R.string.cannot_delete_default_group_fmt,
|
||||
m_adapter.groupName( dftGroup ) )
|
||||
.show();
|
||||
} else {
|
||||
Assert.assertTrue( 0 < groupIDs.length );
|
||||
String names = m_adapter.formatGroupNames( groupIDs );
|
||||
msg = getQuantityString( R.plurals.groups_confirm_del_fmt,
|
||||
groupIDs.length, names );
|
||||
String msg = getQuantityString( R.plurals.groups_confirm_del_fmt,
|
||||
groupIDs.length, names );
|
||||
|
||||
int nGames = 0;
|
||||
for ( long tmp : groupIDs ) {
|
||||
|
@ -2288,7 +2277,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
msg += getQuantityString( R.plurals.groups_confirm_del_games_fmt,
|
||||
nGames, nGames );
|
||||
}
|
||||
makeConfirmThenBuilder( msg, Action.DELETE_GROUPS )
|
||||
makeConfirmThenBuilder( Action.DELETE_GROUPS, msg )
|
||||
.setParams( groupIDs )
|
||||
.show();
|
||||
}
|
||||
|
@ -2490,7 +2479,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
int resid = success ? R.string.byod_success
|
||||
: R.string.byod_failure;
|
||||
DlgDelegate.Builder builder =
|
||||
makeOkOnlyBuilder( getString( resid, name ) );
|
||||
makeOkOnlyBuilder( resid, name );
|
||||
if ( success ) {
|
||||
builder.setActionPair( Action.OPEN_BYOD_DICT,
|
||||
R.string.button_open_dict )
|
||||
|
@ -2572,7 +2561,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
String prefix = LocUtils.getString( m_activity, R.string.conf_prefix );
|
||||
Log.d( TAG, "loadConfig(): path: %s; prefix: %s", path, prefix );
|
||||
if ( path.startsWith( prefix ) ) {
|
||||
makeConfirmThenBuilder( R.string.apply_config, Action.APPLY_CONFIG )
|
||||
makeConfirmThenBuilder( Action.APPLY_CONFIG, R.string.apply_config )
|
||||
.setPosButton( R.string.button_apply_config )
|
||||
.setNegButton( android.R.string.cancel )
|
||||
.setParams( data.toString() )
|
||||
|
@ -2761,9 +2750,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
if ( success ) {
|
||||
String langName = DictLangCache
|
||||
.getLangNameForISOCode( m_activity, isoCode );
|
||||
String msg =
|
||||
getString( R.string.confirm_get_locdict_fmt, langName );
|
||||
makeConfirmThenBuilder( msg, Action.DWNLD_LOC_DICT )
|
||||
makeConfirmThenBuilder( Action.DWNLD_LOC_DICT,
|
||||
R.string.confirm_get_locdict_fmt, langName )
|
||||
.setPosButton( R.string.button_download )
|
||||
.setNegButton( R.string.button_no )
|
||||
.setNAKey( R.string.key_got_langdict )
|
||||
|
@ -2812,7 +2800,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
|
||||
private void mkDeleteAlert( String msg, long[] rowids, boolean skipTell )
|
||||
{
|
||||
makeConfirmThenBuilder( msg, Action.DELETE_GAMES )
|
||||
makeConfirmThenBuilder( Action.DELETE_GAMES, msg )
|
||||
.setPosButton( R.string.button_delete )
|
||||
.setParams( rowids, skipTell )
|
||||
.show();
|
||||
|
@ -3024,7 +3012,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
{
|
||||
String msg = getQuantityString( R.plurals.confirm_reset_fmt,
|
||||
rowIDs.length, rowIDs.length );
|
||||
makeConfirmThenBuilder( msg, Action.RESET_GAMES )
|
||||
makeConfirmThenBuilder( Action.RESET_GAMES, msg )
|
||||
.setPosButton( R.string.button_reset )
|
||||
.setParams( rowIDs )
|
||||
.show();
|
||||
|
@ -3063,12 +3051,8 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
String name2 = CommonPrefs.getDefaultOriginalPlayerName( m_activity, 0 );
|
||||
if ( null == name1 || name1.equals( name2 ) ) {
|
||||
asking = true;
|
||||
|
||||
String msg = LocUtils
|
||||
.getString( m_activity, R.string.not_again_dfltname_fmt,
|
||||
name2 );
|
||||
|
||||
makeConfirmThenBuilder( msg, Action.NEW_GAME_DFLT_NAME )
|
||||
makeConfirmThenBuilder( Action.NEW_GAME_DFLT_NAME,
|
||||
R.string.not_again_dfltname_fmt, name2 )
|
||||
.setNAKey( R.string.key_notagain_dfltname )
|
||||
.setNegButton( R.string.button_later )
|
||||
.setParams( name, doConfigure )
|
||||
|
|
|
@ -204,20 +204,20 @@ public class InviteChoicesAlert extends DlgDelegateAlert
|
|||
switch ( means ) {
|
||||
case SMS_USER:
|
||||
builder = activity
|
||||
.makeNotAgainBuilder( R.string.sms_invite_flakey,
|
||||
R.string.key_na_sms_invite_flakey );
|
||||
.makeNotAgainBuilder( R.string.key_na_sms_invite_flakey,
|
||||
R.string.sms_invite_flakey );
|
||||
break;
|
||||
case CLIPBOARD:
|
||||
String msg =
|
||||
getString( R.string.not_again_clip_expl_fmt,
|
||||
getString(R.string.slmenu_copy_sel) );
|
||||
builder = activity
|
||||
.makeNotAgainBuilder(msg, R.string.key_na_clip_expl);
|
||||
.makeNotAgainBuilder( R.string.key_na_clip_expl, msg );
|
||||
break;
|
||||
case QRCODE:
|
||||
builder = activity
|
||||
.makeNotAgainBuilder( R.string.qrcode_invite_expl,
|
||||
R.string.key_na_qrcode_invite );
|
||||
.makeNotAgainBuilder( R.string.key_na_qrcode_invite,
|
||||
R.string.qrcode_invite_expl );
|
||||
break;
|
||||
case SMS_DATA:
|
||||
if ( !Perms23.havePermissions( activity, Perm.SEND_SMS, Perm.RECEIVE_SMS )
|
||||
|
@ -229,8 +229,8 @@ public class InviteChoicesAlert extends DlgDelegateAlert
|
|||
;
|
||||
} else if ( ! XWPrefs.getNBSEnabled( getContext() ) ) {
|
||||
builder = activity
|
||||
.makeConfirmThenBuilder( R.string.warn_sms_disabled,
|
||||
Action.ENABLE_NBS_ASK )
|
||||
.makeConfirmThenBuilder( Action.ENABLE_NBS_ASK,
|
||||
R.string.warn_sms_disabled )
|
||||
.setPosButton( R.string.button_enable_sms )
|
||||
.setNegButton( R.string.button_later )
|
||||
;
|
||||
|
|
|
@ -125,10 +125,9 @@ public class KnownPlayersDelegate extends DelegateBase {
|
|||
if ( XwJNI.kplr_renamePlayer( oldName, newName ) ) {
|
||||
renameInPlace( oldName, newName );
|
||||
} else {
|
||||
String msg = LocUtils.getString( mActivity,
|
||||
R.string.knowns_dup_name_fmt,
|
||||
oldName, newName );
|
||||
makeOkOnlyBuilder( msg ).show();
|
||||
makeOkOnlyBuilder( R.string.knowns_dup_name_fmt,
|
||||
oldName, newName )
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -293,10 +292,8 @@ public class KnownPlayersDelegate extends DelegateBase {
|
|||
|
||||
private void confirmAndDelete( String name )
|
||||
{
|
||||
String msg = LocUtils.getString( mActivity,
|
||||
R.string.knowns_delete_confirm_fmt,
|
||||
name );
|
||||
makeConfirmThenBuilder( msg, Action.KNOWN_PLAYER_DELETE )
|
||||
makeConfirmThenBuilder( Action.KNOWN_PLAYER_DELETE,
|
||||
R.string.knowns_delete_confirm_fmt, name )
|
||||
.setParams( name )
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MQTTCheckBoxPreference extends ConfirmingCheckBoxPreference {
|
|||
msg += LocUtils.getQuantityString( activity, R.plurals.warn_mqtt_games_fmt,
|
||||
count, count );
|
||||
}
|
||||
activity.makeConfirmThenBuilder( msg, Action.DISABLE_MQTT_DO )
|
||||
activity.makeConfirmThenBuilder( Action.DISABLE_MQTT_DO, msg )
|
||||
.setPosButton( R.string.button_disable_mqtt )
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -243,8 +243,8 @@ public class Perms23 {
|
|||
builder.setOnShowRationale( new OnShowRationale() {
|
||||
@Override
|
||||
public void onShouldShowRationale( Set<Perm> perms ) {
|
||||
m_delegate.makeConfirmThenBuilder( m_rationaleMsg,
|
||||
Action.PERMS_QUERY )
|
||||
m_delegate.makeConfirmThenBuilder( Action.PERMS_QUERY,
|
||||
m_rationaleMsg )
|
||||
.setTitle( R.string.perms_rationale_title )
|
||||
.setPosButton( R.string.button_ask )
|
||||
.setNegButton( R.string.button_deny )
|
||||
|
|
|
@ -93,9 +93,9 @@ public class PrefsActivity extends XWActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public Builder makeNotAgainBuilder(int msgID, int key, Action action)
|
||||
public Builder makeNotAgainBuilder( int key, Action action, int msgID, Object... params)
|
||||
{
|
||||
return m_dlgt.makeNotAgainBuilder( msgID, key, action );
|
||||
return m_dlgt.makeNotAgainBuilder( key, action, msgID, params );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,9 +131,9 @@ public class PrefsActivity extends XWActivity
|
|||
return true;
|
||||
}
|
||||
|
||||
Builder makeConfirmThenBuilder( String msg, Action action )
|
||||
Builder makeConfirmThenBuilder( Action action, String msg )
|
||||
{
|
||||
return m_dlgt.makeConfirmThenBuilder( msg, action );
|
||||
return m_dlgt.makeConfirmThenBuilder( action, msg );
|
||||
}
|
||||
|
||||
protected void showSMSEnableDialog( Action action )
|
||||
|
|
|
@ -217,9 +217,9 @@ public class PrefsDelegate extends DelegateBase
|
|||
if ( null != dlgID ) {
|
||||
showDialogFragment( dlgID );
|
||||
} else if ( null != theme ) {
|
||||
makeNotAgainBuilder( R.string.not_again_copytheme,
|
||||
R.string.key_na_copytheme,
|
||||
Action.EXPORT_THEME )
|
||||
makeNotAgainBuilder( R.string.key_na_copytheme,
|
||||
Action.EXPORT_THEME,
|
||||
R.string.not_again_copytheme )
|
||||
.setParams( theme )
|
||||
.show();
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
int count = getChecked().size();
|
||||
String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt,
|
||||
count, count );
|
||||
makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show();
|
||||
makeConfirmThenBuilder( Action.CLEAR_ACTION, msg ).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
|
||||
private void postSMSCostWarning( String number, String name )
|
||||
{
|
||||
makeConfirmThenBuilder( R.string.warn_unlimited,
|
||||
Action.POST_WARNING_ACTION )
|
||||
makeConfirmThenBuilder( Action.POST_WARNING_ACTION,
|
||||
R.string.warn_unlimited )
|
||||
.setPosButton( R.string.button_yes )
|
||||
.setParams( number, name )
|
||||
.show();
|
||||
|
@ -268,9 +268,8 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
|
||||
private void postConfirmMobile( String number, String name )
|
||||
{
|
||||
String msg = getString( R.string.warn_nomobile_fmt,
|
||||
number, name );
|
||||
makeConfirmThenBuilder( msg, Action.USE_IMMOBILE_ACTION )
|
||||
makeConfirmThenBuilder( Action.USE_IMMOBILE_ACTION,
|
||||
R.string.warn_nomobile_fmt, number, name )
|
||||
.setPosButton( R.string.button_yes )
|
||||
.setParams( number, name )
|
||||
.show();
|
||||
|
|
|
@ -134,15 +134,15 @@ public class StudyListDelegate extends ListDelegateBase
|
|||
boolean handled = true;
|
||||
switch ( item.getItemId() ) {
|
||||
case R.id.slmenu_copy_sel:
|
||||
makeNotAgainBuilder( R.string.not_again_studycopy,
|
||||
R.string.key_na_studycopy,
|
||||
Action.SL_COPY_ACTION )
|
||||
makeNotAgainBuilder( R.string.key_na_studycopy,
|
||||
Action.SL_COPY_ACTION,
|
||||
R.string.not_again_studycopy )
|
||||
.show();
|
||||
break;
|
||||
case R.id.slmenu_clear_sel:
|
||||
String msg = getQuantityString( R.plurals.confirm_studylist_clear_fmt,
|
||||
m_checkeds.size(), m_checkeds.size() );
|
||||
makeConfirmThenBuilder( msg, Action.SL_CLEAR_ACTION ).show();
|
||||
makeConfirmThenBuilder( Action.SL_CLEAR_ACTION, msg ).show();
|
||||
break;
|
||||
|
||||
case R.id.slmenu_select_all:
|
||||
|
|
|
@ -95,7 +95,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
|
|||
public void onClick( View view ) {
|
||||
Log.i( TAG, "setListener(): click on %s with action %s",
|
||||
view.toString(), action.toString() );
|
||||
m_dlgDlgt.makeNotAgainBuilder( msgID, prefsKey, action )
|
||||
m_dlgDlgt.makeNotAgainBuilder( prefsKey, action, msgID )
|
||||
.show();
|
||||
}
|
||||
} );
|
||||
|
@ -107,7 +107,7 @@ public class Toolbar implements BoardContainer.SizeChangeListener {
|
|||
{
|
||||
m_onLongClickListeners.put( index, new View.OnLongClickListener() {
|
||||
public boolean onLongClick( View view ) {
|
||||
m_dlgDlgt.makeNotAgainBuilder( msgID, prefsKey, action )
|
||||
m_dlgDlgt.makeNotAgainBuilder( prefsKey, action, msgID )
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -227,24 +227,25 @@ public class XWActivity extends FragmentActivity
|
|||
|
||||
// This are a hack! I need some way to build fragment-based alerts from
|
||||
// inside fragment-based alerts.
|
||||
public DlgDelegate.Builder makeNotAgainBuilder( String msg, int keyID )
|
||||
public DlgDelegate.Builder makeNotAgainBuilder( int keyID, String msg )
|
||||
{
|
||||
return m_dlgt.makeNotAgainBuilder( msg, keyID );
|
||||
return m_dlgt.makeNotAgainBuilder( keyID, msg );
|
||||
}
|
||||
|
||||
public DlgDelegate.Builder makeNotAgainBuilder( int msgID, int keyID )
|
||||
public DlgDelegate.Builder makeNotAgainBuilder( int keyID, int msgID, Object... params )
|
||||
{
|
||||
return m_dlgt.makeNotAgainBuilder( msgID, keyID );
|
||||
return m_dlgt.makeNotAgainBuilder( keyID, msgID, params );
|
||||
}
|
||||
|
||||
public DlgDelegate.Builder makeConfirmThenBuilder( int msgID, Action action )
|
||||
public DlgDelegate.Builder makeConfirmThenBuilder( Action action, int msgID,
|
||||
Object... params )
|
||||
{
|
||||
return m_dlgt.makeConfirmThenBuilder( msgID, action );
|
||||
return m_dlgt.makeConfirmThenBuilder( action, msgID, params );
|
||||
}
|
||||
|
||||
public DlgDelegate.Builder makeOkOnlyBuilder( int msgID )
|
||||
public DlgDelegate.Builder makeOkOnlyBuilder( int msgID, Object... params )
|
||||
{
|
||||
return m_dlgt.makeOkOnlyBuilder( msgID );
|
||||
return m_dlgt.makeOkOnlyBuilder( msgID, params );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -107,7 +107,7 @@ public class XWConnAddrPreference extends DialogPreference
|
|||
msg = LocUtils.getString( activity, msgID );
|
||||
}
|
||||
if ( null != msg ) {
|
||||
activity.makeConfirmThenBuilder( msg, action )
|
||||
activity.makeConfirmThenBuilder( action, msg )
|
||||
.setPosButton( buttonID )
|
||||
.setNegButton( R.string.button_later )
|
||||
.show();
|
||||
|
|
Loading…
Reference in a new issue