mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +01:00
wrap static Boolean to avoid NPE when uninitialized
This commit is contained in:
parent
da3452f3fa
commit
e2f3963667
1 changed files with 11 additions and 7 deletions
|
@ -267,15 +267,19 @@ public class SMSService extends XWService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Intent getIntentTo( Context context, SMSAction cmd )
|
private static Intent getIntentTo( Context context, SMSAction cmd )
|
||||||
|
{
|
||||||
|
Intent intent = new Intent( context, SMSService.class );
|
||||||
|
intent.putExtra( CMD_STR, cmd.ordinal() );
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean showToasts( Context context )
|
||||||
{
|
{
|
||||||
if ( null == s_showToasts ) {
|
if ( null == s_showToasts ) {
|
||||||
s_showToasts =
|
s_showToasts =
|
||||||
XWPrefs.getPrefsBoolean( context, R.string.key_show_sms, false );
|
XWPrefs.getPrefsBoolean( context, R.string.key_show_sms, false );
|
||||||
}
|
}
|
||||||
|
return s_showToasts;
|
||||||
Intent intent = new Intent( context, SMSService.class );
|
|
||||||
intent.putExtra( CMD_STR, cmd.ordinal() );
|
|
||||||
return intent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -328,7 +332,7 @@ public class SMSService extends XWService {
|
||||||
ConnStatusHandler.
|
ConnStatusHandler.
|
||||||
updateStatusIn( this, null,
|
updateStatusIn( this, null,
|
||||||
CommsConnType.COMMS_CONN_SMS, true );
|
CommsConnType.COMMS_CONN_SMS, true );
|
||||||
if ( s_showToasts && (0 == (m_nReceived % 5)) ) {
|
if ( showToasts( this ) && (0 == (m_nReceived % 5)) ) {
|
||||||
DbgUtils.showf( this, "Got msg %d", m_nReceived );
|
DbgUtils.showf( this, "Got msg %d", m_nReceived );
|
||||||
}
|
}
|
||||||
String phone = intent.getStringExtra( PHONE );
|
String phone = intent.getStringExtra( PHONE );
|
||||||
|
@ -377,7 +381,7 @@ public class SMSService extends XWService {
|
||||||
|
|
||||||
private void inviteRemote( String phone, String nliData )
|
private void inviteRemote( String phone, String nliData )
|
||||||
{
|
{
|
||||||
DbgUtils.logf( "inviteRemote()" );
|
DbgUtils.logf( "SMSService.inviteRemote()" );
|
||||||
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
|
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
|
||||||
DataOutputStream das = new DataOutputStream( bas );
|
DataOutputStream das = new DataOutputStream( bas );
|
||||||
try {
|
try {
|
||||||
|
@ -684,7 +688,7 @@ public class SMSService extends XWService {
|
||||||
DbgUtils.logf( "sendBuffers(): dropping because SMS disabled" );
|
DbgUtils.logf( "sendBuffers(): dropping because SMS disabled" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( s_showToasts && success && (0 == (s_nSent % 5)) ) {
|
if ( showToasts( this ) && success && (0 == (s_nSent % 5)) ) {
|
||||||
DbgUtils.showf( this, "Sent msg %d", s_nSent );
|
DbgUtils.showf( this, "Sent msg %d", s_nSent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue