| Left: | ||
| Right: |
| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 package org.adblockplus.android; | 18 package org.adblockplus.android; |
| 19 | 19 |
| 20 import java.io.BufferedReader; | |
| 21 import java.io.InputStreamReader; | |
| 22 | |
| 20 import org.adblockplus.android.updater.UpdaterActivity; | 23 import org.adblockplus.android.updater.UpdaterActivity; |
| 21 import org.adblockplus.libadblockplus.JsValue; | 24 import org.adblockplus.libadblockplus.JsValue; |
| 22 import org.adblockplus.libadblockplus.Subscription; | 25 import org.adblockplus.libadblockplus.Subscription; |
| 23 import org.apache.commons.lang.StringUtils; | 26 import org.apache.commons.lang.StringUtils; |
| 24 | 27 |
| 25 import android.app.Notification; | 28 import android.app.Notification; |
| 26 import android.app.NotificationManager; | 29 import android.app.NotificationManager; |
| 27 import android.app.PendingIntent; | 30 import android.app.PendingIntent; |
| 28 import android.content.Context; | 31 import android.content.Context; |
| 29 import android.content.Intent; | 32 import android.content.Intent; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 { | 116 { |
| 114 time = lastDownload; | 117 time = lastDownload; |
| 115 status = "synchronize_last_at"; | 118 status = "synchronize_last_at"; |
| 116 } | 119 } |
| 117 | 120 |
| 118 context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS) | 121 context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS) |
| 119 .putExtra("url", sub.getProperty("url").toString()) | 122 .putExtra("url", sub.getProperty("url").toString()) |
| 120 .putExtra("status", status) | 123 .putExtra("status", status) |
| 121 .putExtra("time", time * 1000L)); | 124 .putExtra("time", time * 1000L)); |
| 122 } | 125 } |
| 126 | |
| 127 public static void appendRawTextFile(final Context context, final StringBuilde r text, final int id) | |
| 128 { | |
| 129 try | |
| 130 { | |
| 131 final BufferedReader buf = new BufferedReader(new InputStreamReader(contex t.getResources().openRawResource(id))); | |
| 132 | |
| 133 try | |
| 134 { | |
| 135 String line; | |
| 136 while ((line = buf.readLine()) != null) | |
| 137 { | |
| 138 text.append(line); | |
| 139 text.append('\n'); | |
|
Felix Dahlke
2014/11/11 09:21:46
I wonder why it worked before when we were cutting
René Jeschke
2014/11/11 11:57:00
Yep, seems like we always only loaded HTML so far,
| |
| 140 } | |
| 141 } | |
| 142 finally | |
| 143 { | |
| 144 buf.close(); | |
| 145 } | |
| 146 | |
| 147 } | |
| 148 catch (final Exception e) | |
| 149 { | |
| 150 // Ignored for now | |
| 151 } | |
| 152 } | |
| 123 } | 153 } |
| OLD | NEW |