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

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

Issue 9643003: Improve manual proxy configuration (Closed)
Left Patch Set: Add guide for Android <= 2.3 devices Created March 12, 2013, 3:45 p.m.
Right Patch Set: Addressed review issues Created March 13, 2013, 8:48 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
« no previous file with change/comment | « src/org/adblockplus/android/Preferences.java ('k') | src/org/adblockplus/android/ProxyService.java » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 package org.adblockplus.android; 1 package org.adblockplus.android;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.opengl.Visibility;
Andrey Novikov 2013/03/13 07:51:15 What is it doing here?
Felix Dahlke 2013/03/13 08:48:53 WTF, missed that. I wasn't trying to sneak OpenGL
6 import android.os.Build; 5 import android.os.Build;
7 import android.os.Bundle; 6 import android.os.Bundle;
8 import android.provider.Settings; 7 import android.provider.Settings;
9 import android.text.Html; 8 import android.text.Html;
10 import android.text.method.LinkMovementMethod; 9 import android.text.method.LinkMovementMethod;
11 import android.view.View; 10 import android.view.View;
12 import android.widget.Button; 11 import android.widget.Button;
13 import android.widget.TextView; 12 import android.widget.TextView;
14 13
15 public class ProxyConfigurationActivity extends Activity 14 public class ProxyConfigurationActivity extends Activity
16 { 15 {
17 @Override 16 @Override
18 public void onCreate(Bundle savedInstanceState) 17 public void onCreate(Bundle savedInstanceState)
19 { 18 {
20 super.onCreate(savedInstanceState); 19 super.onCreate(savedInstanceState);
21 setContentView(R.layout.proxyconfiguration); 20 setContentView(R.layout.proxyconfiguration);
22 int port = getIntent().getIntExtra("port", 0); 21 int port = getIntent().getIntExtra("port", 0);
23
24 boolean configurationSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODE S.HONEYCOMB_MR1;
Andrey Novikov 2013/03/13 07:51:15 We have a static application-wide flag for this: P
Felix Dahlke 2013/03/13 08:48:53 Right, I remember lobbying for that, but couldn't
25 22
26 StringBuilder info = new StringBuilder(); 23 StringBuilder info = new StringBuilder();
27 int proxySettingsResource = configurationSupported ? R.raw.proxysettings : R .raw.proxysettings_old; 24 int textId = ProxyService.NATIVE_PROXY_SUPPORTED ? R.raw.proxysettings : R.r aw.proxysettings_old;
Andrey Novikov 2013/03/13 07:51:15 I would rename it to 'proxySettingsLayout' :) (In
Felix Dahlke 2013/03/13 08:48:53 Yeah, not a great name... Went with textId, seems
28 AdblockPlus.appendRawTextFile(this, info, proxySettingsResource); 25 AdblockPlus.appendRawTextFile(this, info, textId);
29 String msg = String.format(info.toString(), port); 26 String msg = String.format(info.toString(), port);
30 27
31 TextView tv = (TextView) findViewById(R.id.message_text); 28 TextView tv = (TextView) findViewById(R.id.message_text);
32 tv.setText(Html.fromHtml(msg)); 29 tv.setText(Html.fromHtml(msg));
33 tv.setMovementMethod(LinkMovementMethod.getInstance()); 30 tv.setMovementMethod(LinkMovementMethod.getInstance());
34 31
35 Button buttonToHide = (Button) findViewById(configurationSupported ? R.id.go tit : R.id.opensettings); 32 Button buttonToHide = (Button) findViewById(ProxyService.NATIVE_PROXY_SUPPOR TED ? R.id.gotit : R.id.opensettings);
36 buttonToHide.setVisibility(View.GONE); 33 buttonToHide.setVisibility(View.GONE);
37 } 34 }
38 35
39 public void onGotit(View view) 36 public void onGotit(View view)
40 { 37 {
41 finish(); 38 finish();
42 } 39 }
43 40
44 public void onSettings(View view) 41 public void onSettings(View view)
45 { 42 {
46 startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); 43 startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
47 finish(); 44 finish();
48 } 45 }
49 } 46 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld