LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 else if (preference.getKey().equals(SETTINGS_FILTER_LISTS_KEY)) | 211 else if (preference.getKey().equals(SETTINGS_FILTER_LISTS_KEY)) |
212 { | 212 { |
213 handleFilterListsChanged((Set<String>) newValue); | 213 handleFilterListsChanged((Set<String>) newValue); |
214 } | 214 } |
215 else if (preference.getKey().equals(SETTINGS_AA_ENABLED_KEY)) | 215 else if (preference.getKey().equals(SETTINGS_AA_ENABLED_KEY)) |
216 { | 216 { |
217 handleAcceptableAdsEnabledChanged((Boolean) newValue); | 217 handleAcceptableAdsEnabledChanged((Boolean) newValue); |
218 } | 218 } |
219 else if (preference.getKey().equals(SETTINGS_ALLOWED_CONNECTION_TYPE_KEY)) | 219 else if (preference.getKey().equals(SETTINGS_ALLOWED_CONNECTION_TYPE_KEY)) |
220 { | 220 { |
221 handleUpdatesConnectionTypeChanged((String) newValue); | 221 handleAllowedConnectionTypeChanged((String) newValue); |
222 } | 222 } |
223 else | 223 else |
224 { | 224 { |
225 // handle other values if changed | 225 // handle other values if changed |
226 // `false` for NOT update preference view state | 226 // `false` for NOT update preference view state |
227 return false; | 227 return false; |
228 } | 228 } |
229 | 229 |
230 // `true` for update preference view state | 230 // `true` for update preference view state |
231 return true; | 231 return true; |
232 } | 232 } |
233 | 233 |
234 private void handleUpdatesConnectionTypeChanged(String value) | 234 private void handleAllowedConnectionTypeChanged(String value) |
235 { | 235 { |
236 // update and save settings | 236 // update and save settings |
237 settings.setAllowedConnectionType(ConnectionType.findByValue(value)); | 237 settings.setAllowedConnectionType(ConnectionType.findByValue(value)); |
238 provider.getAdblockSettingsStorage().save(settings); | 238 provider.getAdblockSettingsStorage().save(settings); |
239 | 239 |
240 // apply settings | 240 // apply settings |
241 allowedConnectionType.setValue(value); | 241 allowedConnectionType.setValue(value); |
242 provider.getAdblockEngine().getFilterEngine().setAllowedConnectionType(value
); | 242 provider.getAdblockEngine().getFilterEngine().setAllowedConnectionType(value
); |
243 | 243 |
244 // signal event | 244 // signal event |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 else | 321 else |
322 { | 322 { |
323 // should not be invoked as only 'wl' preference is subscribed for callbac
k | 323 // should not be invoked as only 'wl' preference is subscribed for callbac
k |
324 return false; | 324 return false; |
325 } | 325 } |
326 | 326 |
327 return true; | 327 return true; |
328 } | 328 } |
329 } | 329 } |
LEFT | RIGHT |