Add hifi scheme for scheme-less addresses

This commit is contained in:
Cristian Luis Duarte 2018-04-12 20:45:35 -03:00
parent 20acfdfb82
commit ffb38eb490

View file

@ -12,6 +12,9 @@ import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import java.net.URI;
import java.net.URISyntaxException;
public class GotoActivity extends AppCompatActivity {
private EditText mUrlEditText;
@ -53,6 +56,16 @@ public class GotoActivity extends AppCompatActivity {
private void actionGo() {
String urlString = mUrlEditText.getText().toString();
if (!urlString.trim().isEmpty()) {
URI uri;
try {
uri = new URI(urlString);
} catch (URISyntaxException e) {
return;
}
if (uri.getScheme()==null || uri.getScheme().isEmpty()) {
urlString = "hifi://" + urlString;
}
Intent intent = new Intent(this, InterfaceActivity.class);
intent.putExtra(InterfaceActivity.DOMAIN_URL, urlString);
finish();