Check link title against link target

This commit is contained in:
M66B
2019-10-12 14:05:31 +02:00
parent 16311dbafb
commit 2b5bcdb13a
3 changed files with 21 additions and 1 deletions

View File

@@ -4118,6 +4118,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_open_link, null);
TextView tvTitle = view.findViewById(R.id.tvTitle);
final EditText etLink = view.findViewById(R.id.etLink);
TextView tvDifferent = view.findViewById(R.id.tvDifferent);
final CheckBox cbSecure = view.findViewById(R.id.cbSecure);
CheckBox cbSanitize = view.findViewById(R.id.cbSanitize);
final Button btnOwner = view.findViewById(R.id.btnOwner);
@@ -4244,6 +4245,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
etLink.setText(uri.toString());
Uri uriTitle = Uri.parse(title == null ? "" : title);
tvDifferent.setVisibility(uriTitle.getHost() == null || uri.getHost() == null ||
uriTitle.getHost().equalsIgnoreCase(uri.getHost())
? View.GONE : View.VISIBLE);
return new AlertDialog.Builder(getContext())
.setView(view)
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {