diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-07-12 01:21:30 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-07-25 18:01:52 +0100 |
commit | 77ba1b25d1b31cc38af5b7f40d846aef03a455f9 (patch) | |
tree | a480f309b55b7d208461c9de55309c1691e5fdc8 /android/sdremote/src | |
parent | 5fe6ee0f9200e1087edc3b9a9e7f1fa472dff139 (diff) |
Fix broadcast manager usage.
Change-Id: Ifa4b461b537e40a65753c49f848dd8e4357e82f7
Diffstat (limited to 'android/sdremote/src')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java | 12 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java index 2ed0fabc1fcc..186e20ec7c76 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java @@ -96,7 +96,7 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv mIntentsReceiver = new IntentsReceiver(this); IntentFilter aIntentFilter = buildIntentsReceiverFilter(); - LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mIntentsReceiver, aIntentFilter); + getBroadcastManager().registerReceiver(mIntentsReceiver, aIntentFilter); } private static class IntentsReceiver extends BroadcastReceiver { @@ -137,6 +137,12 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv return aIntentFilter; } + private LocalBroadcastManager getBroadcastManager() { + Context aContext = getActivity().getApplicationContext(); + + return LocalBroadcastManager.getInstance(aContext); + } + public void setUpPinValidationInstructions(String aPin) { TextView aPinTextView = (TextView) getView().findViewById(R.id.text_pin); aPinTextView.setText(aPin); @@ -152,8 +158,6 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv } public void setUpPresentation() { - // TODO: implement - getActivity().finish(); } @@ -193,7 +197,7 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv private void unregisterIntentsReceiver() { try { - getActivity().unregisterReceiver(mIntentsReceiver); + getBroadcastManager().unregisterReceiver(mIntentsReceiver); } catch (IllegalArgumentException e) { // Receiver not registered. // Fixed in Honeycomb: Android’s issue #6191. diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java index 80cf4c0fe7fc..1652e8a768b6 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java @@ -117,7 +117,7 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo mIntentsReceiver = new IntentsReceiver(this); IntentFilter aIntentFilter = buildIntentsReceiverFilter(); - LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mIntentsReceiver, aIntentFilter); + getBroadcastManager().registerReceiver(mIntentsReceiver, aIntentFilter); } private static final class IntentsReceiver extends BroadcastReceiver { @@ -142,6 +142,12 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo return aIntentFilter; } + private LocalBroadcastManager getBroadcastManager() { + Context aContext = getActivity().getApplicationContext(); + + return LocalBroadcastManager.getInstance(aContext); + } + public void loadComputers() { if (!isServiceBound()) { return; @@ -205,7 +211,7 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo private void unregisterIntentsReceiver() { try { - getActivity().unregisterReceiver(mIntentsReceiver); + getBroadcastManager().unregisterReceiver(mIntentsReceiver); } catch (IllegalArgumentException e) { // Receiver not registered. // Fixed in Honeycomb: Android’s issue #6191. |