View identity:
- Show fingerprint (en) - Generate QR code from identity key
This commit is contained in:
@@ -27,9 +27,12 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
|
||||
public class ViewIdentityFragment extends Fragment {
|
||||
public static final String IDENTITY_KEY = "identity_key";
|
||||
|
||||
@@ -39,9 +42,12 @@ public class ViewIdentityFragment extends Fragment {
|
||||
ImageView mIdentityPicture;
|
||||
TextView mNameField;
|
||||
TextView mDescField;
|
||||
TextView mFingerprintField;
|
||||
TextView mCryptoField;
|
||||
TextView mKeyField;
|
||||
|
||||
Button mGenQRCode;
|
||||
|
||||
public static ViewIdentityFragment newInstance(String key) {
|
||||
ViewIdentityFragment f = new ViewIdentityFragment();
|
||||
Bundle args = new Bundle();
|
||||
@@ -70,8 +76,10 @@ public class ViewIdentityFragment extends Fragment {
|
||||
mIdentityPicture = (ImageView) view.findViewById(R.id.identity_picture);
|
||||
mNameField = (TextView) view.findViewById(R.id.public_name);
|
||||
mDescField = (TextView) view.findViewById(R.id.description);
|
||||
mFingerprintField = (TextView) view.findViewById(R.id.fingerprint);
|
||||
mCryptoField = (TextView) view.findViewById(R.id.crypto_impl);
|
||||
mKeyField = (TextView) view.findViewById(R.id.key);
|
||||
mGenQRCode = (Button) view.findViewById(R.id.generate_qr);
|
||||
|
||||
if (mKey != null) {
|
||||
try {
|
||||
@@ -100,8 +108,22 @@ public class ViewIdentityFragment extends Fragment {
|
||||
|
||||
mNameField.setText(mIdentity.getPublicName());
|
||||
mDescField.setText(mIdentity.getDescription());
|
||||
try {
|
||||
mFingerprintField.setText(BoteHelper.getFingerprint(mIdentity, "en"));
|
||||
} catch (GeneralSecurityException e) {
|
||||
// Could not get fingerprint
|
||||
mFingerprintField.setText(e.getLocalizedMessage());
|
||||
}
|
||||
mCryptoField.setText(mIdentity.getCryptoImpl().getName());
|
||||
mKeyField.setText(mKey);
|
||||
|
||||
mGenQRCode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
IntentIntegrator i = new IntentIntegrator(getActivity());
|
||||
i.shareText("bote:" + mKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,12 +35,22 @@
|
||||
android:ems="10"
|
||||
android:text="@string/description" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Key information"
|
||||
android:id="@+id/title_key_info"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/description"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/crypto_impl"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/description"
|
||||
android:layout_below="@+id/description"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/title_key_info"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="Crypto implementation" />
|
||||
|
||||
@@ -52,4 +62,33 @@
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="Key" />
|
||||
|
||||
<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/key"
|
||||
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" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Generate QR code"
|
||||
android:id="@+id/generate_qr"
|
||||
android:layout_below="@+id/fingerprint"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user