|
|
@ -1847,48 +1847,43 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
|
|
|
|
|
|
|
View view = LayoutInflater.from(context).inflate(R.layout.dialog_link, null);
|
|
|
|
View view = LayoutInflater.from(context).inflate(R.layout.dialog_link, null);
|
|
|
|
final EditText etLink = view.findViewById(R.id.etLink);
|
|
|
|
final EditText etLink = view.findViewById(R.id.etLink);
|
|
|
|
final CheckBox cbOrganization = view.findViewById(R.id.cbOrganization);
|
|
|
|
|
|
|
|
TextView tvInsecure = view.findViewById(R.id.tvInsecure);
|
|
|
|
TextView tvInsecure = view.findViewById(R.id.tvInsecure);
|
|
|
|
|
|
|
|
final TextView tvOwner = view.findViewById(R.id.tvOwner);
|
|
|
|
|
|
|
|
Group grpOwner = view.findViewById(R.id.grpOwner);
|
|
|
|
|
|
|
|
|
|
|
|
cbOrganization.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
etLink.setText(_uri.toString());
|
|
|
|
@Override
|
|
|
|
tvInsecure.setVisibility("http".equals(_uri.getScheme()) ? View.VISIBLE : View.GONE);
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
grpOwner.setVisibility(paranoid ? View.VISIBLE : View.GONE);
|
|
|
|
prefs.edit().putBoolean("show_organization", isChecked).apply();
|
|
|
|
|
|
|
|
if (isChecked) {
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
|
|
|
args.putParcelable("uri", _uri);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new SimpleTask<String>() {
|
|
|
|
if (paranoid) {
|
|
|
|
@Override
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
args.putParcelable("uri", _uri);
|
|
|
|
cbOrganization.setText("…");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
new SimpleTask<String>() {
|
|
|
|
protected String onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
@Override
|
|
|
|
Uri uri = args.getParcelable("uri");
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
String host = uri.getHost();
|
|
|
|
tvOwner.setText("…");
|
|
|
|
return (TextUtils.isEmpty(host) ? null : Helper.getOrganization(host));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onExecuted(Bundle args, String organization) {
|
|
|
|
protected String onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
cbOrganization.setText(organization == null ? "?" : organization);
|
|
|
|
Uri uri = args.getParcelable("uri");
|
|
|
|
}
|
|
|
|
String host = uri.getHost();
|
|
|
|
|
|
|
|
return (TextUtils.isEmpty(host) ? null : Helper.getOrganization(host));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
protected void onExecuted(Bundle args, String organization) {
|
|
|
|
cbOrganization.setText(ex.getMessage());
|
|
|
|
tvOwner.setText(organization == null ? "?" : organization);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.execute(context, owner, args, "link:domain");
|
|
|
|
|
|
|
|
} else
|
|
|
|
@Override
|
|
|
|
cbOrganization.setText(R.string.title_show_organization);
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
}
|
|
|
|
tvOwner.setText(ex.getMessage());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}.execute(context, owner, args, "link:domain");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
etLink.setText(_uri.toString());
|
|
|
|
|
|
|
|
cbOrganization.setChecked(prefs.getBoolean("show_organization", true));
|
|
|
|
|
|
|
|
tvInsecure.setVisibility("http".equals(_uri.getScheme()) ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new DialogBuilderLifecycle(context, owner)
|
|
|
|
new DialogBuilderLifecycle(context, owner)
|
|
|
|
.setView(view)
|
|
|
|
.setView(view)
|
|
|
|