OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return convertJsSubscriptions(this.filterEngine.fetchAvailableSubscriptions(
)); | 193 return convertJsSubscriptions(this.filterEngine.fetchAvailableSubscriptions(
)); |
194 } | 194 } |
195 | 195 |
196 public org.adblockplus.android.Subscription[] getListedSubscriptions() | 196 public org.adblockplus.android.Subscription[] getListedSubscriptions() |
197 { | 197 { |
198 return convertJsSubscriptions(this.filterEngine.getListedSubscriptions()); | 198 return convertJsSubscriptions(this.filterEngine.getListedSubscriptions()); |
199 } | 199 } |
200 | 200 |
201 public void setSubscription(final String url) | 201 public void setSubscription(final String url) |
202 { | 202 { |
203 Subscription sub = null; | |
204 for (final Subscription s : this.filterEngine.getListedSubscriptions()) | 203 for (final Subscription s : this.filterEngine.getListedSubscriptions()) |
205 { | 204 { |
206 if (url.equals(s.getProperty("url").toString())) | |
207 { | |
208 sub = s; | |
209 } | |
210 s.removeFromList(); | 205 s.removeFromList(); |
211 } | 206 } |
| 207 |
| 208 final Subscription sub = this.filterEngine.getSubscription(url); |
212 if (sub != null) | 209 if (sub != null) |
213 { | 210 { |
214 sub.addToList(); | 211 sub.addToList(); |
215 } | 212 } |
216 } | 213 } |
217 | 214 |
218 public void refreshSubscriptions() | 215 public void refreshSubscriptions() |
219 { | 216 { |
220 for (final Subscription s : this.filterEngine.getListedSubscriptions()) | 217 for (final Subscription s : this.filterEngine.getListedSubscriptions()) |
221 { | 218 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 269 |
273 public void updateSubscriptionStatus(final String url) | 270 public void updateSubscriptionStatus(final String url) |
274 { | 271 { |
275 final Subscription sub = this.filterEngine.getSubscription(url); | 272 final Subscription sub = this.filterEngine.getSubscription(url); |
276 if (sub != null) | 273 if (sub != null) |
277 { | 274 { |
278 Utils.updateSubscriptionStatus(this.context, sub); | 275 Utils.updateSubscriptionStatus(this.context, sub); |
279 } | 276 } |
280 } | 277 } |
281 } | 278 } |
OLD | NEW |