diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-09-07 11:11:54 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-09-07 11:12:37 +0200 |
commit | 36bb1a3158a5d5a0ce35507799de794b80dfd080 (patch) | |
tree | 043cdbc99c293859f004fe9f14d23b514f2dc121 /android | |
parent | 08de755c078b96922ea7693553e4f4b5e7bab740 (diff) |
Fix some serviceconnection issues and more bluetooth power managment.
Change-Id: Id2e309ee5b8f6feff845dba28e7474e2246865f5
Diffstat (limited to 'android')
4 files changed, 10 insertions, 3 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java index 76641f97a9c3..073347382dfc 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java @@ -83,9 +83,13 @@ public class PairingActivity extends SherlockActivity { @Override public void onReceive(Context aContext, Intent aIntent) { + if (mCommunicationService == null) { + return; + } if (aIntent.getAction().equals( CommunicationService.MSG_PAIRING_STARTED)) { String aPin = aIntent.getStringExtra("PIN"); + mPinText.setText(aPin); // refreshLists(); } else if (aIntent.getAction().equals( diff --git a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java index b21fe662806d..98026fd055df 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java @@ -41,6 +41,7 @@ public class StartPresentationActivity extends SherlockActivity { @Override protected void onDestroy() { super.onDestroy(); + unbindService(mConnection); LocalBroadcastManager.getInstance(this).unregisterReceiver(mListener); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java index dc1d6d09b80d..c495e4c6688c 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java @@ -29,11 +29,12 @@ public class BluetoothClient extends Client { private BluetoothAdapter mAdapter; public BluetoothClient(Server aServer, - CommunicationService aCommunicationService) { + CommunicationService aCommunicationService, + boolean aBluetoothWasEnabled) { super(aServer, aCommunicationService); try { mAdapter = BluetoothAdapter.getDefaultAdapter(); - mBluetoothWasEnabled = mAdapter.isEnabled(); + mBluetoothWasEnabled = aBluetoothWasEnabled; if (!mBluetoothWasEnabled) { mAdapter.enable(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index 8a8290daae18..8a42f701087a 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -89,7 +89,8 @@ public class CommunicationService extends Service implements Runnable { mClient = new NetworkClient(mServerDesired, this); break; case BLUETOOTH: - mClient = new BluetoothClient(mServerDesired, this); + mClient = new BluetoothClient(mServerDesired, this, + mBluetoothPreviouslyEnabled); break; } mTransmitter = new Transmitter(mClient); |