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: Adressed first batch of review issues. Created April 16, 2014, 5:36 p.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 27 matching lines...) Expand all
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")
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
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"),
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);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld