show jid monospaced in verify dialog

This commit is contained in:
Daniel Gultsch 2016-12-04 13:39:08 +01:00
parent 1a89915b31
commit 1e7b4030bb
3 changed files with 11 additions and 3 deletions

View File

@ -37,7 +37,6 @@ public final class BlockContactDialog {
builder.setTitle(isBlocked ? R.string.action_unblock_domain : R.string.action_block_domain); builder.setTitle(isBlocked ? R.string.action_unblock_domain : R.string.action_block_domain);
value = blockable.getJid().toDomainJid().toString(); value = blockable.getJid().toDomainJid().toString();
spannable = new SpannableString(context.getString(isBlocked ? R.string.unblock_domain_text : R.string.block_domain_text, value)); spannable = new SpannableString(context.getString(isBlocked ? R.string.unblock_domain_text : R.string.block_domain_text, value));
message.setText(spannable);
} else { } else {
builder.setTitle(isBlocked ? R.string.action_unblock_contact : R.string.action_block_contact); builder.setTitle(isBlocked ? R.string.action_unblock_contact : R.string.action_block_contact);
value = blockable.getJid().toBareJid().toString(); value = blockable.getJid().toBareJid().toString();

View File

@ -28,7 +28,10 @@ import android.os.Parcelable;
import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.text.Editable; import android.text.Editable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.style.TypefaceSpan;
import android.util.Pair; import android.util.Pair;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
@ -893,7 +896,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
View view = getLayoutInflater().inflate(R.layout.dialog_verify_fingerprints, null); View view = getLayoutInflater().inflate(R.layout.dialog_verify_fingerprints, null);
final CheckBox isTrustedSource = (CheckBox) view.findViewById(R.id.trusted_source); final CheckBox isTrustedSource = (CheckBox) view.findViewById(R.id.trusted_source);
TextView warning = (TextView) view.findViewById(R.id.warning); TextView warning = (TextView) view.findViewById(R.id.warning);
warning.setText(getString(R.string.verifying_omemo_keys_trusted_source,contact.getJid().toBareJid().toString(),contact.getDisplayName())); String jid = contact.getJid().toBareJid().toString();
SpannableString spannable = new SpannableString(getString(R.string.verifying_omemo_keys_trusted_source,jid,contact.getDisplayName()));
int start = spannable.toString().indexOf(jid);
if (start >= 0) {
spannable.setSpan(new TypefaceSpan("monospace"),start,start + jid.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
warning.setText(spannable);
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.confirm, new OnClickListener() { builder.setPositiveButton(R.string.confirm, new OnClickListener() {
@Override @Override

View File

@ -721,6 +721,6 @@
<string name="pref_clean_private_storage">Clean private storage</string> <string name="pref_clean_private_storage">Clean private storage</string>
<string name="pref_clean_private_storage_summary">Clean private storage where files are kept (They can be re-downloaded from the server)</string> <string name="pref_clean_private_storage_summary">Clean private storage where files are kept (They can be re-downloaded from the server)</string>
<string name="i_followed_this_link_from_a_trusted_source">I followed this link from a trusted source</string> <string name="i_followed_this_link_from_a_trusted_source">I followed this link from a trusted source</string>
<string name="verifying_omemo_keys_trusted_source">You are about to verify the OMEMO keys form %1$s after clicking a link. This is only secure if you followed this link from a trusted source where only %2$s could have published this link.</string> <string name="verifying_omemo_keys_trusted_source">You are about to verify the OMEMO keys of %1$s after clicking a link. This is only secure if you followed this link from a trusted source where only %2$s could have published this link.</string>
<string name="verify_omemo_keys">Verify OMEMO keys</string> <string name="verify_omemo_keys">Verify OMEMO keys</string>
</resources> </resources>