mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-07-03 21:21:12 +08:00
Small code changes
This commit is contained in:
parent
8c4edce1be
commit
fa8bd28615
@ -193,18 +193,20 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validateIp(String value) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
return (InetAddresses.isNumericAddress(value));
|
||||
else {
|
||||
Matcher matcher = Patterns.IP_ADDRESS.matcher(value);
|
||||
return(matcher.matches());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void setupUdpExporterPrefs() {
|
||||
/* Collector IP validation */
|
||||
EditTextPreference mRemoteCollectorIp = requirePreference(Prefs.PREF_COLLECTOR_IP_KEY);
|
||||
mRemoteCollectorIp.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
return (InetAddresses.isNumericAddress(newValue.toString()));
|
||||
else {
|
||||
Matcher matcher = Patterns.IP_ADDRESS.matcher(newValue.toString());
|
||||
return(matcher.matches());
|
||||
}
|
||||
});
|
||||
mRemoteCollectorIp.setOnPreferenceChangeListener((preference, newValue) -> validateIp(newValue.toString()));
|
||||
|
||||
/* Collector port validation */
|
||||
EditTextPreference mRemoteCollectorPort = requirePreference(Prefs.PREF_COLLECTOR_PORT_KEY);
|
||||
@ -404,4 +406,4 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment
|
||||
mVpnExceptions.setVisible(!enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,9 +8,4 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/adContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user