mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
hide the expandable headers completely when BT or SMS isn't available
This commit is contained in:
parent
3e72da8e3f
commit
cfba0411fe
2 changed files with 24 additions and 10 deletions
|
@ -139,6 +139,12 @@ public class BTService extends XWService {
|
|||
private BTListenerThread m_listener;
|
||||
private BTSenderThread m_sender;
|
||||
|
||||
public static boolean BTAvailable()
|
||||
{
|
||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
return null != adapter;
|
||||
}
|
||||
|
||||
public static boolean BTEnabled()
|
||||
{
|
||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
|
|
|
@ -401,7 +401,11 @@ public class NewGameDelegate extends DelegateBase {
|
|||
|
||||
private void checkEnableBT( boolean force )
|
||||
{
|
||||
if ( XWApp.BTSUPPORTED ) {
|
||||
boolean available = XWApp.BTSUPPORTED && BTService.BTAvailable();
|
||||
setVisibility( R.id.newgame_bt_header,
|
||||
available? View.VISIBLE : View.GONE );
|
||||
|
||||
if ( available ) {
|
||||
boolean enabled = BTService.BTEnabled();
|
||||
|
||||
if ( force || enabled != m_showsOn ) {
|
||||
|
@ -447,16 +451,20 @@ public class NewGameDelegate extends DelegateBase {
|
|||
}
|
||||
|
||||
private void checkEnableSMS()
|
||||
{
|
||||
if ( XWApp.SMSSUPPORTED && Utils.deviceSupportsSMS(m_activity) ) {
|
||||
boolean enabled = XWPrefs.getSMSEnabled( m_activity );
|
||||
findViewById( R.id.newgame_sms_header ).
|
||||
setVisibility( View.VISIBLE );
|
||||
{
|
||||
boolean available = XWApp.SMSSUPPORTED
|
||||
&& Utils.deviceSupportsSMS(m_activity);
|
||||
setVisibility( R.id.newgame_sms_header,
|
||||
available? View.VISIBLE : View.GONE );
|
||||
|
||||
findViewById( R.id.sms_disabled ).
|
||||
setVisibility( enabled ? View.GONE : View.VISIBLE );
|
||||
findViewById( R.id.sms_stuff ).
|
||||
setVisibility( enabled ? View.VISIBLE : View.GONE );
|
||||
if ( available ) {
|
||||
boolean enabled = XWPrefs.getSMSEnabled( m_activity );
|
||||
setVisibility( R.id.newgame_sms_header, View.VISIBLE );
|
||||
|
||||
setVisibility( R.id.sms_disabled,
|
||||
enabled ? View.GONE : View.VISIBLE );
|
||||
setVisibility( R.id.sms_stuff,
|
||||
enabled ? View.VISIBLE : View.GONE );
|
||||
|
||||
Button button;
|
||||
if ( enabled ) {
|
||||
|
|
Loading…
Reference in a new issue