| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 26 matching lines...) Expand all Loading... |
| 37 import android.content.ServiceConnection; | 37 import android.content.ServiceConnection; |
| 38 import android.content.SharedPreferences; | 38 import android.content.SharedPreferences; |
| 39 import android.content.pm.PackageManager.NameNotFoundException; | 39 import android.content.pm.PackageManager.NameNotFoundException; |
| 40 import android.content.res.AssetManager; | 40 import android.content.res.AssetManager; |
| 41 import android.net.Uri; | 41 import android.net.Uri; |
| 42 import android.os.Bundle; | 42 import android.os.Bundle; |
| 43 import android.os.IBinder; | 43 import android.os.IBinder; |
| 44 import android.preference.CheckBoxPreference; | 44 import android.preference.CheckBoxPreference; |
| 45 import android.preference.ListPreference; | 45 import android.preference.ListPreference; |
| 46 import android.preference.PreferenceManager; | 46 import android.preference.PreferenceManager; |
| 47 import android.text.Html; |
| 47 import android.text.format.DateFormat; | 48 import android.text.format.DateFormat; |
| 48 import android.util.Log; | 49 import android.util.Log; |
| 49 import android.view.View; | 50 import android.view.View; |
| 51 import android.view.ViewGroup; |
| 50 import android.widget.TextView; | 52 import android.widget.TextView; |
| 51 | 53 |
| 52 import com.actionbarsherlock.view.Menu; | 54 import com.actionbarsherlock.view.Menu; |
| 53 import com.actionbarsherlock.view.MenuInflater; | 55 import com.actionbarsherlock.view.MenuInflater; |
| 54 import com.actionbarsherlock.view.MenuItem; | 56 import com.actionbarsherlock.view.MenuItem; |
| 55 | 57 |
| 56 /** | 58 /** |
| 57 * Main settings UI. | 59 * Main settings UI. |
| 58 */ | 60 */ |
| 59 public class Preferences extends SummarizedPreferences | 61 public class Preferences extends SummarizedPreferences |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 out.flush(); | 326 out.flush(); |
| 325 out.close(); | 327 out.close(); |
| 326 } | 328 } |
| 327 catch (Exception e) | 329 catch (Exception e) |
| 328 { | 330 { |
| 329 Log.e(TAG, "Asset copy error", e); | 331 Log.e(TAG, "Asset copy error", e); |
| 330 } | 332 } |
| 331 } | 333 } |
| 332 } | 334 } |
| 333 | 335 |
| 336 public void showProxySettings(View v) |
| 337 { |
| 338 this.startActivity(new Intent(this, ProxyConfigurationActivity.class).putExt
ra("port", proxyService.port)); |
| 339 } |
| 340 |
| 334 @Override | 341 @Override |
| 335 protected Dialog onCreateDialog(int id) | 342 protected Dialog onCreateDialog(int id) |
| 336 { | 343 { |
| 337 Dialog dialog = null; | 344 Dialog dialog = null; |
| 338 switch (id) | 345 switch (id) |
| 339 { | 346 { |
| 340 case ABOUT_DIALOG: | 347 case ABOUT_DIALOG: |
| 341 dialog = new AboutDialog(this); | 348 dialog = new AboutDialog(this); |
| 342 break; | 349 break; |
| 343 case HIDEICONWARNING_DIALOG: | 350 case HIDEICONWARNING_DIALOG: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 if (hideIcon) | 388 if (hideIcon) |
| 382 showDialog(HIDEICONWARNING_DIALOG); | 389 showDialog(HIDEICONWARNING_DIALOG); |
| 383 if (proxyService != null) | 390 if (proxyService != null) |
| 384 proxyService.setEmptyIcon(hideIcon); | 391 proxyService.setEmptyIcon(hideIcon); |
| 385 } | 392 } |
| 386 super.onSharedPreferenceChanged(sharedPreferences, key); | 393 super.onSharedPreferenceChanged(sharedPreferences, key); |
| 387 } | 394 } |
| 388 | 395 |
| 389 private void showConfigurationMsg(String message) | 396 private void showConfigurationMsg(String message) |
| 390 { | 397 { |
| 398 ViewGroup grp = (ViewGroup) findViewById(R.id.grp_configuration); |
| 391 TextView msg = (TextView) findViewById(R.id.txt_configuration); | 399 TextView msg = (TextView) findViewById(R.id.txt_configuration); |
| 392 msg.setText(message); | 400 msg.setText(Html.fromHtml(message)); |
| 393 msg.setVisibility(View.VISIBLE); | 401 View btn = findViewById(R.id.btn_configuration); |
| 402 btn.setVisibility(ProxyService.hasNativeProxy ? View.VISIBLE : View.GONE); |
| 403 grp.setVisibility(View.VISIBLE); |
| 394 } | 404 } |
| 395 | 405 |
| 396 private void hideConfigurationMsg() | 406 private void hideConfigurationMsg() |
| 397 { | 407 { |
| 398 TextView msg = (TextView) findViewById(R.id.txt_configuration); | 408 ViewGroup grp = (ViewGroup) findViewById(R.id.grp_configuration); |
| 399 msg.setVisibility(View.GONE); | 409 grp.setVisibility(View.GONE); |
| 400 } | 410 } |
| 401 | 411 |
| 402 private BroadcastReceiver receiver = new BroadcastReceiver() | 412 private BroadcastReceiver receiver = new BroadcastReceiver() |
| 403 { | 413 { |
| 404 @Override | 414 @Override |
| 405 public void onReceive(Context context, Intent intent) | 415 public void onReceive(Context context, Intent intent) |
| 406 { | 416 { |
| 407 String action = intent.getAction(); | 417 String action = intent.getAction(); |
| 408 Bundle extra = intent.getExtras(); | 418 Bundle extra = intent.getExtras(); |
| 409 if (action.equals(ProxyService.BROADCAST_STATE_CHANGED)) | 419 if (action.equals(ProxyService.BROADCAST_STATE_CHANGED)) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 showConfigurationMsg(getString(R.string.msg_configuration, proxyService.
port)); | 523 showConfigurationMsg(getString(R.string.msg_configuration, proxyService.
port)); |
| 514 } | 524 } |
| 515 | 525 |
| 516 public void onServiceDisconnected(ComponentName className) | 526 public void onServiceDisconnected(ComponentName className) |
| 517 { | 527 { |
| 518 proxyService = null; | 528 proxyService = null; |
| 519 Log.d(TAG, "Proxy service disconnected"); | 529 Log.d(TAG, "Proxy service disconnected"); |
| 520 } | 530 } |
| 521 }; | 531 }; |
| 522 } | 532 } |
| OLD | NEW |