Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 |
(...skipping 27 matching lines...) Expand all Loading... | |
38 import android.text.TextUtils; | 38 import android.text.TextUtils; |
39 import android.util.Log; | 39 import android.util.Log; |
40 import android.view.View; | 40 import android.view.View; |
41 import android.widget.ScrollView; | 41 import android.widget.ScrollView; |
42 import android.widget.TextView; | 42 import android.widget.TextView; |
43 import android.widget.Toast; | 43 import android.widget.Toast; |
44 | 44 |
45 /** | 45 /** |
46 * Advanced settings UI. | 46 * Advanced settings UI. |
47 */ | 47 */ |
48 @SuppressWarnings("deprecation") | |
Felix Dahlke
2014/04/28 07:29:01
I don't think we should ignore this, in general pr
René Jeschke
2014/04/28 08:34:32
Those deprecation warnings can only be resolved by
Felix Dahlke
2014/04/28 10:09:41
It may make sense then, however, I think it belong
René Jeschke
2014/04/28 10:18:34
Done.
| |
49 public class AdvancedPreferences extends SummarizedPreferences | 48 public class AdvancedPreferences extends SummarizedPreferences |
50 { | 49 { |
51 private static final String TAG = Utils.getTag(AdvancedPreferences.class); | 50 private static final String TAG = Utils.getTag(AdvancedPreferences.class); |
51 | |
52 private static final int CONFIGURATION_DIALOG = 1; | 52 private static final int CONFIGURATION_DIALOG = 1; |
53 | 53 |
54 private ProxyService proxyService = null; | 54 private ProxyService proxyService = null; |
55 | 55 |
56 @Override | 56 @Override |
57 public void onCreate(final Bundle savedInstanceState) | 57 public void onCreate(final Bundle savedInstanceState) |
58 { | 58 { |
59 super.onCreate(savedInstanceState); | 59 super.onCreate(savedInstanceState); |
60 | 60 |
61 addPreferencesFromResource(R.xml.preferences_advanced); | 61 addPreferencesFromResource(R.xml.preferences_advanced); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 if (ProxyService.NATIVE_PROXY_SUPPORTED) | 198 if (ProxyService.NATIVE_PROXY_SUPPORTED) |
199 { | 199 { |
200 final String[] px = ProxySettings.getUserProxy(getApplicationContext ()); | 200 final String[] px = ProxySettings.getUserProxy(getApplicationContext ()); |
201 if (px != null) | 201 if (px != null) |
202 { | 202 { |
203 items.add("System settings:"); | 203 items.add("System settings:"); |
204 items.add(String.format("Host: [%s] Port: [%s] Excl: [%s]", px[0], px[1], px[2])); | 204 items.add(String.format("Host: [%s] Port: [%s] Excl: [%s]", px[0], px[1], px[2])); |
205 } | 205 } |
206 } | 206 } |
207 items.add("Proxy settings:"); | 207 items.add("Proxy settings:"); |
208 items.add(String.format("Host: [%s] Port: [%s] Excl: [%s]", proxyServi ce.proxy.props.getProperty("adblock.proxyHost"), | 208 items.add(String.format("Host: [%s] Port: [%s] Excl: [%s]", proxyServi ce.proxy.props.getProperty("adblock.proxyHost"), proxyService.proxy.props.getPro perty("adblock.proxyPort"), |
Felix Dahlke
2014/04/28 07:29:01
Seems like this adds a lot of trailing whitespace,
René Jeschke
2014/04/28 08:34:32
Nope, just the diff view gone mad.
| |
209 proxyService.proxy.props.getProperty("adblock.proxyPort"), | |
210 proxyService.proxy.props.getProperty("adblock.proxyExcl"))); | 209 proxyService.proxy.props.getProperty("adblock.proxyExcl"))); |
211 if (proxyService.proxy.props.getProperty("adblock.auth") != null) | 210 if (proxyService.proxy.props.getProperty("adblock.auth") != null) |
212 items.add("Auth: yes"); | 211 items.add("Auth: yes"); |
213 } | 212 } |
214 else | 213 else |
215 { | 214 { |
216 items.add("Service not running"); | 215 items.add("Service not running"); |
217 } | 216 } |
218 | 217 |
219 final ScrollView scrollPane = new ScrollView(this); | 218 final ScrollView scrollPane = new ScrollView(this); |
220 final TextView messageText = new TextView(this); | 219 final TextView messageText = new TextView(this); |
221 messageText.setPadding(12, 6, 12, 6); | 220 messageText.setPadding(12, 6, 12, 6); |
222 messageText.setText(TextUtils.join("\n", items)); | 221 messageText.setText(TextUtils.join("\n", items)); |
223 messageText.setOnClickListener(new View.OnClickListener() | 222 messageText.setOnClickListener(new View.OnClickListener() |
224 { | 223 { |
224 | |
225 @Override | 225 @Override |
226 public void onClick(final View v) | 226 public void onClick(final View v) |
227 { | 227 { |
228 final ClipboardManager manager = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); | 228 final ClipboardManager manager = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); |
229 final TextView showTextParam = (TextView) v; | 229 final TextView showTextParam = (TextView) v; |
230 manager.setText(showTextParam.getText()); | 230 manager.setText(showTextParam.getText()); |
231 Toast.makeText(v.getContext(), R.string.msg_clipboard, Toast.LENGTH_ SHORT).show(); | 231 Toast.makeText(v.getContext(), R.string.msg_clipboard, Toast.LENGTH_ SHORT).show(); |
232 } | 232 } |
233 }); | 233 }); |
234 scrollPane.addView(messageText); | 234 scrollPane.addView(messageText); |
235 | 235 |
236 final AlertDialog.Builder builder = new AlertDialog.Builder(this); | 236 final AlertDialog.Builder builder = new AlertDialog.Builder(this); |
237 builder.setView(scrollPane).setTitle(R.string.configuration_name).setIco n(android.R.drawable.ic_dialog_info).setCancelable(false) | 237 builder.setView(scrollPane).setTitle(R.string.configuration_name).setIco n(android.R.drawable.ic_dialog_info).setCancelable(false) |
238 .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener( ) | 238 .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener( ) |
239 { | 239 { |
240 @Override | 240 @Override |
Felix Dahlke
2014/04/28 07:29:01
I remarked about this before, but IIRC, the situat
René Jeschke
2014/04/28 08:34:32
The whole Adblock Plus Android gets checked/compil
Felix Dahlke
2014/04/28 10:09:41
Alright, thought it was Java 5 for some reason.
René Jeschke
2014/04/28 10:18:34
Done.
| |
241 public void onClick(final DialogInterface dialog, final int id) | 241 public void onClick(final DialogInterface dialog, final int id) |
242 { | 242 { |
243 dialog.cancel(); | 243 dialog.cancel(); |
244 } | 244 } |
245 }); | 245 }); |
246 dialog = builder.create(); | 246 dialog = builder.create(); |
247 break; | 247 break; |
248 } | 248 } |
249 return dialog; | 249 return dialog; |
250 } | 250 } |
(...skipping 19 matching lines...) Expand all Loading... | |
270 } | 270 } |
271 | 271 |
272 @Override | 272 @Override |
273 public void onServiceDisconnected(final ComponentName className) | 273 public void onServiceDisconnected(final ComponentName className) |
274 { | 274 { |
275 proxyService = null; | 275 proxyService = null; |
276 Log.d(TAG, "Proxy service disconnected"); | 276 Log.d(TAG, "Proxy service disconnected"); |
277 } | 277 } |
278 }; | 278 }; |
279 } | 279 } |
LEFT | RIGHT |