no monospace for key ids

This commit is contained in:
Dominik Schürmann 2014-09-20 18:12:13 +02:00
parent 6062b5ef68
commit da4a70c513
4 changed files with 13 additions and 21 deletions

View File

@ -121,8 +121,7 @@ public class ViewCertActivity extends ActionBarActivity
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (data.moveToFirst()) {
SpannableString signeeKey = KeyFormattingUtils.beautifyKeyId(data.getLong(INDEX_MASTER_KEY_ID));
mSigneeKey.setText(signeeKey);
mSigneeKey.setText(KeyFormattingUtils.beautifyKeyId(data.getLong(INDEX_MASTER_KEY_ID)));
String signeeUid = data.getString(INDEX_USER_ID);
mSigneeUid.setText(signeeUid);
@ -131,8 +130,7 @@ public class ViewCertActivity extends ActionBarActivity
mCreation.setText(DateFormat.getDateFormat(getApplicationContext()).format(creationDate));
mCertifierKeyId = data.getLong(INDEX_KEY_ID_CERTIFIER);
SpannableString certifierKey = KeyFormattingUtils.beautifyKeyId(mCertifierKeyId);
mCertifierKey.setText(certifierKey);
mCertifierKey.setText(KeyFormattingUtils.beautifyKeyId(mCertifierKeyId));
String certifierUid = data.getString(INDEX_SIGNER_UID);
if (certifierUid != null) {

View File

@ -220,7 +220,7 @@ public class ViewKeyCertsFragment extends LoaderFragment
TextView wSignerName = (TextView) view.findViewById(R.id.signerName);
TextView wSignStatus = (TextView) view.findViewById(R.id.signStatus);
SpannableStringBuilder signerKeyId = KeyFormattingUtils.beautifyKeyIdWithPrefix(getActivity(), cursor.getLong(mIndexSignerKeyId));
String signerKeyId = KeyFormattingUtils.beautifyKeyIdWithPrefix(getActivity(), cursor.getLong(mIndexSignerKeyId));
String[] userId = KeyRing.splitUserId(cursor.getString(mIndexSignerUserId));
if (userId[0] != null) {
wSignerName.setText(userId[0]);

View File

@ -261,7 +261,7 @@ public class KeyFormattingUtils {
* @param idHex - the key id
* @return - the beautified form
*/
public static SpannableString beautifyKeyId(String idHex) {
public static String beautifyKeyId(String idHex) {
if (idHex.startsWith("0x")) {
idHex = idHex.substring(2);
}
@ -276,9 +276,7 @@ public class KeyFormattingUtils {
idHex = sb.toString();
}
SpannableString ss = new SpannableString(idHex);
ss.setSpan(new TypefaceSpan("monospace"), 0, idHex.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return ss;
return idHex;
}
/**
@ -288,19 +286,15 @@ public class KeyFormattingUtils {
* @param keyId - the key id
* @return - the beautified form
*/
public static SpannableString beautifyKeyId(long keyId) {
public static String beautifyKeyId(long keyId) {
return beautifyKeyId(convertKeyIdToHex(keyId));
}
public static SpannableStringBuilder beautifyKeyIdWithPrefix(Context context, String idHex) {
SpannableStringBuilder ssb = new SpannableStringBuilder();
ssb.append("ID");
ssb.append(": ");
ssb.append(beautifyKeyId(idHex));
return ssb;
public static String beautifyKeyIdWithPrefix(Context context, String idHex) {
return "ID: " + beautifyKeyId(idHex);
}
public static SpannableStringBuilder beautifyKeyIdWithPrefix(Context context, long keyId) {
public static String beautifyKeyIdWithPrefix(Context context, long keyId) {
return beautifyKeyIdWithPrefix(context, convertKeyIdToHex(keyId));
}

View File

@ -219,15 +219,15 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
}
}
public SpannableStringBuilder getSecondary() {
public String getSecondary() {
if (mUserId[1] != null) {
return new SpannableStringBuilder(mUserId[1]);
return mUserId[1];
} else {
return getKeyIdHex();
}
}
public SpannableStringBuilder getTertiary() {
public String getTertiary() {
if (mUserId[0] != null) {
return getKeyIdHex();
} else {
@ -239,7 +239,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
return mKeyId;
}
public SpannableStringBuilder getKeyIdHex() {
public String getKeyIdHex() {
return KeyFormattingUtils.beautifyKeyIdWithPrefix(getContext(), mKeyId);
}