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

Side by Side Diff: src/org/adblockplus/android/AdblockPlus.java

Issue 9433002: ABP/Android Proxy settings user helper (Closed)
Patch Set: Created Feb. 20, 2013, 8:49 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
1 /* 1 /*
2 * This file is part of the Adblock Plus, 2 * This file is part of the Adblock Plus,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 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; 20 import java.io.BufferedReader;
21 import java.io.File; 21 import java.io.File;
22 import java.io.FileInputStream; 22 import java.io.FileInputStream;
23 import java.io.FileNotFoundException; 23 import java.io.FileNotFoundException;
24 import java.io.FileOutputStream; 24 import java.io.FileOutputStream;
25 import java.io.IOException; 25 import java.io.IOException;
26 import java.io.InputStream;
26 import java.io.InputStreamReader; 27 import java.io.InputStreamReader;
27 import java.net.HttpURLConnection; 28 import java.net.HttpURLConnection;
28 import java.net.URL; 29 import java.net.URL;
29 import java.util.ArrayList; 30 import java.util.ArrayList;
30 import java.util.Calendar; 31 import java.util.Calendar;
31 import java.util.LinkedList; 32 import java.util.LinkedList;
32 import java.util.List; 33 import java.util.List;
33 import java.util.Locale; 34 import java.util.Locale;
34 import java.util.Map; 35 import java.util.Map;
35 import java.util.TimeZone; 36 import java.util.TimeZone;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 public static String getDeviceName() 129 public static String getDeviceName()
129 { 130 {
130 String manufacturer = Build.MANUFACTURER; 131 String manufacturer = Build.MANUFACTURER;
131 String model = Build.MODEL; 132 String model = Build.MODEL;
132 if (model.startsWith(manufacturer)) 133 if (model.startsWith(manufacturer))
133 return capitalize(model); 134 return capitalize(model);
134 else 135 else
135 return capitalize(manufacturer) + " " + model; 136 return capitalize(manufacturer) + " " + model;
136 } 137 }
137 138
139 public static void appendRawTextFile(Context context, StringBuilder text, int id)
140 {
141 InputStream inputStream = context.getResources().openRawResource(id);
142 InputStreamReader in = new InputStreamReader(inputStream);
143 BufferedReader buf = new BufferedReader(in);
144 String line;
145 try
146 {
147 while ((line = buf.readLine()) != null)
148 text.append(line);
149 }
150 catch (IOException e)
151 {
152 e.printStackTrace();
153 }
154 }
155
138 private static String capitalize(String s) 156 private static String capitalize(String s)
139 { 157 {
140 if (s == null || s.length() == 0) 158 if (s == null || s.length() == 0)
141 return ""; 159 return "";
142 char first = s.charAt(0); 160 char first = s.charAt(0);
143 if (Character.isUpperCase(first)) 161 if (Character.isUpperCase(first))
144 return s; 162 return s;
145 else 163 else
146 return Character.toUpperCase(first) + s.substring(1); 164 return Character.toUpperCase(first) + s.substring(1);
147 } 165 }
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1061 }
1044 return result; 1062 return result;
1045 } 1063 }
1046 1064
1047 protected void onProgressUpdate(Integer... progress) 1065 protected void onProgressUpdate(Integer... progress)
1048 { 1066 {
1049 Log.d("HTTP", "Progress: " + progress[0].intValue()); 1067 Log.d("HTTP", "Progress: " + progress[0].intValue());
1050 } 1068 }
1051 } 1069 }
1052 } 1070 }
OLDNEW

Powered by Google App Engine
This is Rietveld