OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (showAbout) | 210 if (showAbout) |
211 onAbout(findViewById(R.id.btn_about)); | 211 onAbout(findViewById(R.id.btn_about)); |
212 | 212 |
213 bindService(new Intent(this, ProxyService.class), proxyServiceConnection, 0)
; | 213 bindService(new Intent(this, ProxyService.class), proxyServiceConnection, 0)
; |
214 } | 214 } |
215 | 215 |
216 @Override | 216 @Override |
217 public void onPause() | 217 public void onPause() |
218 { | 218 { |
219 super.onPause(); | 219 super.onPause(); |
220 unregisterReceiver(receiver); | 220 try |
| 221 { |
| 222 unregisterReceiver(receiver); |
| 223 } |
| 224 catch (IllegalArgumentException e) |
| 225 { |
| 226 // ignore - it is thrown if receiver is not registered but it can not be t
rue in normal conditions |
| 227 } |
221 unbindService(proxyServiceConnection); | 228 unbindService(proxyServiceConnection); |
222 proxyService = null; | 229 proxyService = null; |
223 } | 230 } |
224 | 231 |
225 @Override | 232 @Override |
226 protected void onStop() | 233 protected void onStop() |
227 { | 234 { |
228 super.onStop(); | 235 super.onStop(); |
229 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this
); | 236 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this
); |
230 boolean enabled = prefs.getBoolean(getString(R.string.pref_enabled), false); | 237 boolean enabled = prefs.getBoolean(getString(R.string.pref_enabled), false); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 showConfigurationMsg(getString(R.string.msg_configuration, proxyServic
e.port)); | 515 showConfigurationMsg(getString(R.string.msg_configuration, proxyServic
e.port)); |
509 } | 516 } |
510 | 517 |
511 public void onServiceDisconnected(ComponentName className) | 518 public void onServiceDisconnected(ComponentName className) |
512 { | 519 { |
513 proxyService = null; | 520 proxyService = null; |
514 Log.d(TAG, "Proxy service disconnected"); | 521 Log.d(TAG, "Proxy service disconnected"); |
515 } | 522 } |
516 }; | 523 }; |
517 } | 524 } |
OLD | NEW |