| OLD | NEW |
| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 { | 416 { |
| 417 additional++; | 417 additional++; |
| 418 engine.subscriptions.add(sub); | 418 engine.subscriptions.add(sub); |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 | 421 |
| 422 Log.d(TAG, "Added " + additional + " additional default/built-in subscript
ions"); | 422 Log.d(TAG, "Added " + additional + " additional default/built-in subscript
ions"); |
| 423 engine.subscriptions.persistSubscriptions(); | 423 engine.subscriptions.persistSubscriptions(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 engine.handlerThread = new Thread(new EventHandler(engine)); |
| 427 engine.handlerThread.setDaemon(true); |
| 428 engine.handlerThread.start(); |
| 429 |
| 430 engine.downloader = Downloader.create(context, engine); |
| 431 |
| 426 final File cachedFilterFile = getCachedFilterFile(context); | 432 final File cachedFilterFile = getCachedFilterFile(context); |
| 427 if (cachedFilterFile == null || !cachedFilterFile.exists()) | 433 if (cachedFilterFile == null || !cachedFilterFile.exists()) |
| 428 { | 434 { |
| 429 engine.sendUpdateBroadcast(); | 435 engine.sendUpdateBroadcast(); |
| 430 } | 436 } |
| 431 | 437 |
| 432 engine.handlerThread = new Thread(new EventHandler(engine)); | |
| 433 engine.handlerThread.setDaemon(true); | |
| 434 engine.handlerThread.start(); | |
| 435 | |
| 436 engine.downloader = Downloader.create(context, engine); | |
| 437 | |
| 438 return engine; | 438 return engine; |
| 439 } | 439 } |
| 440 | 440 |
| 441 public static String readFileAsString(InputStream instream) throws IOException | 441 public static String readFileAsString(InputStream instream) throws IOException |
| 442 { | 442 { |
| 443 final StringBuilder sb = new StringBuilder(); | 443 final StringBuilder sb = new StringBuilder(); |
| 444 final BufferedReader r = new BufferedReader(new InputStreamReader(instream,
CHARSET_UTF_8)); | 444 final BufferedReader r = new BufferedReader(new InputStreamReader(instream,
CHARSET_UTF_8)); |
| 445 for (int ch = r.read(); ch != -1; ch = r.read()) | 445 for (int ch = r.read(); ch != -1; ch = r.read()) |
| 446 { | 446 { |
| 447 sb.append((char) ch); | 447 sb.append((char) ch); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 Log.d(TAG, headers.toString()); | 728 Log.d(TAG, headers.toString()); |
| 729 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(),
headers); | 729 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(),
headers); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 | 732 |
| 733 public void connectivityChanged() | 733 public void connectivityChanged() |
| 734 { | 734 { |
| 735 this.downloader.connectivityChanged(); | 735 this.downloader.connectivityChanged(); |
| 736 } | 736 } |
| 737 } | 737 } |
| OLD | NEW |