diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460d8b..0000000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 3787f8eff2..5cc2bcc062 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -72,7 +72,7 @@ dependencies {
implementation "com.jakewharton.timber:timber:$rootProject.ext.timberVersion"
implementation 'com.nulab-inc:zxcvbn:1.2.3'
-
+ //compile files('lib/sunjce_provider.jar')
testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:$rootProject.ext.okHttpVersion"
diff --git a/app/lib/sunjce_provider.jar b/app/lib/sunjce_provider.jar
new file mode 100755
index 0000000000..79facc3cf1
Binary files /dev/null and b/app/lib/sunjce_provider.jar differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4bf5b3a696..7f10e51de7 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,6 +8,7 @@
+
diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java
index 82bc40a822..3edb1ae49d 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java
@@ -19,6 +19,7 @@
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputLayout;
@@ -35,6 +36,7 @@
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;
@@ -71,6 +73,15 @@ public class GenerateFragment extends Fragment {
private TextInputLayout etWalletViewKey;
private TextInputLayout etWalletSpendKey;
private TextInputLayout etWalletRestoreHeight;
+
+ private LinearLayout llNfcPasswordSeed;
+ private TextInputLayout etNfcPasswordSeed;
+ private ImageView ivNfcPasswordSeed;
+
+ private LinearLayout llNfcPasswordkey;
+ private TextInputLayout etNfcPasswordkey;
+ private ImageView ivNfcPasswordkey;
+
private Button bGenerate;
private String type = null;
@@ -92,8 +103,26 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
etWalletViewKey = (TextInputLayout) view.findViewById(R.id.etWalletViewKey);
etWalletSpendKey = (TextInputLayout) view.findViewById(R.id.etWalletSpendKey);
etWalletRestoreHeight = (TextInputLayout) view.findViewById(R.id.etWalletRestoreHeight);
+
+ llNfcPasswordSeed = (LinearLayout) view.findViewById(R.id.llNfcPasswordSeed);
+ etNfcPasswordSeed = (TextInputLayout) view.findViewById(R.id.etNfcPasswordSeed);
+ ivNfcPasswordSeed = (ImageView) view.findViewById(R.id.ivNfcPasswordSeed);
+ llNfcPasswordkey = (LinearLayout) view.findViewById(R.id.llNfcPasswordkey);
+ etNfcPasswordkey = (TextInputLayout) view.findViewById(R.id.etNfcPasswordkey);
+ ivNfcPasswordkey = (ImageView) view.findViewById(R.id.ivNfcPasswordkey);
+
bGenerate = (Button) view.findViewById(R.id.bGenerate);
+ ivNfcPasswordkey.setImageResource(R.drawable.nfc_signal);
+ ivNfcPasswordSeed.setImageResource(R.drawable.nfc_signal);
+ AnimationDrawable nfcAnimationkey = (AnimationDrawable) ivNfcPasswordkey.getDrawable();
+ nfcAnimationkey.setOneShot(false);
+ nfcAnimationkey.start();
+
+ AnimationDrawable nfcAnimationSeed = (AnimationDrawable) ivNfcPasswordSeed.getDrawable();
+ nfcAnimationSeed.setOneShot(false);
+ nfcAnimationSeed.start();
+
etWalletMnemonic.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT);
etWalletAddress.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
etWalletViewKey.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
@@ -212,6 +241,8 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
+ llNfcPasswordSeed.setVisibility(View.VISIBLE);
+
} else if (type.equals(TYPE_KEY) || type.equals(TYPE_VIEWONLY)) {
etWalletPassword.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
@@ -252,6 +283,8 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
+
+ llNfcPasswordkey.setVisibility(View.VISIBLE);
}
if (type.equals(TYPE_KEY)) {
etWalletSpendKey.setVisibility(View.VISIBLE);
@@ -268,6 +301,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
+ llNfcPasswordkey.setVisibility(View.VISIBLE);
}
if (!type.equals(TYPE_NEW)) {
etWalletRestoreHeight.setVisibility(View.VISIBLE);
@@ -281,6 +315,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
+
}
bGenerate.setOnClickListener(new View.OnClickListener()
diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java
index cabcb83088..3c436df1af 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java
@@ -562,4 +562,4 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return openDialog;
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
index b4473cad1d..dae830567b 100644
--- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
+++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
@@ -18,13 +18,20 @@
import android.app.Activity;
import android.app.AlertDialog;
+import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.media.MediaScannerConnection;
+import android.nfc.NfcAdapter;
+import android.nfc.tech.NfcA;
+import android.nfc.tech.NfcB;
+import android.nfc.tech.NfcF;
+import android.nfc.tech.NfcV;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
@@ -45,10 +52,14 @@
import com.m2049r.xmrwallet.dialog.AboutFragment;
import com.m2049r.xmrwallet.dialog.CreditsFragment;
import com.m2049r.xmrwallet.dialog.HelpFragment;
+import com.m2049r.xmrwallet.dialog.InputNfcPasswordFragment;
import com.m2049r.xmrwallet.dialog.PrivacyFragment;
import com.m2049r.xmrwallet.model.NetworkType;
import com.m2049r.xmrwallet.model.Wallet;
import com.m2049r.xmrwallet.model.WalletManager;
+import com.m2049r.xmrwallet.nfc.AuthenticationException;
+import com.m2049r.xmrwallet.nfc.TagUtil;
+import com.m2049r.xmrwallet.nfc.ThreeDES;
import com.m2049r.xmrwallet.service.WalletService;
import com.m2049r.xmrwallet.util.FingerprintHelper;
import com.m2049r.xmrwallet.util.Helper;
@@ -58,6 +69,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.Socket;
@@ -78,6 +90,16 @@ public class LoginActivity extends SecureActivity
private Toolbar toolbar;
+ private TagUtil tagUtil;
+
+ private InputNfcPasswordFragment inputNfcPassword;
+
+ protected NfcAdapter nfcAdapter = null;
+ protected PendingIntent pendingIntent = null;
+ protected IntentFilter[] mFilters = null;
+ protected String[][] mTechLists = new String[][]{new String[]{NfcA.class.getName()}, new String[]{NfcF.class.getName()},
+ new String[]{NfcB.class.getName()}, new String[]{NfcV.class.getName()}};
+
@Override
public void setToolbarButton(int type) {
toolbar.setButton(type);
@@ -136,6 +158,8 @@ public void onButton(int type) {
} else {
Timber.i("Waiting for permissions");
}
+
+ initNfc();
}
boolean checkServiceRunning() {
@@ -319,7 +343,6 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
-
dialog.show();
}
@@ -349,6 +372,37 @@ protected void onPostExecute(Boolean result) {
}
}
+ private class AsyncBackupToNFC extends AsyncTask