mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-07-03 21:21:12 +08:00
parent
6bf8a6bd8b
commit
356d8cca07
@ -156,7 +156,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment
|
||||
|
||||
fullPayloadHideShow(mTlsDecryption.isChecked());
|
||||
socks5ProxyHideShow(mTlsDecryption.isChecked(), mSocks5Enabled.isChecked(), rootCaptureEnabled());
|
||||
mBlockQuic.setVisible(mTlsDecryption.isChecked() && !rootCaptureEnabled());
|
||||
mBlockQuic.setVisible(!rootCaptureEnabled());
|
||||
rootCaptureHideShow(rootCaptureEnabled());
|
||||
|
||||
Intent intent = requireActivity().getIntent();
|
||||
@ -286,7 +286,6 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment
|
||||
}
|
||||
|
||||
fullPayloadHideShow((boolean) newValue);
|
||||
mBlockQuic.setVisible(((boolean) newValue) && !rootCaptureEnabled());
|
||||
mMitmWizard.setVisible((boolean) newValue);
|
||||
mMitmproxyOpts.setVisible((boolean) newValue);
|
||||
socks5ProxyHideShow((boolean) newValue, mSocks5Enabled.isChecked(), rootCaptureEnabled());
|
||||
@ -399,7 +398,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment
|
||||
} else {
|
||||
mAutoBlockPrivateDNS.setVisible(true);
|
||||
fullPayloadHideShow(mTlsDecryption.isChecked());
|
||||
mBlockQuic.setVisible(mTlsDecryption.isChecked());
|
||||
mBlockQuic.setVisible(true);
|
||||
socks5ProxyHideShow(mTlsDecryption.isChecked(), mSocks5Enabled.isChecked(), false);
|
||||
}
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ public class EditListFragment extends Fragment implements MatchList.ListChangeLi
|
||||
}
|
||||
|
||||
private void showAddIpRule() {
|
||||
RuleAddDialog.showText(requireContext(), mList, R.string.ip_address, (value, field) -> {
|
||||
RuleAddDialog.showText(requireContext(), R.string.ip_address, (value, field) -> {
|
||||
if(!Utils.validateIpAddress(value)) {
|
||||
field.setError(getString(R.string.invalid));
|
||||
return false;
|
||||
@ -301,7 +301,7 @@ public class EditListFragment extends Fragment implements MatchList.ListChangeLi
|
||||
}
|
||||
|
||||
private void showAddProtoRule() {
|
||||
RuleAddDialog.showCombo(requireContext(), mList, R.string.protocol, Utils.getL7Protocols(), (value, field) -> {
|
||||
RuleAddDialog.showCombo(requireContext(), R.string.protocol, Utils.getL7Protocols(), (value, field) -> {
|
||||
if(!mList.addProto(value))
|
||||
Utils.showToastLong(requireContext(), R.string.rule_exists);
|
||||
else
|
||||
@ -318,7 +318,7 @@ public class EditListFragment extends Fragment implements MatchList.ListChangeLi
|
||||
for(int i=0; i<countryCodes.length; i++)
|
||||
countryNames[i] = Utils.getCountryName(ctx, countryCodes[i]);
|
||||
|
||||
RuleAddDialog.showCombo(requireContext(), mList, R.string.country, countryNames, (value, field) -> {
|
||||
RuleAddDialog.showCombo(requireContext(), R.string.country, countryNames, (value, field) -> {
|
||||
String code = null;
|
||||
|
||||
for(int i=0; i<countryNames.length; i++) {
|
||||
@ -342,7 +342,7 @@ public class EditListFragment extends Fragment implements MatchList.ListChangeLi
|
||||
}
|
||||
|
||||
private void showAddHostRule() {
|
||||
RuleAddDialog.showText(requireContext(), mList, R.string.host, (value, field) -> {
|
||||
RuleAddDialog.showText(requireContext(), R.string.host, (value, field) -> {
|
||||
if(!Utils.validateHost(value)) {
|
||||
field.setError(getString(R.string.invalid));
|
||||
return false;
|
||||
|
||||
@ -184,7 +184,7 @@ public class Prefs {
|
||||
public static String getPCAPUri(SharedPreferences p) { return(p.getString(PREF_PCAP_URI, "")); }
|
||||
public static boolean isTLSDecryptionSetupDone(SharedPreferences p) { return(p.getBoolean(PREF_TLS_DECRYPTION_SETUP_DONE, false)); }
|
||||
public static boolean getFullPayloadMode(SharedPreferences p) { return(p.getBoolean(PREF_FULL_PAYLOAD, false)); }
|
||||
public static boolean blockQuic(SharedPreferences p) { return(getTlsDecryptionEnabled(p) && p.getBoolean(PREF_BLOCK_QUIC, false)); }
|
||||
public static boolean blockQuic(SharedPreferences p) { return(p.getBoolean(PREF_BLOCK_QUIC, false)); }
|
||||
public static boolean isPrivateDnsBlockingEnabled(SharedPreferences p) { return(p.getBoolean(PREF_AUTO_BLOCK_PRIVATE_DNS, true)); }
|
||||
public static boolean lockdownVpnNoticeShown(SharedPreferences p) { return(p.getBoolean(PREF_LOCKDOWN_VPN_NOTICE_SHOWN, false)); }
|
||||
public static boolean blockNewApps(SharedPreferences p) { return(p.getBoolean(PREF_BLOCK_NEW_APPS, false)); }
|
||||
|
||||
@ -43,7 +43,6 @@ public class RuleAddDialog implements View.OnClickListener {
|
||||
private final TextInputLayout mComboLayout;
|
||||
private final ViewMode mViewMode;
|
||||
private final RuleAddListener mAdapter;
|
||||
private final MatchList mList;
|
||||
private ArrayAdapter<String> mComboAdapter;
|
||||
|
||||
private enum ViewMode {
|
||||
@ -55,19 +54,18 @@ public class RuleAddDialog implements View.OnClickListener {
|
||||
boolean addRule(String value, TextView field);
|
||||
}
|
||||
|
||||
private RuleAddDialog(ViewMode viewMode, Context ctx, MatchList matchList, int title_res, RuleAddListener adapter) {
|
||||
private RuleAddDialog(ViewMode viewMode, Context ctx, int title_res, RuleAddListener adapter) {
|
||||
mContext = ctx;
|
||||
mViewMode = viewMode;
|
||||
mAdapter = adapter;
|
||||
mList = matchList;
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(ctx);
|
||||
View view = inflater.inflate(R.layout.add_rule_dialog, null);
|
||||
|
||||
mComboLayout = (TextInputLayout) view.findViewById(R.id.combo_field);
|
||||
mEditTextLayout = (TextInputLayout) view.findViewById(R.id.text_field);
|
||||
mComboText = (AutoCompleteTextView) view.findViewById(R.id.combo_text);
|
||||
mEditText = (TextInputEditText) view.findViewById(R.id.text_value);
|
||||
mComboLayout = view.findViewById(R.id.combo_field);
|
||||
mEditTextLayout = view.findViewById(R.id.text_field);
|
||||
mComboText = view.findViewById(R.id.combo_text);
|
||||
mEditText = view.findViewById(R.id.text_value);
|
||||
|
||||
mDialog = new AlertDialog.Builder(ctx)
|
||||
.setView(view)
|
||||
@ -80,14 +78,14 @@ public class RuleAddDialog implements View.OnClickListener {
|
||||
.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public static RuleAddDialog showText(Context ctx, MatchList matchList, int title_res, RuleAddListener adapter) {
|
||||
RuleAddDialog dialog = new RuleAddDialog(ViewMode.RULE_DIALOG_SIMPLE_TEXT, ctx, matchList, title_res, adapter);
|
||||
public static RuleAddDialog showText(Context ctx, int title_res, RuleAddListener adapter) {
|
||||
RuleAddDialog dialog = new RuleAddDialog(ViewMode.RULE_DIALOG_SIMPLE_TEXT, ctx, title_res, adapter);
|
||||
dialog.mEditTextLayout.setVisibility(View.VISIBLE);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public static RuleAddDialog showCombo(Context ctx, MatchList matchList, int title_res, String[] values, RuleAddListener adapter) {
|
||||
RuleAddDialog dialog = new RuleAddDialog(ViewMode.RULE_DIALOG_COMBO, ctx, matchList, title_res, adapter);
|
||||
public static RuleAddDialog showCombo(Context ctx, int title_res, String[] values, RuleAddListener adapter) {
|
||||
RuleAddDialog dialog = new RuleAddDialog(ViewMode.RULE_DIALOG_COMBO, ctx, title_res, adapter);
|
||||
dialog.mComboLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
dialog.mComboAdapter = new ArrayAdapter<>(ctx, R.layout.dropdown_item, values);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user