LEFT | RIGHT |
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; | |
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; | |
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; |
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 } |
LEFT | RIGHT |