mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 11:47:26 -08:00
Work around Android browsers that don't register to handle HTTP:// and HTTPS:// schemes
git-svn-id: https://zxing.googlecode.com/svn/trunk@2415 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
374aebc5dc
commit
e17d3ae292
|
@ -413,6 +413,13 @@ public abstract class ResultHandler {
|
|||
}
|
||||
|
||||
final void openURL(String url) {
|
||||
// Strangely, some Android browsers don't seem to register to handle HTTP:// or HTTPS://.
|
||||
// Lower-case these as it should always be OK to lower-case these schemes.
|
||||
if (url.startsWith("HTTP://")) {
|
||||
url = "http" + url.substring(4);
|
||||
} else if (url.startsWith("HTTPS://")) {
|
||||
url = "https" + url.substring(5);
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
try {
|
||||
launchIntent(intent);
|
||||
|
|
|
@ -129,6 +129,13 @@ public abstract class SupplementalInfoRetriever extends AsyncTask<Object,Object,
|
|||
String newText = newTextCombined.toString();
|
||||
Spannable content = new SpannableString(newText + "\n\n");
|
||||
if (linkURL != null) {
|
||||
// Strangely, some Android browsers don't seem to register to handle HTTP:// or HTTPS://.
|
||||
// Lower-case these as it should always be OK to lower-case these schemes.
|
||||
if (linkURL.startsWith("HTTP://")) {
|
||||
linkURL = "http" + linkURL.substring(4);
|
||||
} else if (linkURL.startsWith("HTTPS://")) {
|
||||
linkURL = "https" + linkURL.substring(5);
|
||||
}
|
||||
content.setSpan(new URLSpan(linkURL), linkStart, linkEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue