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

View file

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

View file

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