mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
warn when user disables all communication options in prefs
This commit is contained in:
parent
5d58c09120
commit
46c4cc0669
8 changed files with 90 additions and 50 deletions
|
@ -2604,6 +2604,7 @@ public final class R {
|
||||||
line in a game summary. The \u0020 is a space in xml.
|
line in a game summary. The \u0020 is a space in xml.
|
||||||
*/
|
*/
|
||||||
public static final int vs_join=0x7f050123;
|
public static final int vs_join=0x7f050123;
|
||||||
|
public static final int warn_no_comms=0x7f0502da;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public static final int warn_nomobile_fmt=0x7f05021f;
|
public static final int warn_nomobile_fmt=0x7f05021f;
|
||||||
|
|
|
@ -2297,4 +2297,8 @@
|
||||||
|
|
||||||
<string name="enable_bt_first">Please turn Bluetooth on before enabling.</string>
|
<string name="enable_bt_first">Please turn Bluetooth on before enabling.</string>
|
||||||
<string name="enable_sms_first">Please check \"Allow games via SMS\" before enabling.</string>
|
<string name="enable_sms_first">Please check \"Allow games via SMS\" before enabling.</string>
|
||||||
|
|
||||||
|
<string name="warn_no_comms">If you have no default connection
|
||||||
|
options every new networked game will have to be configured
|
||||||
|
manually.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1951,4 +1951,7 @@
|
||||||
emag si nepo.</string>
|
emag si nepo.</string>
|
||||||
<string name="enable_bt_first">Esaelp nrut Htooteulb no erofeb gnilbane.</string>
|
<string name="enable_bt_first">Esaelp nrut Htooteulb no erofeb gnilbane.</string>
|
||||||
<string name="enable_sms_first">Esaelp kcehc \"Wolla semag aiv SMS\" erofeb gnilbane.</string>
|
<string name="enable_sms_first">Esaelp kcehc \"Wolla semag aiv SMS\" erofeb gnilbane.</string>
|
||||||
|
<string name="warn_no_comms">Fi uoy evah on tluafed noitcennoc
|
||||||
|
snoitpo yreve wen dekrowten emag lliw evah ot eb derugifnoc
|
||||||
|
yllaunam.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1951,4 +1951,7 @@
|
||||||
GAME IS OPEN.</string>
|
GAME IS OPEN.</string>
|
||||||
<string name="enable_bt_first">PLEASE TURN BLUETOOTH ON BEFORE ENABLING.</string>
|
<string name="enable_bt_first">PLEASE TURN BLUETOOTH ON BEFORE ENABLING.</string>
|
||||||
<string name="enable_sms_first">PLEASE CHECK \"ALLOW GAMES VIA SMS\" BEFORE ENABLING.</string>
|
<string name="enable_sms_first">PLEASE CHECK \"ALLOW GAMES VIA SMS\" BEFORE ENABLING.</string>
|
||||||
|
<string name="warn_no_comms">IF YOU HAVE NO DEFAULT CONNECTION
|
||||||
|
OPTIONS EVERY NEW NETWORKED GAME WILL HAVE TO BE CONFIGURED
|
||||||
|
MANUALLY.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -40,21 +40,26 @@ public class ConnViaViewLayout extends LinearLayout {
|
||||||
public interface CheckEnabledWarner {
|
public interface CheckEnabledWarner {
|
||||||
public void warnDisabled( CommsConnType typ );
|
public void warnDisabled( CommsConnType typ );
|
||||||
}
|
}
|
||||||
private CheckEnabledWarner m_warner;
|
public interface SetEmptyWarner {
|
||||||
|
public void typeSetEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CheckEnabledWarner m_disabledWarner;
|
||||||
|
private SetEmptyWarner m_emptyWarner;
|
||||||
|
|
||||||
public ConnViaViewLayout( Context context, AttributeSet as ) {
|
public ConnViaViewLayout( Context context, AttributeSet as ) {
|
||||||
super( context, as );
|
super( context, as );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setWarner( CheckEnabledWarner warner )
|
protected void configure( CommsConnTypeSet types,
|
||||||
{
|
CheckEnabledWarner cew,
|
||||||
m_warner = warner;
|
SetEmptyWarner sew )
|
||||||
}
|
|
||||||
|
|
||||||
protected void setTypes( CommsConnTypeSet types )
|
|
||||||
{
|
{
|
||||||
m_curSet = (CommsConnTypeSet)types.clone();
|
m_curSet = (CommsConnTypeSet)types.clone();
|
||||||
addConnections();
|
addConnections();
|
||||||
|
|
||||||
|
m_disabledWarner = cew;
|
||||||
|
m_emptyWarner = sew;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CommsConnTypeSet getTypes()
|
protected CommsConnTypeSet getTypes()
|
||||||
|
@ -88,6 +93,9 @@ public class ConnViaViewLayout extends LinearLayout {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_curSet.remove( typf );
|
m_curSet.remove( typf );
|
||||||
|
if ( null != m_emptyWarner && 0 == m_curSet.size()) {
|
||||||
|
m_emptyWarner.typeSetEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -106,8 +114,8 @@ public class ConnViaViewLayout extends LinearLayout {
|
||||||
result = BTService.BTEnabled();
|
result = BTService.BTEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !result && null != m_warner ) {
|
if ( !result && null != m_disabledWarner ) {
|
||||||
m_warner.warnDisabled( typ );
|
m_disabledWarner.warnDisabled( typ );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -282,8 +282,8 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
LinearLayout layout = (LinearLayout)inflate( R.layout.conn_types_display );
|
LinearLayout layout = (LinearLayout)inflate( R.layout.conn_types_display );
|
||||||
final ConnViaViewLayout items = (ConnViaViewLayout)
|
final ConnViaViewLayout items = (ConnViaViewLayout)
|
||||||
layout.findViewById( R.id.conn_types );
|
layout.findViewById( R.id.conn_types );
|
||||||
items.setTypes( m_conTypes );
|
items.configure( m_conTypes,
|
||||||
items.setWarner( new ConnViaViewLayout.CheckEnabledWarner() {
|
new ConnViaViewLayout.CheckEnabledWarner() {
|
||||||
public void warnDisabled( CommsConnType typ ) {
|
public void warnDisabled( CommsConnType typ ) {
|
||||||
switch( typ ) {
|
switch( typ ) {
|
||||||
case COMMS_CONN_SMS:
|
case COMMS_CONN_SMS:
|
||||||
|
@ -296,7 +296,8 @@ public class GameConfigDelegate extends DelegateBase
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
public void typeSetEmpty() {}
|
||||||
|
}, null );
|
||||||
|
|
||||||
final DialogInterface.OnClickListener lstnr =
|
final DialogInterface.OnClickListener lstnr =
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
|
@ -1142,7 +1142,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NEW_GAME_PRESSED:
|
case NEW_GAME_PRESSED:
|
||||||
showDialog( DlgID.GAMES_LIST_NEWGAME );
|
handleNewGame( m_nextIsSolo );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_GROUPS:
|
case DELETE_GROUPS:
|
||||||
|
@ -1330,12 +1330,10 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
GameUtils.resendAllIf( m_activity, null, true );
|
GameUtils.resendAllIf( m_activity, null, true );
|
||||||
break;
|
break;
|
||||||
case R.id.games_menu_newgame_solo:
|
case R.id.games_menu_newgame_solo:
|
||||||
m_nextIsSolo = true;
|
handleNewGame( true );
|
||||||
showDialog( DlgID.GAMES_LIST_NEWGAME );
|
|
||||||
break;
|
break;
|
||||||
case R.id.games_menu_newgame_net:
|
case R.id.games_menu_newgame_net:
|
||||||
m_nextIsSolo = false;
|
handleNewGame( false );
|
||||||
showDialog( DlgID.GAMES_LIST_NEWGAME );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.games_menu_newgroup:
|
case R.id.games_menu_newgroup:
|
||||||
|
@ -1565,6 +1563,22 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleNewGame( boolean solo )
|
||||||
|
{
|
||||||
|
m_nextIsSolo = solo;
|
||||||
|
// force config if we don't have at least one way to communicate
|
||||||
|
boolean skipDefaults = !solo;
|
||||||
|
if ( skipDefaults ) {
|
||||||
|
skipDefaults = 0 == XWPrefs.getAddrTypes( m_activity ).size();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( skipDefaults ) {
|
||||||
|
makeThenLaunchOrConfigure( true );
|
||||||
|
} else {
|
||||||
|
showDialog( DlgID.GAMES_LIST_NEWGAME );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleNewGameButton( boolean solo )
|
private void handleNewGameButton( boolean solo )
|
||||||
{
|
{
|
||||||
m_nextIsSolo = solo;
|
m_nextIsSolo = solo;
|
||||||
|
@ -1572,7 +1586,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
int count = m_adapter.getCount();
|
int count = m_adapter.getCount();
|
||||||
boolean skipOffer = 6 > count || XWPrefs.getHideNewgameButtons( m_activity );
|
boolean skipOffer = 6 > count || XWPrefs.getHideNewgameButtons( m_activity );
|
||||||
if ( skipOffer ) {
|
if ( skipOffer ) {
|
||||||
showDialog( DlgID.GAMES_LIST_NEWGAME );
|
handleNewGame( solo );
|
||||||
} else {
|
} else {
|
||||||
ActionPair pair = new ActionPair( Action.SET_HIDE_NEWGAME_BUTTONS,
|
ActionPair pair = new ActionPair( Action.SET_HIDE_NEWGAME_BUTTONS,
|
||||||
R.string.set_pref );
|
R.string.set_pref );
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class XWConnAddrPreference extends DialogPreference {
|
||||||
{
|
{
|
||||||
LocUtils.xlateView( m_context, view );
|
LocUtils.xlateView( m_context, view );
|
||||||
m_view = (ConnViaViewLayout)view.findViewById( R.id.conn_types );
|
m_view = (ConnViaViewLayout)view.findViewById( R.id.conn_types );
|
||||||
m_view.setTypes( XWPrefs.getAddrTypes( m_context ) );
|
m_view.configure( XWPrefs.getAddrTypes( m_context ),
|
||||||
m_view.setWarner( new ConnViaViewLayout.CheckEnabledWarner() {
|
new ConnViaViewLayout.CheckEnabledWarner() {
|
||||||
public void warnDisabled( CommsConnType typ ) {
|
public void warnDisabled( CommsConnType typ ) {
|
||||||
int id;
|
int id;
|
||||||
switch( typ ) {
|
switch( typ ) {
|
||||||
|
@ -73,6 +73,12 @@ public class XWConnAddrPreference extends DialogPreference {
|
||||||
activity.showOKOnlyDialog( id );
|
activity.showOKOnlyDialog( id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new ConnViaViewLayout.SetEmptyWarner() {
|
||||||
|
public void typeSetEmpty() {
|
||||||
|
PrefsActivity activity = (PrefsActivity)m_context;
|
||||||
|
activity.showOKOnlyDialog( R.string.warn_no_comms );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue