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

Delta Between Two Patch Sets: src/org/adblockplus/android/AdvancedPreferences.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Left Patch Set: Removed another whitespace change Created April 28, 2014, 8:36 a.m.
Right Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 30 matching lines...) Expand all
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 public class AdvancedPreferences extends SummarizedPreferences 48 public class AdvancedPreferences extends SummarizedPreferences
49 { 49 {
50 private static final String TAG = Utils.getTag(AdvancedPreferences.class); 50 private static final String TAG = Utils.getTag(AdvancedPreferences.class);
51
51 private static final int CONFIGURATION_DIALOG = 1; 52 private static final int CONFIGURATION_DIALOG = 1;
52 53
53 private ProxyService proxyService = null; 54 private ProxyService proxyService = null;
54 55
55 @Override 56 @Override
56 public void onCreate(final Bundle savedInstanceState) 57 public void onCreate(final Bundle savedInstanceState)
57 { 58 {
58 super.onCreate(savedInstanceState); 59 super.onCreate(savedInstanceState);
59 60
60 addPreferencesFromResource(R.xml.preferences_advanced); 61 addPreferencesFromResource(R.xml.preferences_advanced);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (ProxyService.NATIVE_PROXY_SUPPORTED) 198 if (ProxyService.NATIVE_PROXY_SUPPORTED)
198 { 199 {
199 final String[] px = ProxySettings.getUserProxy(getApplicationContext ()); 200 final String[] px = ProxySettings.getUserProxy(getApplicationContext ());
200 if (px != null) 201 if (px != null)
201 { 202 {
202 items.add("System settings:"); 203 items.add("System settings:");
203 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]));
204 } 205 }
205 } 206 }
206 items.add("Proxy settings:"); 207 items.add("Proxy settings:");
207 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"),
208 proxyService.proxy.props.getProperty("adblock.proxyPort"),
209 proxyService.proxy.props.getProperty("adblock.proxyExcl"))); 209 proxyService.proxy.props.getProperty("adblock.proxyExcl")));
210 if (proxyService.proxy.props.getProperty("adblock.auth") != null) 210 if (proxyService.proxy.props.getProperty("adblock.auth") != null)
211 items.add("Auth: yes"); 211 items.add("Auth: yes");
212 } 212 }
213 else 213 else
214 { 214 {
215 items.add("Service not running"); 215 items.add("Service not running");
216 } 216 }
217 217
218 final ScrollView scrollPane = new ScrollView(this); 218 final ScrollView scrollPane = new ScrollView(this);
219 final TextView messageText = new TextView(this); 219 final TextView messageText = new TextView(this);
220 messageText.setPadding(12, 6, 12, 6); 220 messageText.setPadding(12, 6, 12, 6);
221 messageText.setText(TextUtils.join("\n", items)); 221 messageText.setText(TextUtils.join("\n", items));
222 messageText.setOnClickListener(new View.OnClickListener() 222 messageText.setOnClickListener(new View.OnClickListener()
223 { 223 {
224
224 @Override 225 @Override
225 public void onClick(final View v) 226 public void onClick(final View v)
226 { 227 {
227 final ClipboardManager manager = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE); 228 final ClipboardManager manager = (ClipboardManager) getSystemService (CLIPBOARD_SERVICE);
228 final TextView showTextParam = (TextView) v; 229 final TextView showTextParam = (TextView) v;
229 manager.setText(showTextParam.getText()); 230 manager.setText(showTextParam.getText());
230 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();
231 } 232 }
232 }); 233 });
233 scrollPane.addView(messageText); 234 scrollPane.addView(messageText);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 270 }
270 271
271 @Override 272 @Override
272 public void onServiceDisconnected(final ComponentName className) 273 public void onServiceDisconnected(final ComponentName className)
273 { 274 {
274 proxyService = null; 275 proxyService = null;
275 Log.d(TAG, "Proxy service disconnected"); 276 Log.d(TAG, "Proxy service disconnected");
276 } 277 }
277 }; 278 };
278 } 279 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld