mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
cleanup: remove unnecessary Context params
This commit is contained in:
parent
13b3905458
commit
25beb1b8d4
1 changed files with 15 additions and 16 deletions
|
@ -481,7 +481,7 @@ public class BTService extends XWService {
|
||||||
receivePing( socket );
|
receivePing( socket );
|
||||||
break;
|
break;
|
||||||
case INVITE:
|
case INVITE:
|
||||||
receiveInvitation( BTService.this, inStream, socket );
|
receiveInvitation( inStream, socket );
|
||||||
break;
|
break;
|
||||||
case MESG_SEND:
|
case MESG_SEND:
|
||||||
receiveMessage( inStream, socket );
|
receiveMessage( inStream, socket );
|
||||||
|
@ -538,19 +538,18 @@ public class BTService extends XWService {
|
||||||
updateStatusOut( true );
|
updateStatusOut( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void receiveInvitation( Context context,
|
private void receiveInvitation( DataInputStream is,
|
||||||
DataInputStream is,
|
|
||||||
BluetoothSocket socket )
|
BluetoothSocket socket )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
BTCmd result;
|
BTCmd result;
|
||||||
String asJson = is.readUTF();
|
String asJson = is.readUTF();
|
||||||
NetLaunchInfo nli = new NetLaunchInfo( context, asJson );
|
NetLaunchInfo nli = new NetLaunchInfo( BTService.this, asJson );
|
||||||
|
|
||||||
BluetoothDevice host = socket.getRemoteDevice();
|
BluetoothDevice host = socket.getRemoteDevice();
|
||||||
addAddr( host );
|
addAddr( host );
|
||||||
|
|
||||||
result = makeOrNotify( context, nli, host.getName(), host.getAddress() );
|
result = makeOrNotify( nli, host.getName(), host.getAddress() );
|
||||||
|
|
||||||
DataOutputStream os = new DataOutputStream( socket.getOutputStream() );
|
DataOutputStream os = new DataOutputStream( socket.getOutputStream() );
|
||||||
os.writeByte( result.ordinal() );
|
os.writeByte( result.ordinal() );
|
||||||
|
@ -1052,37 +1051,37 @@ public class BTService extends XWService {
|
||||||
m_sender = null;
|
m_sender = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BTCmd makeOrNotify( Context context, NetLaunchInfo nli,
|
private BTCmd makeOrNotify( NetLaunchInfo nli, String btName,
|
||||||
String btName, String btAddr )
|
String btAddr )
|
||||||
{
|
{
|
||||||
BTCmd result;
|
BTCmd result;
|
||||||
if ( DictLangCache.haveDict( context, nli.lang, nli.dict ) ) {
|
if ( DictLangCache.haveDict( this, nli.lang, nli.dict ) ) {
|
||||||
result = makeGame( context, nli, btName, btAddr );
|
result = makeGame( nli, btName, btAddr );
|
||||||
} else {
|
} else {
|
||||||
Intent intent = MultiService
|
Intent intent = MultiService
|
||||||
.makeMissingDictIntent( context, nli,
|
.makeMissingDictIntent( this, nli,
|
||||||
DictFetchOwner.OWNER_BT );
|
DictFetchOwner.OWNER_BT );
|
||||||
// NetLaunchInfo.putExtras( intent, gameID, btName, btAddr );
|
// NetLaunchInfo.putExtras( intent, gameID, btName, btAddr );
|
||||||
MultiService.postMissingDictNotification( context, intent,
|
MultiService.postMissingDictNotification( this, intent,
|
||||||
nli.gameID() );
|
nli.gameID() );
|
||||||
result = BTCmd.INVITE_ACCPT; // ???
|
result = BTCmd.INVITE_ACCPT; // ???
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BTCmd makeGame( Context context, NetLaunchInfo nli,
|
private BTCmd makeGame( NetLaunchInfo nli, String sender,
|
||||||
String sender, String senderAddress )
|
String senderAddress )
|
||||||
{
|
{
|
||||||
BTCmd result;
|
BTCmd result;
|
||||||
long[] rowids = DBUtils.getRowIDsFor( BTService.this, nli.gameID() );
|
long[] rowids = DBUtils.getRowIDsFor( BTService.this, nli.gameID() );
|
||||||
if ( null == rowids || 0 == rowids.length ) {
|
if ( null == rowids || 0 == rowids.length ) {
|
||||||
CommsAddrRec addr = nli.makeAddrRec( context );
|
CommsAddrRec addr = nli.makeAddrRec( BTService.this );
|
||||||
long rowid = GameUtils.makeNewMultiGame( context, nli, m_btMsgSink );
|
long rowid = GameUtils.makeNewMultiGame( BTService.this, nli, m_btMsgSink );
|
||||||
if ( DBUtils.ROWID_NOTFOUND == rowid ) {
|
if ( DBUtils.ROWID_NOTFOUND == rowid ) {
|
||||||
result = BTCmd.INVITE_FAILED;
|
result = BTCmd.INVITE_FAILED;
|
||||||
} else {
|
} else {
|
||||||
if ( null != nli.gameName && 0 < nli.gameName.length() ) {
|
if ( null != nli.gameName && 0 < nli.gameName.length() ) {
|
||||||
DBUtils.setName( context, rowid, nli.gameName );
|
DBUtils.setName( BTService.this, rowid, nli.gameName );
|
||||||
}
|
}
|
||||||
result = BTCmd.INVITE_ACCPT;
|
result = BTCmd.INVITE_ACCPT;
|
||||||
String body = LocUtils.getString( BTService.this,
|
String body = LocUtils.getString( BTService.this,
|
||||||
|
|
Loading…
Reference in a new issue