bug fix
This commit is contained in:
parent
1594f0ad43
commit
710fbcea30
|
|
@ -206,7 +206,7 @@ class MainActivity extends Activity {
|
|||
EditText edit_remote_mac = (EditText) findViewById(R.id.remote_mac);
|
||||
String string_remote_ip = edit_remote_ip.getText().toString();
|
||||
String string_remote_mac = edit_remote_mac.getText().toString();
|
||||
// check if ip is in valid format and reachable
|
||||
// check if ip is in valid format
|
||||
if (Utilities.validIP(string_remote_ip)) {
|
||||
remoteIP = string_remote_ip;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -575,13 +575,7 @@ class Utilities {
|
|||
i = Integer.parseInt(s);
|
||||
if ((i < 0) || (i > 255)) return false;
|
||||
}
|
||||
if (ip.endsWith(".")) return false;
|
||||
// ping the ip and see if it is reachable
|
||||
try {
|
||||
return InetAddress.getByName(ip).isReachable(5);
|
||||
} catch (IOException ignored) {
|
||||
return false;
|
||||
}
|
||||
return !ip.endsWith(".");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -592,7 +586,7 @@ class Utilities {
|
|||
static boolean validMAC(String mac) {
|
||||
// use regular expression to validate a mac address
|
||||
// the only valid format is xx:xx:xx:xx:xx:xx
|
||||
Pattern p = Pattern.compile("^([a-fA-F0-9][:]){5}[a-fA-F0-9][:]$");
|
||||
Pattern p = Pattern.compile("/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/");
|
||||
Matcher m = p.matcher(mac);
|
||||
return m.find();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@
|
|||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2">
|
||||
android:layout_weight="1.5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Reference in New Issue