Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/Utils.java

Issue 5662276015095808: Issue 1540 - Utility method for loading text is at the wrong location (Closed)
Patch Set: Created Nov. 6, 2014, 1:06 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/org/adblockplus/android/ProxyConfigurationActivity.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/Utils.java
diff --git a/src/org/adblockplus/android/Utils.java b/src/org/adblockplus/android/Utils.java
index 6bc4c348ff562544b5903288b1999df090bc1f57..a07b668faa4127b45fefca8d8acb2ddcde1d7fd4 100644
--- a/src/org/adblockplus/android/Utils.java
+++ b/src/org/adblockplus/android/Utils.java
@@ -17,6 +17,9 @@
package org.adblockplus.android;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
import org.adblockplus.android.updater.UpdaterActivity;
import org.adblockplus.libadblockplus.JsValue;
import org.adblockplus.libadblockplus.Subscription;
@@ -120,4 +123,31 @@ public final class Utils
.putExtra("status", status)
.putExtra("time", time * 1000L));
}
+
+ public static void appendRawTextFile(final Context context, final StringBuilder text, final int id)
+ {
+ try
+ {
+ final BufferedReader buf = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(id)));
+
+ try
+ {
+ String line;
+ while ((line = buf.readLine()) != null)
+ {
+ text.append(line);
+ 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,
+ }
+ }
+ finally
+ {
+ buf.close();
+ }
+
+ }
+ catch (final Exception e)
+ {
+ // Ignored for now
+ }
+ }
}
« no previous file with comments | « src/org/adblockplus/android/ProxyConfigurationActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld