Skip to content

Commit

Permalink
* Fixed stream performance, now it will load only visible cameras.
Browse files Browse the repository at this point in the history
* Fixed bug #4
* Fixed bug #9
* Fixed bug #6
* Fixed bug #5

Signed-off-by: Developer From Jokela <developerfromjokela@gmail.com>
  • Loading branch information
developerfromjokela committed Jan 6, 2020
1 parent cfc8134 commit ceb181f
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,12 @@ public void afterTextChanged(Editable s) {
if (url.split("://").length >= 2) {
String nUrl = url.split("://")[1];
if (nUrl.contains(":")) {
Log.e("DS", "PORT D");
b.setEnabled(false);
return;
} else
b.setEnabled(true);
} else {
if (url.contains(":")) {
Log.e("DS", "PORT D");
b.setEnabled(false);
return;
} else
Expand Down Expand Up @@ -640,13 +638,11 @@ public void afterTextChanged(Editable s) {
if (url.contains("://") && url.split("://").length >= 2) {
String nUrl = url.split("://")[1];
if (nUrl.contains(":")) {
Log.e("DS", "PORT D2");
b.setEnabled(false);
} else
b.setEnabled(true);
} else {
if (url.contains(":")) {
Log.e("DS", "PORT D");
b.setEnabled(false);
} else
b.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,20 +421,13 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
@Override
public void afterTextChanged(Editable s) {
String url = s.toString();
if (validIP(url)) {
device.setDeviceUrl(url);

Log.e("SetupStartScreen", "Valid IP");

continue_btn.setEnabled(true);
} else {
Log.e("SetupStartScreen", "Invalid IP");
if (!url.contains(":/") && url.contains(":")) {

continue_btn.setEnabled(false);
}
if (url.contains(":")) {
final String[] portparts = url.split(":");
if (portparts.length == 2) {

device.setDeviceUrl(portparts[0]);
local_port.setText(portparts[portparts.length - 1]);
new Handler().postDelayed(new Runnable() {
Expand All @@ -447,19 +440,41 @@ public void run() {
}
}, 1000);
}
if (validIP(portparts[0])) {
device.setDeviceUrl(url);

Log.e("SetupStartScreen", "Valid IP");

continue_btn.setEnabled(true);
} else {
Log.e("SetupStartScreen", "Invalid IP");
} else if (url.contains("://")) {
if (url.split("://").length >= 2) {
String nURL = url.split("://")[1];
final String[] portparts = nURL.split(":");
if (portparts.length == 2) {
if (portparts[1].equals("/"))
return;
device.setDeviceUrl(url.split("://")[0] + "://" + portparts[0]);
local_port.setText(portparts[portparts.length - 1]);
String finalUrl = url;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
local_hostname.setText(finalUrl.split("://")[0] + "://" + portparts[0]);
local_hostname.setSelection(local_hostname.getText().length());

Log.e("Setup", "Set Local Port " + portparts[1]);
}
}, 1000);
}
continue_btn.setEnabled(URLUtil.isValidUrl(url));

continue_btn.setEnabled(false);
}

}

if (!URLUtil.isValidUrl(url)) {
url = "http://" + url;
if (URLUtil.isValidUrl(url))
device.setDeviceUrl(url);

continue_btn.setEnabled(URLUtil.isValidUrl(url));
} else
continue_btn.setEnabled(true);
}
});
ddns_hostname.addTextChangedListener(new TextWatcher() {
Expand All @@ -476,40 +491,65 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
@Override
public void afterTextChanged(Editable s) {
String url = s.toString();
if (!isValidURL(url) && url.length() > 2) {

if (isValidURL("http://" + url)) {
device.setDdnsURL("http://" + url);
continue_btn.setEnabled(true);
if (!url.contains(":/") && url.contains(":")) {

} else {
continue_btn.setEnabled(false);

}

} else {
device.setDdnsURL(url);
continue_btn.setEnabled(true);
}
if (url.contains(":")) {
final String[] portparts = url.split(":");
if (portparts.length == 3) {
device.setDdnsURL(url);

ddns_port.setText(portparts[portparts.length - 1]);
if (portparts.length == 2) {

device.setDdnsURL(portparts[0]);

ddns_port.setText(portparts[portparts.length - 1]);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ddns_hostname.setText(portparts[0]);
ddns_hostname.setSelection(ddns_hostname.getText().length());

Log.e("Setup", "Set Local Port 1" + portparts[1]);
}
}, 900);
}, 1000);
}


} else if (url.contains("://")) {
if (url.split("://").length >= 2) {
String nURL = url.split("://")[1];
final String[] portparts = nURL.split(":");
if (portparts.length == 2) {
if (portparts[1].equals("/"))
return;
device.setDdnsURL(url.split("://")[0] + "://" + portparts[0]);
ddns_port.setText(portparts[portparts.length - 1]);
String finalUrl = url;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ddns_hostname.setText(finalUrl.split("://")[0] + "://" + portparts[0]);
ddns_hostname.setSelection(ddns_hostname.getText().length());

Log.e("Setup", "Set Local Port 2" + portparts[1]);
}
}, 1000);
}
continue_btn.setEnabled(URLUtil.isValidUrl(url));

}
}
if (!isValidURL(url) && url.length() > 2) {

if (isValidURL("http://" + url)) {
device.setDdnsURL("http://" + url);
continue_btn.setEnabled(true);

} else {
continue_btn.setEnabled(false);

}

} else {
device.setDdnsURL(url);
continue_btn.setEnabled(true);
}
}
});
Expand Down

0 comments on commit ceb181f

Please sign in to comment.