Fingerprint field for contacts, not filled yet

The regular Fingerprint doesn't work here because it requires the salt, which is
not part of the public Destination. The salt is published with the Destination
in the public address book, and could be conveyed between Bote apps via NFC or
QR code, but that doesn't work for Destinations published in other spaces.
This commit is contained in:
str4d
2014-08-28 06:37:58 +00:00
parent ba2009e63a
commit 1e404b62d1
2 changed files with 28 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ public class ViewContactFragment extends Fragment {
TextView mTextField;
TextView mCryptoField;
TextView mDestinationField;
TextView mFingerprintField;
public static ViewContactFragment newInstance(String destination) {
ViewContactFragment f = new ViewContactFragment();
@@ -74,6 +75,7 @@ public class ViewContactFragment extends Fragment {
mTextField = (TextView) view.findViewById(R.id.text);
mCryptoField = (TextView) view.findViewById(R.id.crypto_impl);
mDestinationField = (TextView) view.findViewById(R.id.destination);
mFingerprintField = (TextView) view.findViewById(R.id.fingerprint);
if (mDestination != null) {
try {
@@ -98,6 +100,13 @@ public class ViewContactFragment extends Fragment {
mTextField.setText(mContact.getText());
mCryptoField.setText(mContact.getDestination().getCryptoImpl().getName());
mDestinationField.setText(mDestination);
try {
String locale = getActivity().getResources().getConfiguration().locale.getLanguage();
mFingerprintField.setText(BoteHelper.getFingerprint(mContact, locale));
} catch (GeneralSecurityException e) {
// Could not get fingerprint
mFingerprintField.setText(e.getLocalizedMessage());
}
}
}

View File

@@ -62,4 +62,23 @@
android:layout_marginTop="5dp"
android:text="Destination" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Fingerprint"
android:id="@+id/title_fingerprint"
android:layout_alignParentLeft="true"
android:layout_below="@id/destination"
android:layout_marginTop="5dp" />
<TextView
android:id="@+id/fingerprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/title_fingerprint"
android:layout_marginTop="5dp"
android:text="Fingerprint" />
</RelativeLayout>