cleanup/refactor

This commit is contained in:
Eric House 2020-11-01 19:32:58 -08:00
parent 157332d2cc
commit 26f6bb8b43
3 changed files with 33 additions and 20 deletions

View file

@ -242,6 +242,7 @@ public class BoardDelegate extends DelegateBase
int title = (Integer)params[0];
String msg = (String)params[1];
lstnr = new OnClickListener() {
@Override
public void onClick( DialogInterface dlg,
int whichButton ) {
if ( DlgID.DLG_USEDICT == dlgID ) {
@ -283,6 +284,7 @@ public class BoardDelegate extends DelegateBase
case QUERY_MOVE: {
String msg = (String)params[0];
lstnr = new OnClickListener() {
@Override
public void onClick( DialogInterface dialog,
int whichButton ) {
handleViaThread( JNICmd.CMD_COMMIT, true, true );
@ -298,6 +300,7 @@ public class BoardDelegate extends DelegateBase
case NOTIFY_BADWORDS: {
lstnr = new OnClickListener() {
@Override
public void onClick( DialogInterface dlg, int bx ) {
handleViaThread( JNICmd.CMD_COMMIT, true, false );
}
@ -334,6 +337,7 @@ public class BoardDelegate extends DelegateBase
buttonTxt = getString( resID );
}
lstnr = new OnClickListener() {
@Override
public void onClick( DialogInterface dialog,
int whichButton ) {
makeNotAgainBuilder( R.string.not_again_lookup,
@ -539,6 +543,7 @@ public class BoardDelegate extends DelegateBase
.setMessage( message );
OnClickListener lstnr = new OnClickListener() {
@Override
public void onClick( DialogInterface dialog, int item ){
if ( !state.relayMissing ||
! state.connTypes.contains(CommsConnType.COMMS_CONN_RELAY) ) {
@ -559,6 +564,7 @@ public class BoardDelegate extends DelegateBase
if ( showNeutButton ) {
lstnr = new OnClickListener() {
@Override
public void onClick( DialogInterface dialog,
int item ) {
String msg = sentInfo[0].getAsText( activity );

View file

@ -59,45 +59,52 @@ public class XWConnAddrPreference extends DialogPreference {
final PrefsActivity activity = (PrefsActivity)m_context;
m_view.configure( XWPrefs.getAddrTypes( m_context ),
new ConnViaViewLayout.CheckEnabledWarner() {
@Override
public void warnDisabled( CommsConnType typ ) {
String msg = null;
int msgID = 0;
Action action = null;
int buttonID = 0;
switch( typ ) {
case COMMS_CONN_SMS:
activity
.makeConfirmThenBuilder( R.string.warn_sms_disabled,
Action.ENABLE_NBS_ASK )
.setPosButton( R.string.button_enable_sms )
.setNegButton( R.string.button_later )
.show();
msgID = R.string.warn_sms_disabled;
action = Action.ENABLE_NBS_ASK;
buttonID = R.string.button_enable_sms;
break;
case COMMS_CONN_BT:
activity
.makeConfirmThenBuilder( R.string.warn_bt_disabled,
Action.ENABLE_BT_DO )
.setPosButton( R.string.button_enable_bt )
.setNegButton( R.string.button_later )
.show();
msgID = R.string.warn_bt_disabled;
action = Action.ENABLE_BT_DO;
buttonID = R.string.button_enable_bt;
break;
case COMMS_CONN_RELAY:
String msg = LocUtils
msg = LocUtils
.getString( m_context, R.string
.warn_relay_disabled );
msg += "\n\n" + LocUtils
.getString( m_context,
R.string.warn_relay_later );
activity
.makeConfirmThenBuilder( msg, Action
.ENABLE_RELAY_DO )
.setPosButton( R.string.button_enable_relay )
.setNegButton( R.string.button_later )
.show();
action = Action.ENABLE_RELAY_DO;
buttonID = R.string.button_enable_relay;
break;
default:
Assert.failDbg();
break;
}
if ( 0 != msgID ) {
Assert.assertTrueNR( null == msg );
msg = LocUtils.getString( activity, msgID );
}
if ( null != msg ) {
activity.makeConfirmThenBuilder( msg, action )
.setPosButton( buttonID )
.setNegButton( R.string.button_later )
.show();
}
}
},
new ConnViaViewLayout.SetEmptyWarner() {
@Override
public void typeSetEmpty() {
PrefsActivity activity = (PrefsActivity)m_context;
activity

View file

@ -1880,7 +1880,7 @@
disabled, and no moves will be exchanged via Bluetooth until it is
enabled.\n\nYou can enable Bluetooth now, or later.
</string>
<string name="warn_relay_disabled">Relay play is currently disable
<string name="warn_relay_disabled">Relay play is currently disabled
on this device. No moves will be sent or received via the
relay. </string>
<string name="warn_relay_later">You can enable relay play now, or