Merge "Remove custom schema parsing in favor of Uri" into pi-dev
This commit is contained in:
@@ -755,14 +755,8 @@ public final class TextClassifierImpl implements TextClassifier {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static List<LabeledIntent> createForUrl(Context context, String text) {
|
private static List<LabeledIntent> createForUrl(Context context, String text) {
|
||||||
final String httpPrefix = "http://";
|
if (Uri.parse(text).getScheme() == null) {
|
||||||
final String httpsPrefix = "https://";
|
text = "http://" + text;
|
||||||
if (text.toLowerCase().startsWith(httpPrefix)) {
|
|
||||||
text = httpPrefix + text.substring(httpPrefix.length());
|
|
||||||
} else if (text.toLowerCase().startsWith(httpsPrefix)) {
|
|
||||||
text = httpsPrefix + text.substring(httpsPrefix.length());
|
|
||||||
} else {
|
|
||||||
text = httpPrefix + text;
|
|
||||||
}
|
}
|
||||||
return Arrays.asList(new LabeledIntent(
|
return Arrays.asList(new LabeledIntent(
|
||||||
context.getString(com.android.internal.R.string.browse),
|
context.getString(com.android.internal.R.string.browse),
|
||||||
|
|||||||
Reference in New Issue
Block a user