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

Side by Side Diff: libadblockplus-android/src/org/adblockplus/android/Utils.java

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Patch Set: changed packages, now using AdblockEngine (original ABPEngine), improved demo app Created Oct. 25, 2016, 11:20 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 package org.adblockplus.android;
19
20 import java.io.BufferedReader;
21 import java.io.InputStreamReader;
22
23 import org.adblockplus.libadblockplus.JsValue;
24 import org.adblockplus.libadblockplus.Subscription;
25 import org.apache.commons.lang.StringUtils;
26
27 import android.app.Notification;
28 import android.app.NotificationManager;
29 import android.app.PendingIntent;
30 import android.content.Context;
31 import android.content.Intent;
32
33 public final class Utils
34 {
35 private Utils()
36 {
37 //
38 }
39
40 public static String getTag(final Class<?> clazz)
41 {
42 return clazz.getSimpleName();
43 }
44
45 public static String capitalizeString(final String s)
46 {
47 if (s == null || s.length() == 0)
48 {
49 return "";
50 }
51
52 final char first = s.charAt(0);
53
54 return Character.isUpperCase(first) ? s : Character.toUpperCase(first) + s.s ubstring(1);
55 }
56
57 public static void appendRawTextFile(final Context context, final StringBuilde r text, final int id)
58 {
59 try
60 {
61 final BufferedReader buf = new BufferedReader(new InputStreamReader(contex t.getResources().openRawResource(id)));
62
63 try
64 {
65 String line;
66 while ((line = buf.readLine()) != null)
67 {
68 text.append(line);
69 text.append('\n');
70 }
71 }
72 finally
73 {
74 buf.close();
75 }
76
77 }
78 catch (final Exception e)
79 {
80 // Ignored for now
81 }
82 }
83 }
OLDNEW

Powered by Google App Engine
This is Rietveld