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);
|
||||
logVariable("scheme", urlParsed.getScheme());
|
||||
if (urlParsed.getScheme() != "http" && urlParsed.getScheme() != "https" &&
|
||||
urlParsed.getScheme() != "") {
|
||||
final String scheme = urlParsed.getScheme();
|
||||
logVariable("scheme", scheme);
|
||||
if (scheme != null && !scheme.equals("") && !scheme.equals("http") &&
|
||||
!scheme.equals("https")) {
|
||||
Toast.makeText(getApplicationContext(), R.string.unknown_scheme,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
logVariable("host", urlParsed.getHost());
|
||||
if (urlParsed.getHost() == null || (urlParsed.getHost() != "youtube.com" &&
|
||||
urlParsed.getHost().endsWith(".youtube.com"))) {
|
||||
final String host = urlParsed.getHost();
|
||||
logVariable("host", host);
|
||||
if (host == null || (!host.equals("youtube.com") &&
|
||||
!host.endsWith(".youtube.com"))) {
|
||||
Toast.makeText(getApplicationContext(), R.string.non_youtube_url,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
logVariable("path", urlParsed.getPath());
|
||||
if (urlParsed.getPath() == null) {
|
||||
final String path = urlParsed.getPath();
|
||||
logVariable("path", path);
|
||||
if (path == null) {
|
||||
Toast.makeText(getApplicationContext(), R.string.null_path,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (!urlParsed.getPath().startsWith("/shorts/")) {
|
||||
if (!path.startsWith("/shorts/")) {
|
||||
Toast.makeText(getApplicationContext(), R.string.non_shorts_url,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue