mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-14 08:01:38 +01:00
show SMS and BT as connect-via options only when available on the
device -- which for SMS means it's a GSM phone.
This commit is contained in:
parent
b3f1b6ae3e
commit
c506805235
1 changed files with 17 additions and 7 deletions
|
@ -41,12 +41,6 @@ public class XWConnAddrPreference extends DialogPreference {
|
|||
private Context m_context;
|
||||
// This stuff probably belongs in CommsConnType
|
||||
private static CommsConnTypeSet s_supported;
|
||||
static {
|
||||
s_supported = new CommsConnTypeSet();
|
||||
s_supported.add( CommsConnType.COMMS_CONN_RELAY );
|
||||
s_supported.add( CommsConnType.COMMS_CONN_BT );
|
||||
s_supported.add( CommsConnType.COMMS_CONN_SMS );
|
||||
}
|
||||
|
||||
public static CommsConnTypeSet addConnections( Context context,
|
||||
LinearLayout view,
|
||||
|
@ -55,7 +49,7 @@ public class XWConnAddrPreference extends DialogPreference {
|
|||
LinearLayout list = (LinearLayout)view.findViewById( R.id.conn_types );
|
||||
final CommsConnTypeSet tmpTypes = (CommsConnTypeSet)curTypes.clone();
|
||||
|
||||
for ( CommsConnType typ : s_supported.getTypes() ) {
|
||||
for ( CommsConnType typ : getSupported(context).getTypes() ) {
|
||||
LinearLayout layout = (LinearLayout)
|
||||
LocUtils.inflate( context, R.layout.btinviter_item );
|
||||
CheckBox box = (CheckBox)layout.findViewById( R.id.inviter_check );
|
||||
|
@ -109,4 +103,20 @@ public class XWConnAddrPreference extends DialogPreference {
|
|||
}
|
||||
super.onClick( dialog, which );
|
||||
}
|
||||
|
||||
private static CommsConnTypeSet getSupported( Context context )
|
||||
{
|
||||
if ( null == s_supported ) {
|
||||
CommsConnTypeSet supported = new CommsConnTypeSet();
|
||||
supported.add( CommsConnType.COMMS_CONN_RELAY );
|
||||
if ( BTService.BTAvailable() ) {
|
||||
supported.add( CommsConnType.COMMS_CONN_BT );
|
||||
}
|
||||
if ( Utils.isGSMPhone( context ) ) {
|
||||
supported.add( CommsConnType.COMMS_CONN_SMS );
|
||||
}
|
||||
s_supported = supported;
|
||||
}
|
||||
return s_supported;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue