mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-13 08:47:50 +01:00
refactor a tiny bit
This commit is contained in:
parent
b983b5abb6
commit
e614ba697d
1 changed files with 13 additions and 6 deletions
|
@ -174,7 +174,7 @@ public class SMSService extends XWService {
|
||||||
public static void stopService( Context context )
|
public static void stopService( Context context )
|
||||||
{
|
{
|
||||||
Intent intent = getIntentTo( context, SMSAction.STOP_SELF );
|
Intent intent = getIntentTo( context, SMSAction.STOP_SELF );
|
||||||
context.startService( intent );
|
startService( context, intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
// NBS case
|
// NBS case
|
||||||
|
@ -184,7 +184,7 @@ public class SMSService extends XWService {
|
||||||
Intent intent = getIntentTo( context, SMSAction.HANDLEDATA );
|
Intent intent = getIntentTo( context, SMSAction.HANDLEDATA );
|
||||||
intent.putExtra( BUFFER, buffer );
|
intent.putExtra( BUFFER, buffer );
|
||||||
intent.putExtra( PHONE, phone );
|
intent.putExtra( PHONE, phone );
|
||||||
context.startService( intent );
|
startService( context, intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void inviteRemote( Context context, String phone,
|
public static void inviteRemote( Context context, String phone,
|
||||||
|
@ -195,7 +195,7 @@ public class SMSService extends XWService {
|
||||||
Log.w( TAG, "inviteRemote(%s, '%s')", phone, nli );
|
Log.w( TAG, "inviteRemote(%s, '%s')", phone, nli );
|
||||||
byte[] data = nli.asByteArray();
|
byte[] data = nli.asByteArray();
|
||||||
intent.putExtra( GAMEDATA_BA, data );
|
intent.putExtra( GAMEDATA_BA, data );
|
||||||
context.startService( intent );
|
startService( context, intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int sendPacket( Context context, String phone,
|
public static int sendPacket( Context context, String phone,
|
||||||
|
@ -207,7 +207,7 @@ public class SMSService extends XWService {
|
||||||
intent.putExtra( PHONE, phone );
|
intent.putExtra( PHONE, phone );
|
||||||
intent.putExtra( MultiService.GAMEID, gameID );
|
intent.putExtra( MultiService.GAMEID, gameID );
|
||||||
intent.putExtra( BINBUFFER, binmsg );
|
intent.putExtra( BINBUFFER, binmsg );
|
||||||
context.startService( intent );
|
startService( context, intent );
|
||||||
nSent = binmsg.length;
|
nSent = binmsg.length;
|
||||||
} else {
|
} else {
|
||||||
Log.i( TAG, "sendPacket: dropping because SMS disabled" );
|
Log.i( TAG, "sendPacket: dropping because SMS disabled" );
|
||||||
|
@ -220,14 +220,14 @@ public class SMSService extends XWService {
|
||||||
Intent intent = getIntentTo( context, SMSAction.REMOVE );
|
Intent intent = getIntentTo( context, SMSAction.REMOVE );
|
||||||
intent.putExtra( PHONE, phone );
|
intent.putExtra( PHONE, phone );
|
||||||
intent.putExtra( MultiService.GAMEID, gameID );
|
intent.putExtra( MultiService.GAMEID, gameID );
|
||||||
context.startService( intent );
|
startService( context, intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onGameDictDownload( Context context, Intent intentOld )
|
public static void onGameDictDownload( Context context, Intent intentOld )
|
||||||
{
|
{
|
||||||
Intent intent = getIntentTo( context, SMSAction.ADDED_MISSING );
|
Intent intent = getIntentTo( context, SMSAction.ADDED_MISSING );
|
||||||
intent.fillIn( intentOld, 0 );
|
intent.fillIn( intentOld, 0 );
|
||||||
context.startService( intent );
|
startService( context, intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String fromPublicFmt( String msg )
|
public static String fromPublicFmt( String msg )
|
||||||
|
@ -255,6 +255,12 @@ public class SMSService extends XWService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void startService( Context context, Intent intent )
|
||||||
|
{
|
||||||
|
Log.d( TAG, "startService(%s)", intent );
|
||||||
|
context.startService( intent );
|
||||||
|
}
|
||||||
|
|
||||||
private static Intent getIntentTo( Context context, SMSAction cmd )
|
private static Intent getIntentTo( Context context, SMSAction cmd )
|
||||||
{
|
{
|
||||||
Intent intent = new Intent( context, SMSService.class );
|
Intent intent = new Intent( context, SMSService.class );
|
||||||
|
@ -311,6 +317,7 @@ public class SMSService extends XWService {
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand( Intent intent, int flags, int startId )
|
public int onStartCommand( Intent intent, int flags, int startId )
|
||||||
{
|
{
|
||||||
|
// Log.d( TAG, "onStartCommand(%s)", intent );
|
||||||
int result = Service.START_NOT_STICKY;
|
int result = Service.START_NOT_STICKY;
|
||||||
if ( null != intent ) {
|
if ( null != intent ) {
|
||||||
int ordinal = intent.getIntExtra( CMD_STR, -1 );
|
int ordinal = intent.getIntExtra( CMD_STR, -1 );
|
||||||
|
|
Loading…
Add table
Reference in a new issue