| OLD | NEW |
| 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.Bundle; | 7 import android.os.Bundle; |
| 6 import android.provider.Settings; | 8 import android.provider.Settings; |
| 7 import android.text.Html; | 9 import android.text.Html; |
| 8 import android.text.method.LinkMovementMethod; | 10 import android.text.method.LinkMovementMethod; |
| 9 import android.view.View; | 11 import android.view.View; |
| 12 import android.widget.Button; |
| 10 import android.widget.TextView; | 13 import android.widget.TextView; |
| 11 | 14 |
| 12 public class ProxyConfigurationActivity extends Activity | 15 public class ProxyConfigurationActivity extends Activity |
| 13 { | 16 { |
| 14 @Override | 17 @Override |
| 15 public void onCreate(Bundle savedInstanceState) | 18 public void onCreate(Bundle savedInstanceState) |
| 16 { | 19 { |
| 17 super.onCreate(savedInstanceState); | 20 super.onCreate(savedInstanceState); |
| 18 setContentView(R.layout.proxyconfiguration); | 21 setContentView(R.layout.proxyconfiguration); |
| 19 int port = getIntent().getIntExtra("port", 0); | 22 int port = getIntent().getIntExtra("port", 0); |
| 20 | 23 |
| 24 boolean configurationSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODE
S.HONEYCOMB_MR1; |
| 25 |
| 21 StringBuilder info = new StringBuilder(); | 26 StringBuilder info = new StringBuilder(); |
| 22 AdblockPlus.appendRawTextFile(this, info, R.raw.proxysettings); | 27 int proxySettingsResource = configurationSupported ? R.raw.proxysettings : R
.raw.proxysettings_old; |
| 28 AdblockPlus.appendRawTextFile(this, info, proxySettingsResource); |
| 23 String msg = String.format(info.toString(), port); | 29 String msg = String.format(info.toString(), port); |
| 24 | 30 |
| 25 TextView tv = (TextView) findViewById(R.id.message_text); | 31 TextView tv = (TextView) findViewById(R.id.message_text); |
| 26 tv.setText(Html.fromHtml(msg)); | 32 tv.setText(Html.fromHtml(msg)); |
| 27 tv.setMovementMethod(LinkMovementMethod.getInstance()); | 33 tv.setMovementMethod(LinkMovementMethod.getInstance()); |
| 28 | 34 |
| 35 Button buttonToHide = (Button) findViewById(configurationSupported ? R.id.go
tit : R.id.opensettings); |
| 36 buttonToHide.setVisibility(View.GONE); |
| 29 } | 37 } |
| 30 | 38 |
| 31 public void onGotit(View view) | 39 public void onGotit(View view) |
| 32 { | 40 { |
| 33 finish(); | 41 finish(); |
| 34 } | 42 } |
| 35 | 43 |
| 36 public void onSettings(View view) | 44 public void onSettings(View view) |
| 37 { | 45 { |
| 38 startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); | 46 startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); |
| 39 finish(); | 47 finish(); |
| 40 } | 48 } |
| 41 } | 49 } |
| OLD | NEW |