Fix string checks
This commit is contained in:
parent
42ca1a016c
commit
ecc1e4b443
|
@ -38,29 +38,32 @@ public class ShareActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Uri urlParsed = Uri.parse(urlString);
|
final Uri urlParsed = Uri.parse(urlString);
|
||||||
logVariable("scheme", urlParsed.getScheme());
|
final String scheme = urlParsed.getScheme();
|
||||||
if (urlParsed.getScheme() != "http" && urlParsed.getScheme() != "https" &&
|
logVariable("scheme", scheme);
|
||||||
urlParsed.getScheme() != "") {
|
if (scheme != null && !scheme.equals("") && !scheme.equals("http") &&
|
||||||
|
!scheme.equals("https")) {
|
||||||
Toast.makeText(getApplicationContext(), R.string.unknown_scheme,
|
Toast.makeText(getApplicationContext(), R.string.unknown_scheme,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logVariable("host", urlParsed.getHost());
|
final String host = urlParsed.getHost();
|
||||||
if (urlParsed.getHost() == null || (urlParsed.getHost() != "youtube.com" &&
|
logVariable("host", host);
|
||||||
urlParsed.getHost().endsWith(".youtube.com"))) {
|
if (host == null || (!host.equals("youtube.com") &&
|
||||||
|
!host.endsWith(".youtube.com"))) {
|
||||||
Toast.makeText(getApplicationContext(), R.string.non_youtube_url,
|
Toast.makeText(getApplicationContext(), R.string.non_youtube_url,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logVariable("path", urlParsed.getPath());
|
final String path = urlParsed.getPath();
|
||||||
if (urlParsed.getPath() == null) {
|
logVariable("path", path);
|
||||||
|
if (path == null) {
|
||||||
Toast.makeText(getApplicationContext(), R.string.null_path,
|
Toast.makeText(getApplicationContext(), R.string.null_path,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!urlParsed.getPath().startsWith("/shorts/")) {
|
if (!path.startsWith("/shorts/")) {
|
||||||
Toast.makeText(getApplicationContext(), R.string.non_shorts_url,
|
Toast.makeText(getApplicationContext(), R.string.non_shorts_url,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue