|
|
@ -137,6 +137,26 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
uriTitle = null;
|
|
|
|
uriTitle = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MailTo mailto = null;
|
|
|
|
|
|
|
|
if ("mailto".equals(uri.getScheme()))
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
mailto = MailTo.parse(uri);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String host = uri.getHost();
|
|
|
|
|
|
|
|
String thost = (uriTitle == null ? null : uriTitle.getHost());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String puny = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (host != null)
|
|
|
|
|
|
|
|
puny = IDN.toASCII(host, IDN.ALLOW_UNASSIGNED);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.i(ex);
|
|
|
|
|
|
|
|
puny = host;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get views
|
|
|
|
// Get views
|
|
|
|
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_open_link, null);
|
|
|
|
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_open_link, null);
|
|
|
|
scroll = dview.findViewById(R.id.scroll);
|
|
|
|
scroll = dview.findViewById(R.id.scroll);
|
|
|
@ -420,29 +440,10 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
tvTitle.setText(title);
|
|
|
|
tvTitle.setText(title);
|
|
|
|
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
|
|
|
|
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
MailTo mailto = null;
|
|
|
|
|
|
|
|
if ("mailto".equals(uri.getScheme()))
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
mailto = MailTo.parse(uri);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ibSearch.setVisibility(
|
|
|
|
ibSearch.setVisibility(
|
|
|
|
mailto != null && !TextUtils.isEmpty(mailto.getTo())
|
|
|
|
mailto != null && !TextUtils.isEmpty(mailto.getTo())
|
|
|
|
? View.VISIBLE : View.GONE);
|
|
|
|
? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
String host = uri.getHost();
|
|
|
|
|
|
|
|
String thost = (uriTitle == null ? null : uriTitle.getHost());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String puny = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (host != null)
|
|
|
|
|
|
|
|
puny = IDN.toASCII(host, IDN.ALLOW_UNASSIGNED);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.i(ex);
|
|
|
|
|
|
|
|
puny = host;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (host != null && !host.equals(puny)) {
|
|
|
|
if (host != null && !host.equals(puny)) {
|
|
|
|
etLink.setText(format(uri.buildUpon().encodedAuthority(puny).build(), context));
|
|
|
|
etLink.setText(format(uri.buildUpon().encodedAuthority(puny).build(), context));
|
|
|
|
tvLink.setText(uri.toString());
|
|
|
|
tvLink.setText(uri.toString());
|
|
|
|