View identity:
- Show fingerprint (en) - Generate QR code from identity key
This commit is contained in:
@@ -37,16 +37,19 @@ dependencies {
|
||||
compile ('com.mcxiaoke.viewpagerindicator:library:2.4.1') {
|
||||
exclude group: 'com.android.support', module: 'support-v4'
|
||||
}
|
||||
compile 'com.google.zxing:android-integration:3.1.0'
|
||||
}
|
||||
|
||||
dependencyVerification {
|
||||
verify = [
|
||||
'net.i2p.android:client:29815aa778f19bbf2c9d003e30289cca214481bb0fb17afe8adb77641aa7875f',
|
||||
'com.android.support:support-v4:3f40fa7b3a4ead01ce15dce9453b061646e7fe2e7c51cb75ca01ee1e77037f3f',
|
||||
'com.android.support:appcompat-v7:9df7637c5219202ddbbbf0924c2d5a9e6d64379166795a89d8f75d1e3f3372df',
|
||||
'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:a94f35b8b701d2cf761bb6b731d0921f73fb552a69a9c1d1379a19c2a9418ec6',
|
||||
'com.github.chrisbanes.actionbarpulltorefresh:library:ea06f4e8cf7ae959cbe37028acf2631a6950714d2112e16531e4528daf69b6db',
|
||||
'com.github.castorflex.smoothprogressbar:library:eb35b46d99a7f56d3d173cafe5f0f31beaaba0ce606258f81b07b0607ee3c32f',
|
||||
'com.mcxiaoke.viewpagerindicator:library:470bbd2bec1ede64ad21efd6f02676807d22f1b526c4ac6a5b41a428c6e47e67',
|
||||
'com.google.zxing:android-integration:89e56aadf1164bd71e57949163c53abf90af368b51669c0d4a47a163335f95c4',
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -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