mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -05:00
no monospace for key ids
This commit is contained in:
parent
6062b5ef68
commit
da4a70c513
@ -121,8 +121,7 @@ public class ViewCertActivity extends ActionBarActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||||
if (data.moveToFirst()) {
|
if (data.moveToFirst()) {
|
||||||
SpannableString signeeKey = KeyFormattingUtils.beautifyKeyId(data.getLong(INDEX_MASTER_KEY_ID));
|
mSigneeKey.setText(KeyFormattingUtils.beautifyKeyId(data.getLong(INDEX_MASTER_KEY_ID)));
|
||||||
mSigneeKey.setText(signeeKey);
|
|
||||||
|
|
||||||
String signeeUid = data.getString(INDEX_USER_ID);
|
String signeeUid = data.getString(INDEX_USER_ID);
|
||||||
mSigneeUid.setText(signeeUid);
|
mSigneeUid.setText(signeeUid);
|
||||||
@ -131,8 +130,7 @@ public class ViewCertActivity extends ActionBarActivity
|
|||||||
mCreation.setText(DateFormat.getDateFormat(getApplicationContext()).format(creationDate));
|
mCreation.setText(DateFormat.getDateFormat(getApplicationContext()).format(creationDate));
|
||||||
|
|
||||||
mCertifierKeyId = data.getLong(INDEX_KEY_ID_CERTIFIER);
|
mCertifierKeyId = data.getLong(INDEX_KEY_ID_CERTIFIER);
|
||||||
SpannableString certifierKey = KeyFormattingUtils.beautifyKeyId(mCertifierKeyId);
|
mCertifierKey.setText(KeyFormattingUtils.beautifyKeyId(mCertifierKeyId));
|
||||||
mCertifierKey.setText(certifierKey);
|
|
||||||
|
|
||||||
String certifierUid = data.getString(INDEX_SIGNER_UID);
|
String certifierUid = data.getString(INDEX_SIGNER_UID);
|
||||||
if (certifierUid != null) {
|
if (certifierUid != null) {
|
||||||
|
@ -220,7 +220,7 @@ public class ViewKeyCertsFragment extends LoaderFragment
|
|||||||
TextView wSignerName = (TextView) view.findViewById(R.id.signerName);
|
TextView wSignerName = (TextView) view.findViewById(R.id.signerName);
|
||||||
TextView wSignStatus = (TextView) view.findViewById(R.id.signStatus);
|
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));
|
String[] userId = KeyRing.splitUserId(cursor.getString(mIndexSignerUserId));
|
||||||
if (userId[0] != null) {
|
if (userId[0] != null) {
|
||||||
wSignerName.setText(userId[0]);
|
wSignerName.setText(userId[0]);
|
||||||
|
@ -261,7 +261,7 @@ public class KeyFormattingUtils {
|
|||||||
* @param idHex - the key id
|
* @param idHex - the key id
|
||||||
* @return - the beautified form
|
* @return - the beautified form
|
||||||
*/
|
*/
|
||||||
public static SpannableString beautifyKeyId(String idHex) {
|
public static String beautifyKeyId(String idHex) {
|
||||||
if (idHex.startsWith("0x")) {
|
if (idHex.startsWith("0x")) {
|
||||||
idHex = idHex.substring(2);
|
idHex = idHex.substring(2);
|
||||||
}
|
}
|
||||||
@ -276,9 +276,7 @@ public class KeyFormattingUtils {
|
|||||||
idHex = sb.toString();
|
idHex = sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpannableString ss = new SpannableString(idHex);
|
return idHex;
|
||||||
ss.setSpan(new TypefaceSpan("monospace"), 0, idHex.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
return ss;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,19 +286,15 @@ public class KeyFormattingUtils {
|
|||||||
* @param keyId - the key id
|
* @param keyId - the key id
|
||||||
* @return - the beautified form
|
* @return - the beautified form
|
||||||
*/
|
*/
|
||||||
public static SpannableString beautifyKeyId(long keyId) {
|
public static String beautifyKeyId(long keyId) {
|
||||||
return beautifyKeyId(convertKeyIdToHex(keyId));
|
return beautifyKeyId(convertKeyIdToHex(keyId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpannableStringBuilder beautifyKeyIdWithPrefix(Context context, String idHex) {
|
public static String beautifyKeyIdWithPrefix(Context context, String idHex) {
|
||||||
SpannableStringBuilder ssb = new SpannableStringBuilder();
|
return "ID: " + beautifyKeyId(idHex);
|
||||||
ssb.append("ID");
|
|
||||||
ssb.append(": ");
|
|
||||||
ssb.append(beautifyKeyId(idHex));
|
|
||||||
return ssb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpannableStringBuilder beautifyKeyIdWithPrefix(Context context, long keyId) {
|
public static String beautifyKeyIdWithPrefix(Context context, long keyId) {
|
||||||
return beautifyKeyIdWithPrefix(context, convertKeyIdToHex(keyId));
|
return beautifyKeyIdWithPrefix(context, convertKeyIdToHex(keyId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,15 +219,15 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpannableStringBuilder getSecondary() {
|
public String getSecondary() {
|
||||||
if (mUserId[1] != null) {
|
if (mUserId[1] != null) {
|
||||||
return new SpannableStringBuilder(mUserId[1]);
|
return mUserId[1];
|
||||||
} else {
|
} else {
|
||||||
return getKeyIdHex();
|
return getKeyIdHex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpannableStringBuilder getTertiary() {
|
public String getTertiary() {
|
||||||
if (mUserId[0] != null) {
|
if (mUserId[0] != null) {
|
||||||
return getKeyIdHex();
|
return getKeyIdHex();
|
||||||
} else {
|
} else {
|
||||||
@ -239,7 +239,7 @@ public class EncryptKeyCompletionView extends TokenCompleteTextView {
|
|||||||
return mKeyId;
|
return mKeyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpannableStringBuilder getKeyIdHex() {
|
public String getKeyIdHex() {
|
||||||
return KeyFormattingUtils.beautifyKeyIdWithPrefix(getContext(), mKeyId);
|
return KeyFormattingUtils.beautifyKeyIdWithPrefix(getContext(), mKeyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user