| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 package org.adblockplus.android; | 18 package org.adblockplus.android; |
| 19 | 19 |
| 20 import java.util.ArrayList; | 20 import java.util.ArrayList; |
| 21 import java.util.List; | 21 import java.util.List; |
| 22 | 22 |
| 23 import org.adblockplus.android.compat.ProxyProperties; | 23 import org.adblockplus.android.compat.ProxyProperties; |
| 24 import org.adblockplus.android.configurators.IptablesProxyConfigurator; | 24 import org.adblockplus.android.configurators.IptablesProxyConfigurator; |
| 25 import org.adblockplus.android.configurators.ProxyRegistrationType; | |
| 26 import org.apache.commons.lang.StringUtils; | 25 import org.apache.commons.lang.StringUtils; |
| 27 | 26 |
| 28 import android.app.AlertDialog; | 27 import android.app.AlertDialog; |
| 29 import android.app.Dialog; | 28 import android.app.Dialog; |
| 30 import android.content.DialogInterface; | 29 import android.content.DialogInterface; |
| 31 import android.content.Intent; | 30 import android.content.Intent; |
| 32 import android.content.SharedPreferences; | 31 import android.content.SharedPreferences; |
| 33 import android.os.Build; | 32 import android.os.Build; |
| 34 import android.os.Bundle; | 33 import android.os.Bundle; |
| 35 import android.preference.Preference; | 34 import android.preference.Preference; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 if (Utils.isNativeProxySupported(this)) | 68 if (Utils.isNativeProxySupported(this)) |
| 70 { | 69 { |
| 71 screen.removePreference(findPreference(getString(R.string.pref_proxy))); | 70 screen.removePreference(findPreference(getString(R.string.pref_proxy))); |
| 72 if (prefs.getBoolean(getString(R.string.pref_proxyautoconfigured), false)) | 71 if (prefs.getBoolean(getString(R.string.pref_proxyautoconfigured), false)) |
| 73 { | 72 { |
| 74 screen.removePreference(findPreference(getString(R.string.pref_proxyenab led))); | 73 screen.removePreference(findPreference(getString(R.string.pref_proxyenab led))); |
| 75 } | 74 } |
| 76 } | 75 } |
| 77 if (getResources().getBoolean(R.bool.def_release)) | 76 if (getResources().getBoolean(R.bool.def_release)) |
| 78 { | 77 { |
| 79 // FIXME Do we really want to disable support in dev-builds? ... and what does this do? | |
|
Felix Dahlke
2014/08/19 09:06:00
How about creating an issue instead? :)
René Jeschke
2014/08/19 10:41:33
Done.
| |
| 80 screen.removePreference(findPreference(getString(R.string.pref_support))); | 78 screen.removePreference(findPreference(getString(R.string.pref_support))); |
| 81 } | 79 } |
| 82 else | 80 else |
| 83 { | 81 { |
| 84 final Preference prefUpdate = findPreference(getString(R.string.pref_check update)); | 82 final Preference prefUpdate = findPreference(getString(R.string.pref_check update)); |
| 85 prefUpdate.setOnPreferenceClickListener(new OnPreferenceClickListener() | 83 prefUpdate.setOnPreferenceClickListener(new OnPreferenceClickListener() |
| 86 { | 84 { |
| 87 @Override | 85 @Override |
| 88 public boolean onPreferenceClick(final Preference preference) | 86 public boolean onPreferenceClick(final Preference preference) |
| 89 { | 87 { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 case CONFIGURATION_DIALOG: | 175 case CONFIGURATION_DIALOG: |
| 178 final List<String> items = new ArrayList<String>(); | 176 final List<String> items = new ArrayList<String>(); |
| 179 items.add(AdblockPlus.getDeviceName()); | 177 items.add(AdblockPlus.getDeviceName()); |
| 180 items.add(String.format("API: %d Build: %d", Build.VERSION.SDK_INT, Adbl ockPlus.getApplication().getBuildNumber())); | 178 items.add(String.format("API: %d Build: %d", Build.VERSION.SDK_INT, Adbl ockPlus.getApplication().getBuildNumber())); |
| 181 | 179 |
| 182 final ProxyService proxyService = this.serviceBinder.get(); | 180 final ProxyService proxyService = this.serviceBinder.get(); |
| 183 | 181 |
| 184 if (proxyService != null) | 182 if (proxyService != null) |
| 185 { | 183 { |
| 186 items.add(String.format("Local port: %d", proxyService.port)); | 184 items.add(String.format("Local port: %d", proxyService.port)); |
| 187 if (proxyService.getProxyRegistrationType() == ProxyRegistrationType.I PTABLES) | 185 if (proxyService.isIptables()) |
| 188 { | 186 { |
| 189 items.add("Running in root mode"); | 187 items.add("Running in root mode"); |
| 190 items.add("iptables output:"); | 188 items.add("iptables output:"); |
| 191 final List<String> output = IptablesProxyConfigurator.getIptablesOut put(getApplicationContext()); | 189 final List<String> output = IptablesProxyConfigurator.getIptablesOut put(getApplicationContext()); |
| 192 if (output != null) | 190 if (output != null) |
| 193 { | 191 { |
| 194 for (final String line : output) | 192 for (final String line : output) |
| 195 { | 193 { |
| 196 if (StringUtils.isNotEmpty(line)) | 194 if (StringUtils.isNotEmpty(line)) |
| 197 items.add(line); | 195 items.add(line); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 { | 249 { |
| 252 dialog.cancel(); | 250 dialog.cancel(); |
| 253 } | 251 } |
| 254 }); | 252 }); |
| 255 dialog = builder.create(); | 253 dialog = builder.create(); |
| 256 break; | 254 break; |
| 257 } | 255 } |
| 258 return dialog; | 256 return dialog; |
| 259 } | 257 } |
| 260 } | 258 } |
| LEFT | RIGHT |