Updated on 2026-08-14
This commit is contained in:
parent
8c17a8d4f0
commit
b19c306250
70 changed files with 6149 additions and 6206 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -11,3 +11,4 @@
|
|||
app/libs/
|
||||
.idea/vcs.xml
|
||||
.idea/caches
|
||||
.idea/dictionaries
|
||||
|
|
|
|||
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
52
app/src/main/java/com/tangem/VerticalTextView.java
Normal file
52
app/src/main/java/com/tangem/VerticalTextView.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package com.tangem;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
||||
public class VerticalTextView extends AppCompatTextView {
|
||||
final boolean topDown;
|
||||
|
||||
public VerticalTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
final int gravity = getGravity();
|
||||
if (Gravity.isVertical(gravity) && (gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
|
||||
setGravity((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
|
||||
topDown = false;
|
||||
} else {
|
||||
topDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(heightMeasureSpec, widthMeasureSpec);
|
||||
setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
TextPaint textPaint = getPaint();
|
||||
textPaint.setColor(getCurrentTextColor());
|
||||
textPaint.drawableState = getDrawableState();
|
||||
|
||||
canvas.save();
|
||||
|
||||
if (topDown) {
|
||||
canvas.translate(getWidth(), 0);
|
||||
canvas.rotate(90);
|
||||
} else {
|
||||
canvas.translate(0, getHeight());
|
||||
canvas.rotate(-90);
|
||||
}
|
||||
|
||||
canvas.translate(getCompoundPaddingLeft(), getExtendedPaddingTop());
|
||||
|
||||
getLayout().draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
package com.tangem.data.network;
|
||||
|
||||
public class Server {
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.data.network.request;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
|
@ -17,8 +17,6 @@ public class Electrum_Request {
|
|||
public static final String METHOD_SendTransaction = "blockchain.transaction.broadcast";
|
||||
public static final String METHOD_GetFee = "blockchain.estimatefee";
|
||||
|
||||
|
||||
|
||||
public JSONObject jsRequestData;
|
||||
public String answerData;
|
||||
public String error;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.data.network.request;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.data.network.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.wallet.SharedData;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.data.network.task;
|
||||
|
||||
/**
|
||||
* Created by Ilia on 16.01.2018.
|
||||
|
|
@ -6,7 +6,7 @@ package com.tangem.wallet;
|
|||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.tangem.wallet.ExchangeRequest;
|
||||
import com.tangem.data.network.request.ExchangeRequest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.data.network.task;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.tangem.wallet.Fee_Request;
|
||||
import com.tangem.wallet.SharedData;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.data.network.task;
|
||||
|
||||
/**
|
||||
* Created by Ilia on 19.12.2017.
|
||||
|
|
@ -6,6 +6,9 @@ package com.tangem.wallet;
|
|||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.nfc.Tag;
|
||||
|
|
@ -32,14 +32,12 @@ import java.util.Calendar;
|
|||
|
||||
import javax.crypto.KeyAgreement;
|
||||
|
||||
|
||||
/**
|
||||
* Created by dvol on 14.07.2017.
|
||||
*/
|
||||
|
||||
public class CardProtocol {
|
||||
|
||||
|
||||
public interface Notifications {
|
||||
void OnReadStart(CardProtocol cardProtocol);
|
||||
|
||||
|
|
@ -56,7 +54,6 @@ public class CardProtocol {
|
|||
void OnReadAfterRequest();
|
||||
}
|
||||
|
||||
|
||||
public void setError(Exception error) {
|
||||
mError = error;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.nfc.TagLostException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
/**
|
||||
* Created by dvol on 07.03.2018.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
|
|
@ -16,6 +16,8 @@ import android.os.Bundle;
|
|||
import android.support.v4.app.ActivityCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.presentation.dialog.NFCEnableDialog;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class NfcManager {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import org.spongycastle.crypto.CipherParameters;
|
||||
import org.spongycastle.crypto.digests.SHA256Digest;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
/**
|
||||
* Created by dvol on 07.03.2018.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
/**
|
||||
* Created by dvol on 07.03.2018.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
public class TLVException extends Exception {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
/**
|
||||
* Created by dvol on 23.06.2017.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.domain.cardReader;
|
||||
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
|
|
@ -18,7 +18,6 @@ import java.security.MessageDigest;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.SecureRandom;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.BitSet;
|
||||
import java.util.Date;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
package com.tangem.presentation;
|
||||
|
||||
public class Screen {
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ import android.view.MenuItem;
|
|||
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.WalletInfoFragment;
|
||||
import com.tangem.presentation.fragment.WalletInfoFragment;
|
||||
|
||||
public class CardInfoActivity extends AppCompatActivity implements WalletInfoFragment.OnFragmentInteractionListener {
|
||||
|
||||
|
|
|
|||
|
|
@ -22,20 +22,20 @@ import android.widget.RadioGroup;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.wallet.BTCUtils;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.wallet.DerEncodingUtil;
|
||||
import com.tangem.wallet.Electrum_Request;
|
||||
import com.tangem.wallet.Electrum_Task;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.wallet.Fee_Request;
|
||||
import com.tangem.wallet.Fee_Task;
|
||||
import com.tangem.data.network.task.Fee_Task;
|
||||
import com.tangem.wallet.FormatUtil;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.wallet.Infura_Task;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.wallet.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.WaitSecurityDelayDialog;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class CreateNewWalletActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.wallet.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.VerifyCardTask;
|
||||
import com.tangem.wallet.WaitSecurityDelayDialog;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import android.nfc.Tag;
|
|||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.tangem.wallet.LoadedWalletActivityFragment;
|
||||
import com.tangem.presentation.fragment.LoadedWalletActivityFragment;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import com.tangem.wallet.DeviceNFCAntennaLocation;
|
|||
import com.tangem.wallet.LastSignStorage;
|
||||
import com.tangem.wallet.LogFileProvider;
|
||||
import com.tangem.wallet.Logger;
|
||||
import com.tangem.wallet.MainActivityFragment;
|
||||
import com.tangem.presentation.fragment.MainActivityFragment;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.PhoneUtility;
|
||||
import com.tangem.wallet.R;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import android.widget.EditText;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.wallet.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.WaitSecurityDelayDialog;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class PurgeActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import android.widget.Button;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.wallet.FingerprintHelper;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import android.widget.Toast;
|
|||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.wallet.Electrum_Request;
|
||||
import com.tangem.wallet.Electrum_Task;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.wallet.Infura_Task;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.wallet.LastSignStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -15,14 +15,14 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.wallet.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.WaitSecurityDelayDialog;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import android.os.Bundle;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.VerifyCardActivityFragment;
|
||||
import com.tangem.presentation.fragment.VerifyCardActivityFragment;
|
||||
|
||||
public class VerifyCardActivity extends AppCompatActivity {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
|
@ -10,9 +10,14 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
|
@ -9,6 +9,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import static android.text.Html.FROM_HTML_MODE_COMPACT;
|
||||
|
||||
/**
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.cardReader;
|
||||
package com.tangem.presentation.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.dialog;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
|
|
@ -6,6 +6,8 @@ import android.app.DialogFragment;
|
|||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
public class NoExtendedLengthSupportDialog extends DialogFragment {
|
||||
|
||||
public static boolean allreadyShowed=false;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
|
@ -10,6 +10,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
|
@ -39,15 +39,34 @@ import com.google.zxing.WriterException;
|
|||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.presentation.activity.CreateNewWalletActivity;
|
||||
import com.tangem.presentation.activity.PreparePaymentActivity;
|
||||
import com.tangem.presentation.activity.PurgeActivity;
|
||||
import com.tangem.presentation.activity.RequestPINActivity;
|
||||
import com.tangem.presentation.activity.SwapPINActivity;
|
||||
import com.tangem.presentation.activity.VerifyCardActivity;
|
||||
import com.tangem.wallet.BTCUtils;
|
||||
import com.tangem.wallet.BitcoinException;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.data.network.request.ExchangeRequest;
|
||||
import com.tangem.data.network.task.ExchangeTask;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.wallet.LastSignStorage;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.wallet.VerifyCardTask;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
|
|
@ -24,13 +24,29 @@ import android.view.ViewGroup;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
import com.tangem.presentation.activity.EmptyWalletActivity;
|
||||
import com.tangem.presentation.activity.LoadedWalletActivity;
|
||||
import com.tangem.presentation.activity.MainActivity;
|
||||
import com.tangem.presentation.activity.RequestPINActivity;
|
||||
import com.tangem.wallet.Blockchain;
|
||||
import com.tangem.presentation.adapter.CardListAdapter;
|
||||
import com.tangem.wallet.CoinEngine;
|
||||
import com.tangem.wallet.CoinEngineFactory;
|
||||
import com.tangem.data.network.request.Electrum_Request;
|
||||
import com.tangem.data.network.task.Electrum_Task;
|
||||
import com.tangem.data.network.request.ExchangeRequest;
|
||||
import com.tangem.data.network.task.ExchangeTask;
|
||||
import com.tangem.wallet.Infura_Request;
|
||||
import com.tangem.data.network.task.Infura_Task;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.wallet.PINStorage;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.SharedData;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
|
@ -15,7 +15,9 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.wallet;
|
||||
package com.tangem.presentation.fragment;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
|
|
@ -20,6 +20,8 @@ import com.google.zxing.WriterException;
|
|||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.tangem.wallet.R;
|
||||
import com.tangem.wallet.Tangem_Card;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
|
|
@ -6,49 +6,18 @@ package com.tangem.wallet;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.cardReader.Util;
|
||||
|
||||
import org.spongycastle.asn1.ASN1EncodableVector;
|
||||
import org.spongycastle.asn1.ASN1Integer;
|
||||
import org.spongycastle.asn1.DERSequence;
|
||||
import org.spongycastle.asn1.DERSequenceGenerator;
|
||||
import org.spongycastle.asn1.sec.SECNamedCurves;
|
||||
import org.spongycastle.asn1.x9.X9ECParameters;
|
||||
import org.spongycastle.asn1.x9.X9IntegerConverter;
|
||||
import org.spongycastle.crypto.params.ECDomainParameters;
|
||||
import org.spongycastle.crypto.params.ECPrivateKeyParameters;
|
||||
import org.spongycastle.crypto.params.ECPublicKeyParameters;
|
||||
import org.spongycastle.crypto.signers.ECDSASigner;
|
||||
import org.spongycastle.jce.ECNamedCurveTable;
|
||||
import org.spongycastle.jce.spec.ECNamedCurveParameterSpec;
|
||||
import org.spongycastle.jce.spec.ECPrivateKeySpec;
|
||||
import org.spongycastle.jce.spec.ECPublicKeySpec;
|
||||
import org.spongycastle.math.ec.ECAlgorithms;
|
||||
import org.spongycastle.math.ec.ECCurve;
|
||||
import org.spongycastle.math.ec.ECPoint;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.security.SignatureException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.text.Format;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.bitcoinj.core.ECKey.CURVE;
|
||||
import static org.bitcoinj.core.ECKey.HALF_CURVE_ORDER;
|
||||
|
||||
@SuppressWarnings({"WeakerAccess", "TryWithIdenticalCatches", "unused"})
|
||||
public final class BTCUtils {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
package com.tangem.wallet;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.Util;
|
||||
|
||||
import org.bitcoinj.core.Base58;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by dvol on 06.08.2017.
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package com.tangem.wallet;
|
|||
|
||||
import android.net.Uri;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.TLV;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.TLV;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.math.BigDecimal;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package com.tangem.wallet;
|
|||
|
||||
import android.net.Uri;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.TLV;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.TLV;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.math.BigDecimal;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.tangem.wallet;
|
|||
|
||||
import android.net.Uri;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
|
|
|
|||
|
|
@ -5,16 +5,14 @@ package com.tangem.wallet;
|
|||
*/
|
||||
|
||||
public class CoinEngineFactory {
|
||||
public static CoinEngine Create(Blockchain chain)
|
||||
{
|
||||
if(Blockchain.BitcoinCash == chain || Blockchain.BitcoinCashTestNet == chain) {
|
||||
public static CoinEngine Create(Blockchain chain) {
|
||||
if (Blockchain.BitcoinCash == chain || Blockchain.BitcoinCashTestNet == chain) {
|
||||
return new BtcCashEngine();
|
||||
}else if(Blockchain.Bitcoin == chain || Blockchain.BitcoinTestNet == chain) {
|
||||
} else if (Blockchain.Bitcoin == chain || Blockchain.BitcoinTestNet == chain) {
|
||||
return new BtcEngine(); //TODO: ВРЕМЕНГГО!!!!
|
||||
}else if(Blockchain.Ethereum == chain || Blockchain.EthereumTestNet == chain) {
|
||||
} else if (Blockchain.Ethereum == chain || Blockchain.EthereumTestNet == chain) {
|
||||
return new EthEngine();
|
||||
}
|
||||
else if(Blockchain.Token == chain) {
|
||||
} else if (Blockchain.Token == chain) {
|
||||
return new TokenEngine();
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.tangem.wallet;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
|
||||
import org.spongycastle.asn1.ASN1EncodableVector;
|
||||
import org.spongycastle.asn1.ASN1Integer;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package com.tangem.wallet;
|
|||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.TLV;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.TLV;
|
||||
|
||||
import org.bitcoinj.core.ECKey;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
package com.tangem.wallet;
|
||||
|
||||
import com.tangem.cardReader.CardCrypto;
|
||||
import com.tangem.domain.cardReader.CardCrypto;
|
||||
|
||||
import org.spongycastle.jce.ECNamedCurveTable;
|
||||
import org.spongycastle.jce.spec.ECNamedCurveParameterSpec;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.tangem.cardReader.CardCrypto.*;
|
||||
|
||||
/**
|
||||
* Created by dvol on 14.11.2017.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.tangem.wallet;
|
|||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import android.content.SharedPreferences;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.util.Base64;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -31,7 +31,7 @@ public class PINStorage {
|
|||
}
|
||||
|
||||
|
||||
static List<String> getPINs() {
|
||||
public static List<String> getPINs() {
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
if (mLastUsedPIN != null) result.add(mLastUsedPIN);
|
||||
if (mEncryptedPIN != null && !result.contains(mEncryptedPIN)) result.add(mEncryptedPIN);
|
||||
|
|
@ -41,7 +41,7 @@ public class PINStorage {
|
|||
return result;
|
||||
}
|
||||
|
||||
static void setLastUsedPIN(String PIN) {
|
||||
public static void setLastUsedPIN(String PIN) {
|
||||
mLastUsedPIN = PIN;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,16 @@
|
|||
package com.tangem.wallet;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.tangem.cardReader.SettingsMask;
|
||||
import com.tangem.cardReader.Util;
|
||||
import com.tangem.domain.cardReader.SettingsMask;
|
||||
import com.tangem.domain.cardReader.Util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* Created by dvol on 16.07.2017.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import android.net.Uri;
|
|||
import android.util.Log;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.TLV;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.TLV;
|
||||
|
||||
import org.bitcoinj.core.ECKey;
|
||||
|
||||
|
|
@ -24,51 +24,46 @@ import static com.tangem.wallet.FormatUtil.GetDecimalFormat;
|
|||
* Created by Ilia on 20.03.2018.
|
||||
*/
|
||||
|
||||
public class TokenEngine extends CoinEngine{
|
||||
public String GetNextNode(Tangem_Card mCard)
|
||||
{
|
||||
public class TokenEngine extends CoinEngine {
|
||||
public String GetNextNode(Tangem_Card mCard) {
|
||||
return "abc1.hsmiths.com";
|
||||
}
|
||||
public int GetNextNodePort(Tangem_Card mCard)
|
||||
{
|
||||
|
||||
public int GetNextNodePort(Tangem_Card mCard) {
|
||||
return 60001;
|
||||
}
|
||||
public String GetNode(Tangem_Card mCard)
|
||||
{
|
||||
|
||||
public String GetNode(Tangem_Card mCard) {
|
||||
return "abc1.hsmiths.com";
|
||||
}
|
||||
public int GetNodePort(Tangem_Card mCard)
|
||||
{
|
||||
|
||||
public int GetNodePort(Tangem_Card mCard) {
|
||||
return 60001;
|
||||
}
|
||||
public void SwitchNode(Tangem_Card mCard)
|
||||
{
|
||||
|
||||
public void SwitchNode(Tangem_Card mCard) {
|
||||
}
|
||||
public boolean AwaitingConfirmation(Tangem_Card card)
|
||||
{
|
||||
|
||||
public boolean AwaitingConfirmation(Tangem_Card card) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean InOutPutVisible()
|
||||
{
|
||||
public boolean InOutPutVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String GetBalanceCurrency(Tangem_Card card)
|
||||
{
|
||||
public String GetBalanceCurrency(Tangem_Card card) {
|
||||
String currency = card.getTokenSymbol();
|
||||
if(Strings.isNullOrEmpty(currency))
|
||||
if (Strings.isNullOrEmpty(currency))
|
||||
return "NoN";
|
||||
return currency;
|
||||
}
|
||||
|
||||
public String GetFeeCurrency()
|
||||
{
|
||||
public String GetFeeCurrency() {
|
||||
return "Gwei";
|
||||
}
|
||||
|
||||
BigDecimal convertToEth(String value)
|
||||
{
|
||||
BigDecimal convertToEth(String value) {
|
||||
BigInteger m = new BigInteger(value, 10);
|
||||
BigDecimal n = new BigDecimal(m);
|
||||
BigDecimal d = n.divide(new BigDecimal("1000000000000000000"));
|
||||
|
|
@ -77,17 +72,15 @@ public class TokenEngine extends CoinEngine{
|
|||
}
|
||||
|
||||
|
||||
public int GetTokenDecimals(Tangem_Card card)
|
||||
{
|
||||
public int GetTokenDecimals(Tangem_Card card) {
|
||||
return card.getTokensDecimal();
|
||||
}
|
||||
|
||||
public String GetContractAddress(Tangem_Card card)
|
||||
{
|
||||
public String GetContractAddress(Tangem_Card card) {
|
||||
return card.getContractAddress();
|
||||
}
|
||||
public boolean IsNeedCheckNode()
|
||||
{
|
||||
|
||||
public boolean IsNeedCheckNode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -96,21 +89,18 @@ public class TokenEngine extends CoinEngine{
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!address.startsWith("0x")&&!address.startsWith("0X"))
|
||||
{
|
||||
if (!address.startsWith("0x") && !address.startsWith("0X")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(address.length()!=42)
|
||||
{
|
||||
if (address.length() != 42) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public String GetBalanceAlterValue(Tangem_Card mCard)
|
||||
{
|
||||
public String GetBalanceAlterValue(Tangem_Card mCard) {
|
||||
String dec = mCard.getDecimalBalanceAlter();
|
||||
BigDecimal d = convertToEth(dec);
|
||||
String s = d.toString();
|
||||
|
|
@ -121,9 +111,8 @@ public class TokenEngine extends CoinEngine{
|
|||
return output;
|
||||
}
|
||||
|
||||
public String GetBalanceValue(Tangem_Card mCard)
|
||||
{
|
||||
if(!HasBalanceInfo(mCard))
|
||||
public String GetBalanceValue(Tangem_Card mCard) {
|
||||
if (!HasBalanceInfo(mCard))
|
||||
return "-- -- -- " + GetBalanceCurrency(mCard);
|
||||
|
||||
String dec = mCard.getDecimalBalance();
|
||||
|
|
@ -138,28 +127,24 @@ public class TokenEngine extends CoinEngine{
|
|||
return output;
|
||||
}
|
||||
|
||||
public boolean CheckAmount(Tangem_Card card, String amount) throws Exception
|
||||
{
|
||||
public boolean CheckAmount(Tangem_Card card, String amount) throws Exception {
|
||||
DecimalFormat decimalFormat = GetDecimalFormat();
|
||||
BigDecimal amountValue = (BigDecimal) decimalFormat.parse(amount); //new BigDecimal(strAmount);
|
||||
BigDecimal maxValue = new BigDecimal(GetBalanceValue(card));
|
||||
if(amountValue.compareTo(maxValue) > 0 )
|
||||
{
|
||||
if (amountValue.compareTo(maxValue) > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Long GetBalanceLong(Tangem_Card mCard)
|
||||
{
|
||||
public Long GetBalanceLong(Tangem_Card mCard) {
|
||||
return mCard.getBalance();
|
||||
}
|
||||
|
||||
public boolean IsBalanceAlterNotZero(Tangem_Card card)
|
||||
{
|
||||
public boolean IsBalanceAlterNotZero(Tangem_Card card) {
|
||||
String balance = card.getDecimalBalanceAlter();
|
||||
if(balance == null || balance == "")
|
||||
if (balance == null || balance == "")
|
||||
return false;
|
||||
|
||||
BigDecimal bi = new BigDecimal(balance);
|
||||
|
|
@ -170,10 +155,9 @@ public class TokenEngine extends CoinEngine{
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean IsBalanceNotZero(Tangem_Card card)
|
||||
{
|
||||
public boolean IsBalanceNotZero(Tangem_Card card) {
|
||||
String balance = card.getDecimalBalance();
|
||||
if(balance == null || balance == "")
|
||||
if (balance == null || balance == "")
|
||||
return false;
|
||||
|
||||
BigDecimal bi = new BigDecimal(balance);
|
||||
|
|
@ -184,21 +168,20 @@ public class TokenEngine extends CoinEngine{
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean HasBalanceInfo(Tangem_Card card)
|
||||
{
|
||||
public boolean HasBalanceInfo(Tangem_Card card) {
|
||||
String balance = card.getDecimalBalance();
|
||||
if(balance == null || balance == "")
|
||||
if (balance == null || balance == "")
|
||||
return false;
|
||||
|
||||
String balanceEx = card.getDecimalBalanceAlter();
|
||||
if(balanceEx == null || balanceEx == "")
|
||||
if (balanceEx == null || balanceEx == "")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetBalanceEquivalent(Tangem_Card mCard) {
|
||||
if(!HasBalanceInfo(mCard)){
|
||||
if (!HasBalanceInfo(mCard)) {
|
||||
return "-- -- -- ";
|
||||
}
|
||||
String dec = mCard.getDecimalBalance();
|
||||
|
|
@ -208,7 +191,7 @@ public class TokenEngine extends CoinEngine{
|
|||
|
||||
@Override
|
||||
public String GetBalance(Tangem_Card mCard) {
|
||||
if(!HasBalanceInfo(mCard)){
|
||||
if (!HasBalanceInfo(mCard)) {
|
||||
return "-- -- -- " + GetBalanceCurrency(mCard);
|
||||
}
|
||||
|
||||
|
|
@ -218,15 +201,12 @@ public class TokenEngine extends CoinEngine{
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String GetBalanceWithAlter(Tangem_Card mCard)
|
||||
{
|
||||
public String GetBalanceWithAlter(Tangem_Card mCard) {
|
||||
//return GetBalance(mCard) + "\n(" + GetBalanceAlterValue(mCard) + " ETH)";
|
||||
return " " + GetBalance(mCard) + " <br><small><small> + " + GetBalanceAlterValue(mCard) + " ETH for gas</small></small>";
|
||||
}
|
||||
|
||||
public String calculateAddress(Tangem_Card mCard, byte[] pkUncompressed) throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||
public String calculateAddress(Tangem_Card mCard, byte[] pkUncompressed) throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||
Keccak256 kec = new Keccak256();
|
||||
int lenPk = pkUncompressed.length;
|
||||
if (lenPk < 2) {
|
||||
|
|
@ -262,35 +242,29 @@ public class TokenEngine extends CoinEngine{
|
|||
}
|
||||
|
||||
|
||||
public String GetAmountEqualentDescriptor(Tangem_Card mCard, String value)
|
||||
{
|
||||
public String GetAmountEqualentDescriptor(Tangem_Card mCard, String value) {
|
||||
BigDecimal d = new BigDecimal(value);
|
||||
return EthEngine.getAmountEquivalentDescriptionETH(d, mCard.getRate());
|
||||
}
|
||||
|
||||
public String GetFeeEqualentDescriptor(Tangem_Card mCard, String value)
|
||||
{
|
||||
public String GetFeeEqualentDescriptor(Tangem_Card mCard, String value) {
|
||||
BigDecimal d = new BigDecimal(value);
|
||||
return EthEngine.getAmountEquivalentDescriptionETH(d, mCard.getRateAlter());
|
||||
}
|
||||
|
||||
public Uri getShareWalletURIExplorer(Tangem_Card mCard)
|
||||
{
|
||||
return Uri.parse("https://etherscan.io/token/"+GetContractAddress(mCard)+"?a=" + mCard.getWallet());
|
||||
public Uri getShareWalletURIExplorer(Tangem_Card mCard) {
|
||||
return Uri.parse("https://etherscan.io/token/" + GetContractAddress(mCard) + "?a=" + mCard.getWallet());
|
||||
}
|
||||
|
||||
public Uri getShareWalletURI(Tangem_Card mCard)
|
||||
{
|
||||
public Uri getShareWalletURI(Tangem_Card mCard) {
|
||||
return Uri.parse("" + mCard.getWallet());
|
||||
}
|
||||
|
||||
public boolean CheckUnspentTransaction(Tangem_Card mCard)
|
||||
{
|
||||
public boolean CheckUnspentTransaction(Tangem_Card mCard) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean CheckAmountValie(Tangem_Card mCard, String amountValue, String feeValue, Long minFeeInInternalUnits)
|
||||
{
|
||||
public boolean CheckAmountValie(Tangem_Card mCard, String amountValue, String feeValue, Long minFeeInInternalUnits) {
|
||||
Long fee = null;
|
||||
BigDecimal amount = null;
|
||||
try {
|
||||
|
|
@ -301,14 +275,14 @@ public class TokenEngine extends CoinEngine{
|
|||
return false;
|
||||
}
|
||||
|
||||
if(fee == null || amount == null)
|
||||
if (fee == null || amount == null)
|
||||
return false;
|
||||
|
||||
if(fee == 0 || amount.compareTo(BigDecimal.ZERO) == 0)
|
||||
if (fee == 0 || amount.compareTo(BigDecimal.ZERO) == 0)
|
||||
return false;
|
||||
|
||||
|
||||
if(fee < minFeeInInternalUnits)
|
||||
if (fee < minFeeInInternalUnits)
|
||||
return false;
|
||||
|
||||
|
||||
|
|
@ -322,8 +296,7 @@ public class TokenEngine extends CoinEngine{
|
|||
return true;
|
||||
}
|
||||
|
||||
public String EvaluteFeeEquivalent(Tangem_Card mCard, String fee)
|
||||
{
|
||||
public String EvaluteFeeEquivalent(Tangem_Card mCard, String fee) {
|
||||
BigDecimal gweFee = new BigDecimal(fee);
|
||||
gweFee = gweFee.divide(new BigDecimal("1000000000"));
|
||||
gweFee = gweFee.setScale(18, RoundingMode.DOWN);
|
||||
|
|
@ -334,7 +307,7 @@ public class TokenEngine extends CoinEngine{
|
|||
|
||||
BigInteger nonceValue = mCard.GetConfirmTXCount();
|
||||
byte[] pbKey = mCard.getWalletPublicKey();
|
||||
boolean flag = (mCard.getSigningMethod()== Tangem_Card.SigningMethod.Sign_Hash_Validated_By_Issuer);
|
||||
boolean flag = (mCard.getSigningMethod() == Tangem_Card.SigningMethod.Sign_Hash_Validated_By_Issuer);
|
||||
Issuer issuer = mCard.getIssuer();
|
||||
|
||||
|
||||
|
|
@ -353,8 +326,6 @@ public class TokenEngine extends CoinEngine{
|
|||
BigInteger amount = amountDec.toBigInteger(); //new BigInteger(amountValue, 10);
|
||||
|
||||
|
||||
|
||||
|
||||
//amount = amount.subtract(fee);
|
||||
|
||||
BigInteger nonce = nonceValue;
|
||||
|
|
@ -384,12 +355,11 @@ public class TokenEngine extends CoinEngine{
|
|||
amountLeadZero = amountLeadZero.substring(2);
|
||||
}
|
||||
|
||||
while(amountLeadZero.length() < 64)
|
||||
{
|
||||
while (amountLeadZero.length() < 64) {
|
||||
amountLeadZero = "0" + amountLeadZero;
|
||||
}
|
||||
|
||||
String cmd = "a9059cbb000000000000000000000000"+to+amountLeadZero; //TODO only for BAT
|
||||
String cmd = "a9059cbb000000000000000000000000" + to + amountLeadZero; //TODO only for BAT
|
||||
|
||||
|
||||
byte[] data = BTCUtils.fromHex(cmd);
|
||||
|
|
@ -416,8 +386,7 @@ public class TokenEngine extends CoinEngine{
|
|||
|
||||
boolean f = ECKey.verify(for_hash, new ECKey.ECDSASignature(r, s), pbKey);
|
||||
|
||||
if(!f)
|
||||
{
|
||||
if (!f) {
|
||||
Log.e("ETH-CHECK", "Sign Failed.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import android.content.Context;
|
|||
import android.nfc.tech.IsoDep;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tangem.cardReader.CardProtocol;
|
||||
import com.tangem.cardReader.NfcManager;
|
||||
import com.tangem.domain.cardReader.CardProtocol;
|
||||
import com.tangem.domain.cardReader.NfcManager;
|
||||
|
||||
/**
|
||||
* Created by dvol on 04.02.2018.
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
package com.tangem.wallet;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class VerticalTextView extends TextView
|
||||
{
|
||||
final boolean topDown;
|
||||
|
||||
public VerticalTextView( Context context,
|
||||
AttributeSet attrs )
|
||||
{
|
||||
super( context, attrs );
|
||||
final int gravity = getGravity();
|
||||
if ( Gravity.isVertical( gravity )
|
||||
&& ( gravity & Gravity.VERTICAL_GRAVITY_MASK )
|
||||
== Gravity.BOTTOM )
|
||||
{
|
||||
setGravity(
|
||||
( gravity & Gravity.HORIZONTAL_GRAVITY_MASK )
|
||||
| Gravity.TOP );
|
||||
topDown = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
topDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure( int widthMeasureSpec,
|
||||
int heightMeasureSpec )
|
||||
{
|
||||
super.onMeasure( heightMeasureSpec,
|
||||
widthMeasureSpec );
|
||||
setMeasuredDimension( getMeasuredHeight(),
|
||||
getMeasuredWidth() );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw( Canvas canvas )
|
||||
{
|
||||
TextPaint textPaint = getPaint();
|
||||
textPaint.setColor( getCurrentTextColor() );
|
||||
textPaint.drawableState = getDrawableState();
|
||||
|
||||
canvas.save();
|
||||
|
||||
if ( topDown )
|
||||
{
|
||||
canvas.translate( getWidth(), 0 );
|
||||
canvas.rotate( 90 );
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas.translate( 0, getHeight() );
|
||||
canvas.rotate( -90 );
|
||||
}
|
||||
|
||||
canvas.translate( getCompoundPaddingLeft(),
|
||||
getExtendedPaddingTop() );
|
||||
|
||||
getLayout().draw( canvas );
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
android:alpha="0.5"
|
||||
android:background="@color/white" />
|
||||
|
||||
<com.tangem.wallet.VerticalTextView
|
||||
<com.tangem.VerticalTextView
|
||||
android:id="@+id/tvType"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/loaded_wallet_fragment"
|
||||
android:name="com.tangem.wallet.LoadedWalletActivityFragment"
|
||||
android:name="com.tangem.presentation.fragment.LoadedWalletActivityFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fragmentMain"
|
||||
android:name="com.tangem.wallet.MainActivityFragment"
|
||||
android:name="com.tangem.presentation.fragment.MainActivityFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/verify_card_fragment"
|
||||
android:name="com.tangem.wallet.VerifyCardActivityFragment"
|
||||
android:name="com.tangem.presentation.fragment.VerifyCardActivityFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
android:padding="0dp"
|
||||
tools:context="com.tangem.wallet.LoadedWalletActivityFragment"
|
||||
tools:context="com.tangem.wallet.com.tangem.presentation.fragment.LoadedWalletActivityFragment"
|
||||
tools:showIn="@layout/activity_loaded_wallet">
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.tangem.wallet.MainActivityFragment"
|
||||
tools:context="com.tangem.wallet.com.tangem.presentation.fragment.MainActivityFragment"
|
||||
tools:showIn="@layout/content_main">
|
||||
|
||||
<!--<android.support.v4.widget.SwipeRefreshLayout-->
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
android:padding="0dp"
|
||||
tools:context="com.tangem.wallet.VerifyCardActivityFragment"
|
||||
tools:context="com.tangem.wallet.com.tangem.presentation.fragment.VerifyCardActivityFragment"
|
||||
tools:showIn="@layout/activity_verify_card">
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.tangem.wallet.WalletInfoFragment">
|
||||
tools:context="com.tangem.wallet.com.tangem.presentation.fragment.WalletInfoFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qrWallet"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue