Updated on 2026-08-14

This commit is contained in:
Tangem 2019-01-28 13:48:41 +03:00
commit 700f62e25e
597 changed files with 23678 additions and 1823 deletions

View file

@ -17,7 +17,7 @@ android {
targetSdkVersion 28
versionCode 103
versionName "0.811.1." + generateVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
androidExtensions {
experimental = true
@ -47,10 +47,10 @@ dependencies {
implementation project(':tangemcard-common')
implementation project(':tangemcard-android')
implementation project(':tangemserver-android')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'com.google.dagger:dagger:2.16'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.google.code.gson:gson:2.8.5'

View file

@ -8,7 +8,7 @@
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.USE_BIOMETRICT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
@ -99,17 +99,17 @@
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.tangem.presentation.activity.PreparePaymentActivity"
android:name="com.tangem.presentation.activity.PrepareTransactionActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.tangem.presentation.activity.ConfirmPaymentActivity"
android:name="com.tangem.presentation.activity.ConfirmTransactionActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.tangem.presentation.activity.SignPaymentActivity"
android:name="com.tangem.presentation.activity.SignTransactionActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />

View file

@ -1,7 +1,7 @@
package com.tangem;
import android.app.Application;
import android.support.v7.app.AppCompatDelegate;
import androidx.appcompat.app.AppCompatDelegate;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -22,7 +22,6 @@ import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.List;
public class App extends Application {
/**

View file

@ -13,7 +13,7 @@ object Constant {
const val EXTRA_MODIFICATION_UPDATE = "update"
// LoadedWallet, VerifyCard
const val REQUEST_CODE_SEND_PAYMENT = 1
const val REQUEST_CODE_SEND_TRANSACTION = 1
const val REQUEST_CODE_PURGE = 2
const val REQUEST_CODE_REQUEST_PIN2_FOR_PURGE = 3
const val REQUEST_CODE_VERIFY_CARD = 4
@ -21,7 +21,7 @@ object Constant {
const val REQUEST_CODE_ENTER_NEW_PIN2 = 6
const val REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN = 7
const val REQUEST_CODE_SWAP_PIN = 8
const val REQUEST_CODE_RECEIVE_PAYMENT = 9
const val REQUEST_CODE_RECEIVE_TRANSACTION = 9
// MainActivity
const val REQUEST_CODE_SHOW_CARD_ACTIVITY = 1
@ -57,26 +57,26 @@ object Constant {
const val REQUEST_CODE_CREATE_NEW_WALLET_ACTIVITY = 2
const val REQUEST_CODE_REQUEST_PIN2 = 3
// ConfirmPaymentActivity
const val REQUEST_CODE_SIGN_PAYMENT = 1
// ConfirmTransactionActivity
const val REQUEST_CODE_SIGN_TRANSACTION = 1
const val REQUEST_CODE_REQUEST_PIN2_ = 2
// SendTransactionActivity
const val EXTRA_TX: String = "TX"
// SignPaymentActivity
// SignTransactionActivity
const val EXTRA_AMOUNT = "Amount"
const val EXTRA_AMOUNT_CURRENCY = "AmountCurrency"
const val EXTRA_FEE = "Fee"
const val EXTRA_FEE_CURRENCY = "FeeCurrency"
const val EXTRA_FEE_INCLUDED = "FeeIncluded"
const val EXTRA_TARGET_ADDRESS = "TargetAddress"
const val REQUEST_CODE_SEND_PAYMENT_ = 1
const val REQUEST_CODE_SEND_TRANSACTION_ = 1
const val RESULT_INVALID_PIN_ = Activity.RESULT_FIRST_USER
// PreparePaymentActivity
// PrepareTransactionActivity
const val REQUEST_CODE_SCAN_QR = 1
const val REQUEST_CODE_SEND_PAYMENT__ = 2
const val REQUEST_CODE_SEND_TRANSACTION__ = 2
// PrepareCryptonitOtherApiWithdrawalActivity
const val REQUEST_CODE_SCAN_QR_KEY = 1

View file

@ -1,7 +1,7 @@
package com.tangem.data.network;
import android.annotation.SuppressLint;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import com.tangem.App;
@ -24,18 +24,18 @@ public class ServerApiCommon {
public static final int ESTIMATE_FEE_PRIORITY = 2;
public static final int ESTIMATE_FEE_NORMAL = 3;
public static final int ESTIMATE_FEE_MINIMAL = 6;
private EstimateFeeListener estimateFeeListener;
private EstimatedFeeListener estimatedFeeListener;
public interface EstimateFeeListener {
public interface EstimatedFeeListener {
void onSuccess(int blockCount, String estimateFeeResponse);
void onFail(int blockCount, String message);
}
public void setEstimateFee(EstimateFeeListener listener) {
estimateFeeListener = listener;
public void setBtcEstimatedFeeListener(EstimatedFeeListener listener) {
estimatedFeeListener = listener;
}
public void estimateFee(int blockCount) {
public void requestBtcEstimatedFee(int blockCount) {
EstimatefeeApi estimatefeeApi = App.getNetworkComponent().getRetrofitEstimatefee().create(EstimatefeeApi.class);
Call<String> call;
@ -60,17 +60,17 @@ public class ServerApiCommon {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.code() == 200) {
estimateFeeListener.onSuccess(blockCount, response.body());
Log.i(TAG, "estimateFee onResponse " + response.code() + " " + response.body());
estimatedFeeListener.onSuccess(blockCount, response.body());
Log.i(TAG, "requestBtcEstimatedFee onResponse " + response.code() + " " + response.body());
} else
estimateFeeListener.onFail(blockCount, response.body());
Log.e(TAG, "estimateFee onResponse " + response.code());
estimatedFeeListener.onFail(blockCount, response.body());
Log.e(TAG, "requestBtcEstimatedFee onResponse " + response.code());
}
@Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
estimateFeeListener.onFail(blockCount, t.getMessage());
Log.e(TAG, "estimateFee onFailure " + t.getMessage());
estimatedFeeListener.onFail(blockCount, t.getMessage());
Log.e(TAG, "requestBtcEstimatedFee onFailure " + t.getMessage());
}
});
}
@ -79,18 +79,18 @@ public class ServerApiCommon {
* HTTP
* Used in Crypto-currency course
*/
private RateInfoDataListener rateInfoDataListener;
private RateInfoListener rateInfoListener;
public interface RateInfoDataListener {
public interface RateInfoListener {
void onSuccess(RateInfoResponse rateInfoResponse);
}
public void setRateInfoData(RateInfoDataListener listener) {
rateInfoDataListener = listener;
public void setRateInfoListener(RateInfoListener listener) {
rateInfoListener = listener;
}
@SuppressLint("CheckResult")
public void rateInfoData(String cryptoId) {
public void requestRateInfo(String cryptoId) {
CoinmarketApi coinmarketApi = App.getNetworkComponent().getRetrofitCoinmarketcap().create(CoinmarketApi.class);
coinmarketApi.getRateInfoList()
@ -100,12 +100,12 @@ public class ServerApiCommon {
if (!rateInfoModelList.isEmpty()) {
for (RateInfoResponse rateInfoMode : rateInfoModelList) {
if (rateInfoMode.getId().equals(cryptoId)) {
rateInfoDataListener.onSuccess(rateInfoMode);
Log.i(TAG, "rateInfoData " + cryptoId + " onResponse " + "200");
rateInfoListener.onSuccess(rateInfoMode);
Log.i(TAG, "requestRateInfo " + cryptoId + " onResponse " + "200");
}
}
} else
Log.e(TAG, "rateInfoData " + cryptoId + " onResponse " + "Empty");
Log.e(TAG, "requestRateInfo " + cryptoId + " onResponse " + "Empty");
},
// handle error
Throwable::printStackTrace);

View file

@ -9,7 +9,6 @@ import com.tangem.domain.wallet.bch.BitcoinCashNode;
import com.tangem.domain.wallet.btc.BitcoinNode;
import com.tangem.domain.wallet.btc.BitcoinNodeTestNet;
import com.tangem.domain.wallet.ltc.LitecoinNode;
import com.tangem.tangemcard.reader.CardProtocol;
import com.tangem.wallet.R;
import java.io.BufferedReader;
@ -24,7 +23,6 @@ import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
@ -47,13 +45,13 @@ import io.reactivex.schedulers.Schedulers;
/**
* Request processor for Electrum Api
* Every request live cycle:
* 1. In application create request and call {@link ServerApiElectrum}.electrumRequestData(..)
* 1. In application create request and call {@link ServerApiElectrum}.requestData(..)
* 2. Try send every request for max 4 times,
* 3. If all 4 times fail call DefaultObserver<ElectrumRequest>.onError (defined in .electrumRequestData(..)) and than
* {@link ElectrumRequestDataListener}.onFail(...) callback
* 3. If all 4 times fail call DefaultObserver<ElectrumRequest>.onError (defined in .requestData(..)) and than
* {@link ResponseListener}.onFail(...) callback
* Error can be acquired with {@link ElectrumRequest}.getError() method
* 4. If request network communication finished successfully then call DefaultObserver<ElectrumRequest>.onComplete (defined in .electrumRequestData) and than
* {@link ElectrumRequestDataListener}.onSuccess(...) callback
* 4. If request network communication finished successfully then call DefaultObserver<ElectrumRequest>.onComplete (defined in .requestData) and than
* {@link ResponseListener}.onSuccess(...) callback
*/
public class ServerApiElectrum {
private static String TAG = ServerApiElectrum.class.getSimpleName();
@ -62,7 +60,7 @@ public class ServerApiElectrum {
* TCP, SSL
* Used in BTC, BCH
*/
private ElectrumRequestDataListener electrumRequestDataListener;
private ResponseListener responseListener;
private String host;
private int port;
@ -76,7 +74,7 @@ public class ServerApiElectrum {
/**
* Interface for notification every request result
*/
public interface ElectrumRequestDataListener {
public interface ResponseListener {
/**
* Notify that request processing was successful
@ -94,8 +92,8 @@ public class ServerApiElectrum {
* Set notificaion listener
* @param listener
*/
public void setElectrumRequestData(ElectrumRequestDataListener listener) {
electrumRequestDataListener = listener;
public void setResponseListener(ResponseListener listener) {
responseListener = listener;
}
@ -104,7 +102,7 @@ public class ServerApiElectrum {
* @param ctx
* @param electrumRequest
*/
public void electrumRequestData(TangemContext ctx, ElectrumRequest electrumRequest) {
public void requestData(TangemContext ctx, ElectrumRequest electrumRequest) {
requestsCount++;
Log.i(TAG, String.format("New request[%d]: %s", requestsCount,electrumRequest.getMethod()));
Observable<ElectrumRequest> checkElectrumDataObserver = Observable.just(electrumRequest)
@ -129,20 +127,20 @@ public class ServerApiElectrum {
@Override
public void onNext(ElectrumRequest v) {
if (electrumRequest.answerData != null) {
Log.i(TAG, "electrumRequestData " + electrumRequest.getMethod() + " onNext != null");
Log.i(TAG, "requestData " + electrumRequest.getMethod() + " onNext != null");
} else {
Log.e(TAG, "electrumRequestData " + electrumRequest.getMethod() + " onNext == null");
Log.e(TAG, "requestData " + electrumRequest.getMethod() + " onNext == null");
}
}
@Override
public void onError(Throwable e) {
requestsCount--;
Log.e(TAG, "electrumRequestData " + electrumRequest.getMethod() + " onError " + e.getMessage());
Log.e(TAG, "requestData " + electrumRequest.getMethod() + " onError " + e.getMessage());
Log.e(TAG, String.format("%d requests left in processing",requestsCount));
electrumRequest.setError(ctx.getString(R.string.cannot_obtain_data_from_blockchain));
//setErrorOccurred(e.getMessage());//;
electrumRequestDataListener.onFail(electrumRequest);
responseListener.onFail(electrumRequest);
}
/**
@ -152,16 +150,16 @@ public class ServerApiElectrum {
public void onComplete() {
requestsCount--;
if (electrumRequest.answerData != null) {
Log.i(TAG, "electrumRequestData " + electrumRequest.getMethod() + " onComplete, answerData!=null");
Log.i(TAG, "requestData " + electrumRequest.getMethod() + " onComplete, answerData!=null");
} else {
Log.e(TAG, "electrumRequestData " + electrumRequest.getMethod() + " onComplete, answerData==null");
Log.e(TAG, "requestData " + electrumRequest.getMethod() + " onComplete, answerData==null");
}
Log.e(TAG, String.format("%d requests left in processing",requestsCount));
if (electrumRequest.answerData != null && electrumRequest.getError()==null) {
electrumRequestDataListener.onSuccess(electrumRequest);
responseListener.onSuccess(electrumRequest);
} else {
// if( error==null || error.isEmpty() ) setErrorOccurred(ctx.getString(R.string.cannot_obtain_data_from_blockchain));
electrumRequestDataListener.onFail(electrumRequest);
responseListener.onFail(electrumRequest);
}
}
@ -257,7 +255,7 @@ public class ServerApiElectrum {
} catch (ConnectException e) {
//e.printStackTrace();
//electrumRequestDataListener.onFail(e.getMessage());
//responseListener.onFail(e.getMessage());
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_no_connection));
Log.e(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " ConnectException " + e.getMessage());
} finally {
@ -274,7 +272,7 @@ public class ServerApiElectrum {
}
} catch (IOException e) {
//e.printStackTrace();
//electrumRequestDataListener.onFail(e.getMessage());
//responseListener.onFail(e.getMessage());
electrumRequest.setError(App.getInstance().getString(R.string.cannot_obtain_data_from_blockchain_communication_error));
Log.e(TAG, "doElectrumRequestTcp " + electrumRequest.getMethod() + " IOException " + e.getMessage());
}

View file

@ -1,6 +1,6 @@
package com.tangem.data.network;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import com.tangem.App;
@ -38,19 +38,19 @@ public class ServerApiInfura {
return requestsCount <= 0;
}
private InfuraBodyListener infuraBodyListener;
private ResponseListener responseListener;
public interface InfuraBodyListener {
public interface ResponseListener {
void onSuccess(String method, InfuraResponse infuraResponse);
void onFail(String method, String message);
}
public void setInfuraResponse(InfuraBodyListener listener) {
infuraBodyListener = listener;
public void setResponseListener(ResponseListener listener) {
responseListener = listener;
}
public void infura(String method, int id, String wallet, String contract, String tx) {
public void requestData(String method, int id, String wallet, String contract, String tx) {
requestsCount++;
InfuraApi infuraApi = App.getNetworkComponent().getRetrofitInfura().create(InfuraApi.class);
@ -86,18 +86,18 @@ public class ServerApiInfura {
public void onResponse(@NonNull Call<InfuraResponse> call, @NonNull Response<InfuraResponse> response) {
if (response.code() == 200) {
requestsCount--;
infuraBodyListener.onSuccess(method, response.body());
Log.i(TAG, "infura " + method + " onResponse " + response.code());
responseListener.onSuccess(method, response.body());
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
} else {
infuraBodyListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "infura " + method + " onResponse " + response.code());
responseListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
}
}
@Override
public void onFailure(@NonNull Call<InfuraResponse> call, @NonNull Throwable t) {
infuraBodyListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "infura " + method + " onFailure " + t.getMessage());
responseListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
}
});
}

View file

@ -1,6 +1,6 @@
package com.tangem.data.network;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import com.tangem.data.network.model.InsightBody;
@ -32,21 +32,21 @@ public class ServerApiInsight {
return requestsCount <= 0;
}
private InsightBodyListener insightBodyListener;
private ResponseListener responseListener;
public interface InsightBodyListener {
public interface ResponseListener {
void onSuccess(String method, InsightResponse insightResponse);
void onSuccess(String method, List<InsightResponse> utxoList);
void onFail(String method, String message);
}
public void setInsightResponse(InsightBodyListener listener) {
insightBodyListener = listener;
public void setResponseListener(ResponseListener listener) {
responseListener = listener;
}
public void insight(String method, String wallet, String tx) {
public void requestData(String method, String wallet, String tx) {
requestsCount++;
String insightURL = "http://130.185.109.17:3001/insight-api"; //TODO: make random selection
String insightURL = "http://130.185.109.17:3001/requestData-api"; //TODO: make random selection
this.lastNode = insightURL; //TODO: show node instead of URL
Retrofit retrofitInsight = new Retrofit.Builder() //TODO: move to NetworkModule+NetworkComponent if possible
@ -64,18 +64,18 @@ public class ServerApiInsight {
public void onResponse(@NonNull Call<List<InsightResponse>> call, @NonNull Response<List<InsightResponse>> response) {
if (response.code() == 200) {
requestsCount--;
insightBodyListener.onSuccess(method, response.body());
Log.i(TAG, "insight " + method + " onResponse " + response.code());
responseListener.onSuccess(method, response.body());
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
} else {
insightBodyListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "insight " + method + " onResponse " + response.code());
responseListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
}
}
@Override
public void onFailure(@NonNull Call<List<InsightResponse>> call, @NonNull Throwable t) {
insightBodyListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "insight " + method + " onFailure " + t.getMessage());
responseListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
}
});
@ -112,18 +112,18 @@ public class ServerApiInsight {
public void onResponse(@NonNull Call<InsightResponse> call, @NonNull Response<InsightResponse> response) {
if (response.code() == 200) {
requestsCount--;
insightBodyListener.onSuccess(method, response.body());
Log.i(TAG, "insight " + method + " onResponse " + response.code());
responseListener.onSuccess(method, response.body());
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
} else {
insightBodyListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "insight " + method + " onResponse " + response.code());
responseListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
}
}
@Override
public void onFailure(@NonNull Call<InsightResponse> call, @NonNull Throwable t) {
insightBodyListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "insight " + method + " onFailure " + t.getMessage());
responseListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
}
});
}

View file

@ -1,6 +1,6 @@
package com.tangem.data.network;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;
import com.tangem.App;
@ -38,19 +38,19 @@ public class ServerApiRootstock {
return requestsCount <= 0;
}
private RootstockBodyListener rootstockBodyListener;
private ResponseListener responseListener;
public interface RootstockBodyListener {
public interface ResponseListener {
void onSuccess(String method, InfuraResponse infuraResponse);
void onFail(String method, String message);
}
public void setRootstockResponse(RootstockBodyListener listener) {
rootstockBodyListener = listener;
public void setResponseListener(ResponseListener listener) {
responseListener = listener;
}
public void rootstock(String method, int id, String wallet, String contract, String tx) {
public void requestData(String method, int id, String wallet, String contract, String tx) {
requestsCount++;
RootstockApi rootstockApi = App.getNetworkComponent().getRetrofitRootstock().create(RootstockApi.class);
@ -86,18 +86,18 @@ public class ServerApiRootstock {
public void onResponse(@NonNull Call<InfuraResponse> call, @NonNull Response<InfuraResponse> response) {
if (response.code() == 200) {
requestsCount--;
rootstockBodyListener.onSuccess(method, response.body());
Log.i(TAG, "rootstock " + method + " onResponse " + response.code());
responseListener.onSuccess(method, response.body());
Log.i(TAG, "requestData " + method + " onResponse " + response.code());
} else {
rootstockBodyListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "rootstock " + method + " onResponse " + response.code());
responseListener.onFail(method, String.valueOf(response.code()));
Log.e(TAG, "requestData " + method + " onResponse " + response.code());
}
}
@Override
public void onFailure(@NonNull Call<InfuraResponse> call, @NonNull Throwable t) {
rootstockBodyListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "rootstock " + method + " onFailure " + t.getMessage());
responseListener.onFail(method, String.valueOf(t.getMessage()));
Log.e(TAG, "requestData " + method + " onFailure " + t.getMessage());
}
});
}

View file

@ -3,7 +3,7 @@ package com.tangem.data.network;
class ServerURL {
static final String API_TANGEM = "https://verify.tangem.com/";
static final String API_COINMARKETCAP = "https://api.coinmarketcap.com/";
static final String API_INFURA = "https://mainnet.infura.io/";
static final String API_INFURA = "https://mainnet.requestData.io/";
static final String API_ESTIMATEFEE = "https://estimatefee.com/";
static final String API_UPDATE_VERSION = "https://raw.githubusercontent.com/";
static final String API_ROOTSTOCK = "https://public-node.rsk.co/";

View file

@ -68,8 +68,8 @@ class Navigator {
context.startActivityForResult(PurgeActivity.callingIntent(context, ctx), Constant.REQUEST_CODE_PURGE)
}
fun showPreparePayment(context: Activity, ctx: TangemContext) {
context.startActivityForResult(PreparePaymentActivity.callingIntent(context, ctx), Constant.REQUEST_CODE_SEND_PAYMENT)
fun showPrepareTransaction(context: Activity, ctx: TangemContext) {
context.startActivityForResult(PrepareTransactionActivity.callingIntent(context, ctx), Constant.REQUEST_CODE_SEND_TRANSACTION)
}
fun showCreateNewWallet(context: Activity, ctx: TangemContext) {

View file

@ -6,7 +6,7 @@ import com.tangem.presentation.activity.LogoActivity;
import com.tangem.presentation.activity.MainActivity;
import com.tangem.presentation.activity.PrepareCryptonitOtherApiWithdrawalActivity;
import com.tangem.presentation.activity.PrepareKrakenWithdrawalActivity;
import com.tangem.presentation.activity.PreparePaymentActivity;
import com.tangem.presentation.activity.PrepareTransactionActivity;
import com.tangem.presentation.activity.VerifyCardActivity;
import javax.inject.Singleton;
@ -23,7 +23,7 @@ public interface NavigatorComponent {
void inject(MainActivity activity);
void inject(PreparePaymentActivity activity);
void inject(PrepareTransactionActivity activity);
void inject(PrepareCryptonitOtherApiWithdrawalActivity activity);

View file

@ -29,9 +29,6 @@ public interface NetworkComponent {
@Named(Server.ApiRootstock.URL_ROOTSTOCK)
Retrofit getRetrofitRootstock();
// @Named("Insight") //TODO:check
// Retrofit getRetrofitInsight(String insightURL);
@Named("socket")
Socket getSocket();

View file

@ -41,16 +41,6 @@ class NetworkModule {
.build();
}
// //@Singleton // TODO:check
// @Provides
// @Named("Insight")
// Retrofit provideRetrofitInsight(String insightURL) {
// return new Retrofit.Builder()
// .baseUrl(insightURL)
// .addConverterFactory(GsonConverterFactory.create())
// .build();
// }
@Singleton
@Provides
@Named(Server.ApiEstimatefee.URL_ESTIMATEFEE)

View file

@ -181,12 +181,10 @@ public abstract class CoinEngine {
public abstract boolean isBalanceNotZero();
// public abstract byte[] sign(Amount feeValue, Amount amountValue, boolean IncFee, String targetAddress, CardProtocol protocol) throws Exception;
// TODO - change isExtractPossible to isExtractPossible and if not - return string message
// TODO - return string message
public abstract boolean isExtractPossible();
public abstract Uri getShareWalletUriExplorer();
public abstract Uri getWalletExplorerUri();
public abstract Uri getShareWalletUri();
@ -245,14 +243,14 @@ public abstract class CoinEngine {
}
/**
* Create instance of {@link SignTask.PaymentToSign} used for transaction signing and sending
* Create instance of {@link SignTask.TransactionToSign} used for transaction signing and sending
*
* Transaction processing sequence:
* 1. User enter transaction attributes
* 2. Application create instance of {@link SignTask.PaymentToSign} by call {@see constructPayment}
* 3. Application set notification when transaction were prepared {@see setOnNeedSendPayment} and start {@link SignTask}
* 2. Application create instance of {@link SignTask.TransactionToSign} by call {@see constructTransaction}
* 3. Application set notification when transaction were prepared {@see setOnNeedSendTransaction} and start {@link SignTask}
* 4. User tap card and card sign transaction
* 5. Application receive {@link CoinEngine.OnNeedSendPayment} notification with prepared raw transaction
* 5. Application receive {@link OnNeedSendTransaction} notification with prepared raw transaction
* 6. Application show user information that transaction ready for sending and start sending procedure by call {@see requestSendTransaction}
* 7. Application receive notification of sending result through {@link CoinEngine.BlockchainRequestsCallbacks} and show result to user
*
@ -260,32 +258,32 @@ public abstract class CoinEngine {
* @param feeValue - fee amount of desired transaction
* @param IncFee - true if fee amount is included in amountValue (amountValue is total amount of transaction)
* @param targetAddress - target address of transaction
* @return instance of {@link SignTask.PaymentToSign}
* @return instance of {@link SignTask.TransactionToSign}
* @throws Exception if something goes wrong
*/
public abstract SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception;
public abstract SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception;
/**
* Interface used to notify main application when new transaction is prepared to send
*/
public interface OnNeedSendPayment {
void onPaymentPrepared(byte[] txForSend);
public interface OnNeedSendTransaction {
void onTransactionPrepared(byte[] txForSend);
}
protected OnNeedSendPayment onNeedSendPayment;
protected OnNeedSendTransaction onNeedSendTransaction;
/**
* Set notification callback when new transaction is prepared to send
*/
public void setOnNeedSendPayment(OnNeedSendPayment onNeedSendPayment) {
this.onNeedSendPayment = onNeedSendPayment;
public void setOnNeedSendTransaction(OnNeedSendTransaction onNeedSendTransaction) {
this.onNeedSendTransaction = onNeedSendTransaction;
}
protected void notifyOnNeedSendPayment(byte[] txForSend) throws Exception {
if (onNeedSendPayment == null)
throw new Exception("Payment signed but no callback defined to send!");
onNeedSendPayment.onPaymentPrepared(txForSend);
protected void notifyOnNeedSendTransaction(byte[] txForSend) throws Exception {
if (onNeedSendTransaction == null)
throw new Exception("Transaction was signed but no callback defined to send!");
onNeedSendTransaction.onTransactionPrepared(txForSend);
}
/**

View file

@ -185,7 +185,7 @@ public class BtcCashEngine extends CoinEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri() {
return Uri.parse("https://bch.btc.com/" + ctx.getCoinData().getWallet());
}
@ -454,7 +454,7 @@ public class BtcCashEngine extends CoinEngine {
@Override
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
public SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
checkBlockchainDataExists();
String srcLegacyAddress = convertToLegacyAddress(ctx.getCoinData().getWallet());
@ -500,7 +500,7 @@ public class BtcCashEngine extends CoinEngine {
bodyDoubleHash[i] = Util.calculateSHA256(bodyHash[i]);
}
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
@ -551,7 +551,7 @@ public class BtcCashEngine extends CoinEngine {
byte[] txForSend = BCHUtils.buildTXForSend(destLegacyAddress, srcLegacyAddress, unspentOutputs, amountFinal, changeFinal);
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
};
@ -561,7 +561,7 @@ public class BtcCashEngine extends CoinEngine {
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) throws Exception {
final ServerApiElectrum serverApiElectrum = new ServerApiElectrum();
ServerApiElectrum.ElectrumRequestDataListener electrumBodyListener = new ServerApiElectrum.ElectrumRequestDataListener() {
ServerApiElectrum.ResponseListener electrumBodyListener = new ServerApiElectrum.ResponseListener() {
@Override
public void onSuccess(ElectrumRequest electrumRequest) {
if (electrumRequest.isMethod(ElectrumRequest.METHOD_GetBalance)) {
@ -606,7 +606,7 @@ public class BtcCashEngine extends CoinEngine {
String hash = jsUnspent.getString("tx_hash");
if (height != -1) {
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getTransaction(walletAddress, hash));
serverApiElectrum.requestData(ctx, ElectrumRequest.getTransaction(walletAddress, hash));
} else {
ctx.setError("Terminated by user");
}
@ -649,22 +649,22 @@ public class BtcCashEngine extends CoinEngine {
}
};
serverApiElectrum.setElectrumRequestData(electrumBodyListener);
serverApiElectrum.setResponseListener(electrumBodyListener);
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.checkBalance(convertToLegacyAddress(coinData.getWallet())));
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.listUnspent(convertToLegacyAddress(coinData.getWallet())));
serverApiElectrum.requestData(ctx, ElectrumRequest.checkBalance(convertToLegacyAddress(coinData.getWallet())));
serverApiElectrum.requestData(ctx, ElectrumRequest.listUnspent(convertToLegacyAddress(coinData.getWallet())));
}
private Integer calculateEstimatedTransactionSize(String outputAddress, String outAmount) {
try {
SignTask.PaymentToSign ps=constructPayment(new Amount(outAmount, getBalanceCurrency()),new Amount("0.00",getFeeCurrency()), true, outputAddress );
OnNeedSendPayment onNeedSendPaymentBackup=onNeedSendPayment;
onNeedSendPayment=(tx)->{}; // empty function to bypass exception
SignTask.TransactionToSign ps= constructTransaction(new Amount(outAmount, getBalanceCurrency()),new Amount("0.00",getFeeCurrency()), true, outputAddress );
OnNeedSendTransaction onNeedSendTransactionBackup = onNeedSendTransaction;
onNeedSendTransaction =(tx)->{}; // empty function to bypass exception
byte[][] hashesToSign=ps.getHashesToSign();
byte[] signFromCard = new byte[64 * hashesToSign.length];
byte[] txForSend=ps.onSignCompleted(signFromCard);
onNeedSendPayment=onNeedSendPaymentBackup;
onNeedSendTransaction = onNeedSendTransactionBackup;
Log.e(TAG,"txForSend.length="+String.valueOf(txForSend.length));
return txForSend.length;
} catch (Exception e) {
@ -686,7 +686,7 @@ public class BtcCashEngine extends CoinEngine {
final ServerApiElectrum serverApiElectrum = new ServerApiElectrum();
final ServerApiElectrum.ElectrumRequestDataListener electrumListener = new ServerApiElectrum.ElectrumRequestDataListener () {
final ServerApiElectrum.ResponseListener electrumListener = new ServerApiElectrum.ResponseListener() {
@Override
public void onSuccess(ElectrumRequest electrumRequest) {
BigDecimal fee;
@ -695,13 +695,13 @@ public class BtcCashEngine extends CoinEngine {
fee = new BigDecimal(electrumRequest.getResultString()); //fee per KB
if (fee.equals(BigDecimal.ZERO)) {
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getFee());
serverApiElectrum.requestData(ctx, ElectrumRequest.getFee());
}
// if (calcSize != 0) {
fee = fee.multiply(new BigDecimal(calcSize)).divide(new BigDecimal(1024)); // (per KB -> per byte)*size
// } else {
// serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getFee());
// serverApiElectrum.requestData(ctx, ElectrumRequest.getFee());
// }
//compare fee to usual relay fee
@ -732,9 +732,9 @@ public class BtcCashEngine extends CoinEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiElectrum.setElectrumRequestData(electrumListener);
serverApiElectrum.setResponseListener(electrumListener);
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getFee());
serverApiElectrum.requestData(ctx, ElectrumRequest.getFee());
}
@Override
@ -742,7 +742,7 @@ public class BtcCashEngine extends CoinEngine {
final ServerApiElectrum serverApiElectrum = new ServerApiElectrum();
final String txStr = BTCUtils.toHex(txForSend);
ServerApiElectrum.ElectrumRequestDataListener electrumBodyListener = new ServerApiElectrum.ElectrumRequestDataListener() {
ServerApiElectrum.ResponseListener electrumBodyListener = new ServerApiElectrum.ResponseListener() {
@Override
public void onSuccess(ElectrumRequest electrumRequest) {
if (electrumRequest.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
@ -773,10 +773,10 @@ public class BtcCashEngine extends CoinEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiElectrum.setElectrumRequestData(electrumBodyListener);
serverApiElectrum.setResponseListener(electrumBodyListener);
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.broadcast(ctx.getCoinData().getWallet(), txStr));
serverApiElectrum.requestData(ctx, ElectrumRequest.broadcast(ctx.getCoinData().getWallet(), txStr));
}

View file

@ -189,7 +189,7 @@ public class BtcEngine extends CoinEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri() {
return Uri.parse((ctx.getBlockchain() == Blockchain.Bitcoin ? "https://blockchain.info/address/" : "https://testnet.blockchain.info/address/") + ctx.getCoinData().getWallet());
}
@ -422,7 +422,7 @@ public class BtcEngine extends CoinEngine {
}
@Override
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
public SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
final ArrayList<UnspentOutputInfo> unspentOutputs;
checkBlockchainDataExists();
@ -467,7 +467,7 @@ public class BtcEngine extends CoinEngine {
bodyDoubleHash[i] = Util.calculateSHA256(bodyHash[i]);
}
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
@ -517,7 +517,7 @@ public class BtcEngine extends CoinEngine {
}
byte[] txForSend = BTCUtils.buildTXForSend(targetAddress, myAddress, unspentOutputs, amountFinal, changeFinal);
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
};
@ -527,7 +527,7 @@ public class BtcEngine extends CoinEngine {
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) {
final ServerApiElectrum serverApiElectrum = new ServerApiElectrum();
ServerApiElectrum.ElectrumRequestDataListener electrumListener = new ServerApiElectrum.ElectrumRequestDataListener() {
ServerApiElectrum.ResponseListener electrumListener = new ServerApiElectrum.ResponseListener() {
@Override
public void onSuccess(ElectrumRequest electrumRequest) {
Log.i(TAG, "onSuccess: "+electrumRequest.getMethod());
@ -576,7 +576,7 @@ public class BtcEngine extends CoinEngine {
String hash = jsUnspent.getString("tx_hash");
if (height != -1) {
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getTransaction(walletAddress, hash));
serverApiElectrum.requestData(ctx, ElectrumRequest.getTransaction(walletAddress, hash));
} else {
ctx.setError("Terminated by user");
}
@ -617,14 +617,14 @@ public class BtcEngine extends CoinEngine {
}
};
serverApiElectrum.setElectrumRequestData(electrumListener);
serverApiElectrum.setResponseListener(electrumListener);
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.checkBalance(coinData.getWallet()));
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.listUnspent(coinData.getWallet()));
serverApiElectrum.requestData(ctx, ElectrumRequest.checkBalance(coinData.getWallet()));
serverApiElectrum.requestData(ctx, ElectrumRequest.listUnspent(coinData.getWallet()));
}
protected Integer calculateEstimatedTransactionSize(String outputAddress, String outAmount) {
//todo - правильней было бы использовать constructPayment
//todo - правильней было бы использовать constructTransaction
try {
// String myAddress = coinData.getWallet();
// byte[] pbKey = ctx.getCard().getWalletPublicKey();
@ -685,14 +685,14 @@ public class BtcEngine extends CoinEngine {
//
// byte[] realTX = BTCUtils.buildTXForSend(outputAddress, myAddress, unspentOutputs, amount, change);
SignTask.PaymentToSign ps=constructPayment(new Amount(outAmount, getBalanceCurrency()),new Amount("0.00",getFeeCurrency()), true, outputAddress );
OnNeedSendPayment onNeedSendPaymentBackup=onNeedSendPayment;
onNeedSendPayment=(tx)->{}; // empty function to bypass exception
SignTask.TransactionToSign ps= constructTransaction(new Amount(outAmount, getBalanceCurrency()),new Amount("0.00",getFeeCurrency()), true, outputAddress );
OnNeedSendTransaction onNeedSendTransactionBackup = onNeedSendTransaction;
onNeedSendTransaction =(tx)->{}; // empty function to bypass exception
byte[][] hashesToSign=ps.getHashesToSign();
byte[] signFromCard = new byte[64 * hashesToSign.length];
byte[] txForSend=ps.onSignCompleted(signFromCard);
onNeedSendPayment=onNeedSendPaymentBackup;
onNeedSendTransaction = onNeedSendTransactionBackup;
Log.e(TAG,"txForSend.length="+String.valueOf(txForSend.length));
return txForSend.length;
@ -717,14 +717,14 @@ public class BtcEngine extends CoinEngine {
final ServerApiCommon serverApiCommon = new ServerApiCommon();
final ServerApiCommon.EstimateFeeListener estimateFeeListener = new ServerApiCommon.EstimateFeeListener() {
final ServerApiCommon.EstimatedFeeListener estimatedFeeListener = new ServerApiCommon.EstimatedFeeListener() {
@Override
public void onSuccess(int blockCount, String estimateFeeResponse) {
BigDecimal fee = new BigDecimal(estimateFeeResponse); // BTC per 1 kb
if (fee.equals(BigDecimal.ZERO)) {
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiCommon.estimateFee(blockCount);
serverApiCommon.requestBtcEstimatedFee(blockCount);
}
return;
}
@ -733,7 +733,7 @@ public class BtcEngine extends CoinEngine {
fee = fee.multiply(new BigDecimal(calcSize)).divide(new BigDecimal(1024), BigDecimal.ROUND_DOWN); // per Kb -> per byte
} else {
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiCommon.estimateFee(blockCount);
serverApiCommon.requestBtcEstimatedFee(blockCount);
}
return;
}
@ -763,18 +763,18 @@ public class BtcEngine extends CoinEngine {
public void onFail(int blockCount, String message) {
// TODO - add fail counter to terminate after NNN tries
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiCommon.estimateFee(blockCount);
serverApiCommon.requestBtcEstimatedFee(blockCount);
return;
}
ctx.setError(ctx.getContext().getString(R.string.cannot_calculate_fee_wrong_data_received_from_node));
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiCommon.setEstimateFee(estimateFeeListener);
serverApiCommon.setBtcEstimatedFeeListener(estimatedFeeListener);
serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_PRIORITY);
serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_NORMAL);
serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_MINIMAL);
serverApiCommon.requestBtcEstimatedFee(ServerApiCommon.ESTIMATE_FEE_PRIORITY);
serverApiCommon.requestBtcEstimatedFee(ServerApiCommon.ESTIMATE_FEE_NORMAL);
serverApiCommon.requestBtcEstimatedFee(ServerApiCommon.ESTIMATE_FEE_MINIMAL);
}
@ -783,7 +783,7 @@ public class BtcEngine extends CoinEngine {
final ServerApiElectrum serverApiElectrum = new ServerApiElectrum();
final String txStr = BTCUtils.toHex(txForSend);
ServerApiElectrum.ElectrumRequestDataListener electrumListener = new ServerApiElectrum.ElectrumRequestDataListener() {
ServerApiElectrum.ResponseListener electrumListener = new ServerApiElectrum.ResponseListener() {
@Override
public void onSuccess(ElectrumRequest electrumRequest) {
if (electrumRequest.isMethod(ElectrumRequest.METHOD_SendTransaction)) {
@ -814,10 +814,10 @@ public class BtcEngine extends CoinEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiElectrum.setElectrumRequestData(electrumListener);
serverApiElectrum.setResponseListener(electrumListener);
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.broadcast(ctx.getCoinData().getWallet(), txStr));
serverApiElectrum.requestData(ctx, ElectrumRequest.broadcast(ctx.getCoinData().getWallet(), txStr));
}

View file

@ -4,8 +4,6 @@ import android.net.Uri;
import android.text.InputFilter;
import android.util.Log;
import com.tangem.data.network.ElectrumRequest;
import com.tangem.data.network.InsightApi;
import com.tangem.data.network.ServerApiInsight;
import com.tangem.data.network.model.InsightResponse;
import com.tangem.domain.wallet.BTCUtils;
@ -26,10 +24,6 @@ import com.tangem.util.DecimalDigitsInputFilter;
import com.tangem.util.DerEncodingUtil;
import com.tangem.wallet.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
@ -179,7 +173,7 @@ public class DucatusEngine extends BtcEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri() {
return Uri.parse("https://live.blockcypher.com/ltc/address/" + ctx.getCoinData().getWallet());
}
@ -397,7 +391,7 @@ public class DucatusEngine extends BtcEngine {
}
@Override
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
public SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
final ArrayList<UnspentOutputInfo> unspentOutputs;
checkBlockchainDataExists();
@ -442,7 +436,7 @@ public class DucatusEngine extends BtcEngine {
bodyDoubleHash[i] = Util.calculateSHA256(bodyHash[i]);
}
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
@ -492,7 +486,7 @@ public class DucatusEngine extends BtcEngine {
}
byte[] txForSend=BTCUtils.buildTXForSend(targetAddress, myAddress, unspentOutputs, amountFinal, changeFinal);
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
};
@ -502,7 +496,7 @@ public class DucatusEngine extends BtcEngine {
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) {
final ServerApiInsight serverApiInsight = new ServerApiInsight();
ServerApiInsight.InsightBodyListener insightBodyListener = new ServerApiInsight.InsightBodyListener() {
ServerApiInsight.ResponseListener responseListener = new ServerApiInsight.ResponseListener() {
@Override
public void onSuccess(String method, InsightResponse insightResponse) {
switch (method) {
@ -562,7 +556,7 @@ public class DucatusEngine extends BtcEngine {
for (InsightResponse utxo : utxoList) {
//if (height != -1) { TODO: check
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiInsight.insight(ServerApiInsight.INSIGHT_TRANSACTION, "", utxo.getTxid());
serverApiInsight.requestData(ServerApiInsight.INSIGHT_TRANSACTION, "", utxo.getTxid());
} else {
ctx.setError("Terminated by user");
}
@ -582,10 +576,10 @@ public class DucatusEngine extends BtcEngine {
}
};
serverApiInsight.setInsightResponse(insightBodyListener);
serverApiInsight.setResponseListener(responseListener);
serverApiInsight.insight(ServerApiInsight.INSIGHT_ADDRESS, coinData.getWallet(), "");
serverApiInsight.insight(ServerApiInsight.INSIGHT_UNSPENT_OUTPUTS, coinData.getWallet(), "");
serverApiInsight.requestData(ServerApiInsight.INSIGHT_ADDRESS, coinData.getWallet(), "");
serverApiInsight.requestData(ServerApiInsight.INSIGHT_UNSPENT_OUTPUTS, coinData.getWallet(), "");
}
// private final static BigDecimal relayFee = new BigDecimal(0.00001);
@ -600,7 +594,7 @@ public class DucatusEngine extends BtcEngine {
final ServerApiInsight serverApiInsight = new ServerApiInsight();
final ServerApiInsight.InsightBodyListener insightBodyListener = new ServerApiInsight.InsightBodyListener () {
final ServerApiInsight.ResponseListener responseListener = new ServerApiInsight.ResponseListener() {
@Override
public void onSuccess(String method, InsightResponse insightResponse) {
if ( method.equals(ServerApiInsight.INSIGHT_FEE)) {
@ -610,7 +604,7 @@ public class DucatusEngine extends BtcEngine {
BigDecimal maxFee = new BigDecimal(insightResponse.getFee6());
if (minFee.equals(BigDecimal.ZERO) || normalFee.equals(BigDecimal.ZERO) || maxFee.equals(BigDecimal.ZERO)) {
serverApiInsight.insight(ServerApiInsight.INSIGHT_FEE, "","");
serverApiInsight.requestData(ServerApiInsight.INSIGHT_FEE, "","");
}
minFee = minFee.multiply(new BigDecimal(calcSize)).divide(new BigDecimal(1024)); // (per KB -> per byte)*size
@ -650,9 +644,9 @@ public class DucatusEngine extends BtcEngine {
}
}
};
serverApiInsight.setInsightResponse(insightBodyListener);
serverApiInsight.setResponseListener(responseListener);
serverApiInsight.insight(ServerApiInsight.INSIGHT_FEE, "", "");
serverApiInsight.requestData(ServerApiInsight.INSIGHT_FEE, "", "");
}
@Override
@ -660,7 +654,7 @@ public class DucatusEngine extends BtcEngine {
final ServerApiInsight serverApiInsight = new ServerApiInsight();
final String txStr = BTCUtils.toHex(txForSend);
final ServerApiInsight.InsightBodyListener insightBodyListener = new ServerApiInsight.InsightBodyListener () {
final ServerApiInsight.ResponseListener responseListener = new ServerApiInsight.ResponseListener() {
@Override
public void onSuccess(String method, InsightResponse insightResponse) {
if (method.equals(ServerApiInsight.INSIGHT_SEND)) {
@ -700,8 +694,8 @@ public class DucatusEngine extends BtcEngine {
}
}
};
serverApiInsight.setInsightResponse(insightBodyListener);
serverApiInsight.setResponseListener(responseListener);
serverApiInsight.insight(ServerApiInsight.INSIGHT_SEND, "", txStr);
serverApiInsight.requestData(ServerApiInsight.INSIGHT_SEND, "", txStr);
}
}

View file

@ -236,7 +236,7 @@ public class EthEngine extends CoinEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri() {
if (ctx.getBlockchain() == Blockchain.EthereumTestNet)
return Uri.parse("https://rinkeby.etherscan.io/address/" + ctx.getCoinData().getWallet());
else
@ -379,9 +379,9 @@ public class EthEngine extends CoinEngine {
}
@Override
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) {
public SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) {
Log.e(TAG, "Construct payment " + amountValue.toString() + " with fee " + feeValue.toString() + (IncFee ? " including" : " excluding"));
Log.e(TAG, "Construct transaction " + amountValue.toString() + " with fee " + feeValue.toString() + (IncFee ? " including" : " excluding"));
BigInteger nonceValue = coinData.getConfirmedTXCount();
byte[] pbKey = ctx.getCard().getWalletPublicKey();
@ -405,7 +405,7 @@ public class EthEngine extends CoinEngine {
final EthTransaction tx = EthTransaction.create(to, weiAmount, nonceValue, gasPrice, gasLimit, chainId);
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
return signingMethod == TangemCard.SigningMethod.Sign_Hash;
@ -456,7 +456,7 @@ public class EthEngine extends CoinEngine {
Log.e(this.getClass().getSimpleName(), " V: " +String.valueOf(v));
byte[] txForSend = tx.getEncoded();
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
};
@ -465,8 +465,8 @@ public class EthEngine extends CoinEngine {
@Override
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) {
final ServerApiInfura serverApiInfura = new ServerApiInfura();
// request infura listener
ServerApiInfura.InfuraBodyListener infuraBodyListener = new ServerApiInfura.InfuraBodyListener() {
// request requestData listener
ServerApiInfura.ResponseListener responseListener = new ServerApiInfura.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
switch (method) {
@ -518,18 +518,18 @@ public class EthEngine extends CoinEngine {
}
}
};
serverApiInfura.setInfuraResponse(infuraBodyListener);
serverApiInfura.setResponseListener(responseListener);
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
}
@Override
public void requestFee(BlockchainRequestsCallbacks blockchainRequestsCallbacks, String targetAddress, Amount amount) {
ServerApiInfura serverApiInfura = new ServerApiInfura();
// request infura eth gasPrice listener
ServerApiInfura.InfuraBodyListener infuraBodyListener = new ServerApiInfura.InfuraBodyListener() {
// request requestData eth gasPrice listener
ServerApiInfura.ResponseListener responseListener = new ServerApiInfura.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
String gasPrice = infuraResponse.getResult();
@ -567,9 +567,9 @@ public class EthEngine extends CoinEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiInfura.setInfuraResponse(infuraBodyListener);
serverApiInfura.setResponseListener(responseListener);
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
}
@Override
@ -578,8 +578,8 @@ public class EthEngine extends CoinEngine {
String txStr = String.format("0x%s", BTCUtils.toHex(txForSend));
ServerApiInfura serverApiInfura = new ServerApiInfura();
// request infura eth gasPrice listener
ServerApiInfura.InfuraBodyListener infuraBodyListener = new ServerApiInfura.InfuraBodyListener() {
// request requestData eth gasPrice listener
ServerApiInfura.ResponseListener responseListener = new ServerApiInfura.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
if (method.equals(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION)) {
@ -605,9 +605,9 @@ public class EthEngine extends CoinEngine {
}
};
serverApiInfura.setInfuraResponse(infuraBodyListener);
serverApiInfura.setResponseListener(responseListener);
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
}
}

View file

@ -176,7 +176,7 @@ public class LtcEngine extends BtcEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri() {
return Uri.parse("https://live.blockcypher.com/ltc/address/" + ctx.getCoinData().getWallet());
}
@ -394,7 +394,7 @@ public class LtcEngine extends BtcEngine {
}
@Override
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
public SignTask.TransactionToSign constructTransaction(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
final ArrayList<UnspentOutputInfo> unspentOutputs;
checkBlockchainDataExists();
@ -439,7 +439,7 @@ public class LtcEngine extends BtcEngine {
bodyDoubleHash[i] = Util.calculateSHA256(bodyHash[i]);
}
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
@ -489,7 +489,7 @@ public class LtcEngine extends BtcEngine {
}
byte[] txForSend=BTCUtils.buildTXForSend(targetAddress, myAddress, unspentOutputs, amountFinal, changeFinal);
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
};
@ -507,7 +507,7 @@ public class LtcEngine extends BtcEngine {
final ServerApiElectrum serverApiElectrum = new ServerApiElectrum();
final ServerApiElectrum.ElectrumRequestDataListener electrumListener = new ServerApiElectrum.ElectrumRequestDataListener () {
final ServerApiElectrum.ResponseListener electrumListener = new ServerApiElectrum.ResponseListener() {
@Override
public void onSuccess(ElectrumRequest electrumRequest) {
BigDecimal fee;
@ -516,13 +516,13 @@ public class LtcEngine extends BtcEngine {
fee = new BigDecimal(electrumRequest.getResultString()); //fee per KB
if (fee.equals(BigDecimal.ZERO)) {
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getFee());
serverApiElectrum.requestData(ctx, ElectrumRequest.getFee());
}
// if (calcSize != 0) {
fee = fee.multiply(new BigDecimal(calcSize)).divide(new BigDecimal(1024)); // (per KB -> per byte)*size
// } else {
// serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getFee());
// serverApiElectrum.requestData(ctx, ElectrumRequest.getFee());
// }
//compare fee to usual relay fee
@ -553,8 +553,8 @@ public class LtcEngine extends BtcEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiElectrum.setElectrumRequestData(electrumListener);
serverApiElectrum.setResponseListener(electrumListener);
serverApiElectrum.electrumRequestData(ctx, ElectrumRequest.getFee());
serverApiElectrum.requestData(ctx, ElectrumRequest.getFee());
}
}

View file

@ -60,15 +60,15 @@ public class RskEngine extends EthEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri()) {
return Uri.parse("https://explorer.rsk.co/address/" + ctx.getCoinData().getWallet());
}
@Override
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) {
final ServerApiRootstock serverApiRootstock = new ServerApiRootstock();
// request rootstock listener
ServerApiRootstock.RootstockBodyListener rootstockBodyListener = new ServerApiRootstock.RootstockBodyListener() {
// request requestData listener
ServerApiRootstock.ResponseListener responseListener = new ServerApiRootstock.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse rootstockResponse) {
switch (method) {
@ -120,18 +120,18 @@ public class RskEngine extends EthEngine {
}
}
};
serverApiRootstock.setRootstockResponse(rootstockBodyListener);
serverApiRootstock.setResponseListener(responseListener);
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
}
@Override
public void requestFee(BlockchainRequestsCallbacks blockchainRequestsCallbacks, String targetAddress, Amount amount) {
ServerApiRootstock serverApiRootstock = new ServerApiRootstock();
// request rootstock gasPrice listener
ServerApiRootstock.RootstockBodyListener rootstockBodyListener = new ServerApiRootstock.RootstockBodyListener() {
// request requestData gasPrice listener
ServerApiRootstock.ResponseListener responseListener = new ServerApiRootstock.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse rootstockResponse) {
String gasPrice = rootstockResponse.getResult();
@ -169,9 +169,9 @@ public class RskEngine extends EthEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiRootstock.setRootstockResponse(rootstockBodyListener);
serverApiRootstock.setResponseListener(responseListener);
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
}
@Override
@ -180,7 +180,7 @@ public class RskEngine extends EthEngine {
String txStr = String.format("0x%s", BTCUtils.toHex(txForSend));
ServerApiRootstock serverApiRootstock = new ServerApiRootstock();
ServerApiRootstock.RootstockBodyListener rootstockBodyListener = new ServerApiRootstock.RootstockBodyListener() {
ServerApiRootstock.ResponseListener responseListener = new ServerApiRootstock.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse rootstockResponse) {
if (method.equals(ServerApiRootstock.ROOTSTOCK_ETH_SEND_RAW_TRANSACTION)) {
@ -206,9 +206,9 @@ public class RskEngine extends EthEngine {
}
};
serverApiRootstock.setRootstockResponse(rootstockBodyListener);
serverApiRootstock.setResponseListener(responseListener);
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
}

View file

@ -48,9 +48,7 @@ public class RskTokenEngine extends TokenEngine {
}
@Override
public Uri getShareWalletUriExplorer() {
return Uri.parse("https://explorer.rsk.co/address/" + ctx.getCoinData().getWallet());
} // Only RSK explorer for now
public Uri getWalletExplorerUri() { return Uri.parse("https://explorer.rsk.co/address/" + ctx.getCoinData().getWallet()); } // Only RSK explorer for now
@Override
public Uri getShareWalletUri() {
@ -76,8 +74,8 @@ public class RskTokenEngine extends TokenEngine {
@Override
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) {
final ServerApiRootstock serverApiRootstock = new ServerApiRootstock();
// request rootstock listener
ServerApiRootstock.RootstockBodyListener rootstockBodyListener = new ServerApiRootstock.RootstockBodyListener() {
// request requestData listener
ServerApiRootstock.ResponseListener responseListener = new ServerApiRootstock.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse rootstockResponse) {
switch (method) {
@ -123,9 +121,9 @@ public class RskTokenEngine extends TokenEngine {
// Log.i("$TAG eth_call", balanceCap)
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
} else {
ctx.setError("Terminated by user");
}
@ -152,16 +150,16 @@ public class RskTokenEngine extends TokenEngine {
}
}
};
serverApiRootstock.setRootstockResponse(rootstockBodyListener);
serverApiRootstock.setResponseListener(responseListener);
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_CALL, 67, coinData.getWallet(), getContractAddress(ctx.getCard()), "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_CALL, 67, coinData.getWallet(), getContractAddress(ctx.getCard()), "");
}
@Override
public void requestFee(BlockchainRequestsCallbacks blockchainRequestsCallbacks, String targetAddress, Amount amount) {
ServerApiRootstock serverApiRootstock = new ServerApiRootstock();
// request rootstock gasPrice listener
ServerApiRootstock.RootstockBodyListener rootstockBodyListener = new ServerApiRootstock.RootstockBodyListener() {
// request requestData gasPrice listener
ServerApiRootstock.ResponseListener responseListener = new ServerApiRootstock.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse rootstockResponse) {
String gasPrice = rootstockResponse.getResult();
@ -204,9 +202,9 @@ public class RskTokenEngine extends TokenEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiRootstock.setRootstockResponse(rootstockBodyListener);
serverApiRootstock.setResponseListener(responseListener);
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
}
@Override
@ -215,8 +213,8 @@ public class RskTokenEngine extends TokenEngine {
String txStr = String.format("0x%s", BTCUtils.toHex(txForSend));
ServerApiRootstock serverApiRootstock = new ServerApiRootstock();
// request rootstock listener
ServerApiRootstock.RootstockBodyListener rootstockBodyListener = new ServerApiRootstock.RootstockBodyListener() {
// request requestData listener
ServerApiRootstock.ResponseListener responseListener = new ServerApiRootstock.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
if (method.equals(ServerApiRootstock.ROOTSTOCK_ETH_SEND_RAW_TRANSACTION)) {
@ -242,9 +240,9 @@ public class RskTokenEngine extends TokenEngine {
}
};
serverApiRootstock.setRootstockResponse(rootstockBodyListener);
serverApiRootstock.setResponseListener(responseListener);
serverApiRootstock.rootstock(ServerApiRootstock.ROOTSTOCK_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
serverApiRootstock.requestData(ServerApiRootstock.ROOTSTOCK_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
}

View file

@ -297,7 +297,7 @@ public class TokenEngine extends CoinEngine {
@Override
public Uri getShareWalletUriExplorer() {
public Uri getWalletExplorerUri() {
return Uri.parse("https://etherscan.io/token/" + getContractAddress(ctx.getCard()) + "?a=" + ctx.getCoinData().getWallet());
}
@ -437,15 +437,15 @@ public class TokenEngine extends CoinEngine {
}
@Override
public SignTask.PaymentToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
public SignTask.TransactionToSign constructPayment(Amount amountValue, Amount feeValue, boolean IncFee, String targetAddress) throws Exception {
if (amountValue.getCurrency().equals(this.getBlockchain().getCurrency())) {
return constructPaymentCoin(feeValue, amountValue, IncFee, targetAddress);
return constructTransactionCoin(feeValue, amountValue, IncFee, targetAddress);
} else {
return constructPaymentToken(feeValue, amountValue, IncFee, targetAddress);
return constructTransactionToken(feeValue, amountValue, IncFee, targetAddress);
}
}
protected SignTask.PaymentToSign constructPaymentCoin(Amount feeValue, Amount amountValue, boolean IncFee, String targetAddress) throws Exception {
protected SignTask.TransactionToSign constructTransactionCoin(Amount feeValue, Amount amountValue, boolean IncFee, String targetAddress) throws Exception {
Log.e(TAG, "Construct " + this.getBlockchain().getCurrency() + " payment " + amountValue.toString() + " with fee " + feeValue.toString() + (IncFee ? " including" : " excluding"));
BigInteger nonceValue = coinData.getConfirmedTXCount();
@ -470,7 +470,7 @@ public class TokenEngine extends CoinEngine {
final EthTransaction tx = EthTransaction.create(to, weiAmount, nonceValue, gasPrice, gasLimit, chainId);
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
return signingMethod == TangemCard.SigningMethod.Sign_Hash;
@ -521,14 +521,14 @@ public class TokenEngine extends CoinEngine {
Log.e(TAG, this.getClass().getSimpleName() + " V: " + String.valueOf(v));
byte[] txForSend = tx.getEncoded();
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
};
}
protected SignTask.PaymentToSign constructPaymentToken(Amount feeValue, Amount amountValue, boolean IncFee, String targetAddress) throws Exception {
Log.e(TAG, "Construct TOKEN payment " + amountValue.toString() + " with fee " + feeValue.toString() + (IncFee ? " including" : " excluding"));
private SignTask.TransactionToSign constructTransactionToken(Amount feeValue, Amount amountValue, boolean IncFee, String targetAddress) throws Exception {
Log.e(TAG, "Construct TOKEN transaction "+amountValue.toString()+" with fee "+feeValue.toString()+(IncFee?" including":" excluding"));
BigInteger nonceValue = coinData.getConfirmedTXCount();
byte[] pbKey = ctx.getCard().getWalletPublicKey();
@ -578,7 +578,7 @@ public class TokenEngine extends CoinEngine {
byte[] data = BTCUtils.fromHex(cmd);
EthTransaction tx = EthTransaction.create(contractAddress, amountZero, nonceValue, gasPrice, gasLimit, chainId, data);
return new SignTask.PaymentToSign() {
return new SignTask.TransactionToSign() {
@Override
public boolean isSigningMethodSupported(TangemCard.SigningMethod signingMethod) {
return signingMethod == TangemCard.SigningMethod.Sign_Hash;
@ -629,7 +629,7 @@ public class TokenEngine extends CoinEngine {
Log.e(TAG, this.getClass().getSimpleName() + " V: " + String.valueOf(v));
byte[] txForSend = tx.getEncoded();
notifyOnNeedSendPayment(txForSend);
notifyOnNeedSendTransaction(txForSend);
return txForSend;
}
@ -640,8 +640,8 @@ public class TokenEngine extends CoinEngine {
@Override
public void requestBalanceAndUnspentTransactions(BlockchainRequestsCallbacks blockchainRequestsCallbacks) {
final ServerApiInfura serverApiInfura = new ServerApiInfura();
// request infura listener
ServerApiInfura.InfuraBodyListener infuraBodyListener = new ServerApiInfura.InfuraBodyListener() {
// request requestData listener
ServerApiInfura.ResponseListener responseListener = new ServerApiInfura.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
switch (method) {
@ -687,9 +687,9 @@ public class TokenEngine extends CoinEngine {
// Log.i("$TAG eth_call", balanceCap)
if (blockchainRequestsCallbacks.allowAdvance()) {
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_BALANCE, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_TRANSACTION_COUNT, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, 67, coinData.getWallet(), "", "");
} else {
ctx.setError("Terminated by user");
}
@ -716,16 +716,16 @@ public class TokenEngine extends CoinEngine {
}
}
};
serverApiInfura.setInfuraResponse(infuraBodyListener);
serverApiInfura.setResponseListener(responseListener);
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_CALL, 67, coinData.getWallet(), getContractAddress(ctx.getCard()), "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_CALL, 67, coinData.getWallet(), getContractAddress(ctx.getCard()), "");
}
@Override
public void requestFee(BlockchainRequestsCallbacks blockchainRequestsCallbacks, String targetAddress, Amount amount) {
ServerApiInfura serverApiInfura = new ServerApiInfura();
// request infura eth gasPrice listener
ServerApiInfura.InfuraBodyListener infuraBodyListener = new ServerApiInfura.InfuraBodyListener() {
// request requestData eth gasPrice listener
ServerApiInfura.ResponseListener responseListener = new ServerApiInfura.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
String gasPrice = infuraResponse.getResult();
@ -768,9 +768,9 @@ public class TokenEngine extends CoinEngine {
blockchainRequestsCallbacks.onComplete(false);
}
};
serverApiInfura.setInfuraResponse(infuraBodyListener);
serverApiInfura.setResponseListener(responseListener);
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GAS_PRICE, 67, coinData.getWallet(), "", "");
}
@Override
@ -779,8 +779,8 @@ public class TokenEngine extends CoinEngine {
String txStr = String.format("0x%s", BTCUtils.toHex(txForSend));
ServerApiInfura serverApiInfura = new ServerApiInfura();
// request infura eth gasPrice listener
ServerApiInfura.InfuraBodyListener infuraBodyListener = new ServerApiInfura.InfuraBodyListener() {
// request requestData eth gasPrice listener
ServerApiInfura.ResponseListener responseListener = new ServerApiInfura.ResponseListener() {
@Override
public void onSuccess(String method, InfuraResponse infuraResponse) {
if (method.equals(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION)) {
@ -806,9 +806,9 @@ public class TokenEngine extends CoinEngine {
}
};
serverApiInfura.setInfuraResponse(infuraBodyListener);
serverApiInfura.setResponseListener(responseListener);
serverApiInfura.infura(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_SEND_RAW_TRANSACTION, 67, coinData.getWallet(), "", txStr);
}

View file

@ -5,7 +5,7 @@ import android.content.Intent
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.text.Editable
import android.text.Html
import android.text.TextWatcher
@ -23,12 +23,12 @@ import com.tangem.tangemcard.data.TangemCard
import com.tangem.tangemcard.data.loadFromBundle
import com.tangem.util.UtilHelper
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_confirm_payment.*
import kotlinx.android.synthetic.main.activity_confirm_transaction.*
import org.greenrobot.eventbus.EventBus
import java.io.IOException
import java.util.*
class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
class ConfirmTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
private lateinit var nfcManager: NfcManager
private lateinit var ctx: TangemContext
@ -41,7 +41,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_confirm_payment)
setContentView(R.layout.activity_confirm_transaction)
nfcManager = NfcManager(this, this)
@ -71,11 +71,12 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
tvCurrency2.text = engine.feeCurrency
tvCardID.text = ctx.card!!.cidDescription
etWallet.setText(intent.getStringExtra(Constant.EXTRA_TARGET_ADDRESS))
etFee.setText("")
btnSend.visibility = View.INVISIBLE
rgFee.isEnabled = !(ctx.blockchain == Blockchain.Ethereum || ctx.blockchain == Blockchain.EthereumTestNet || ctx.blockchain == Blockchain.Token || ctx.blockchain == Blockchain.BitcoinCash || ctx.blockchain == Blockchain.Litecoin)
for (lol in rgFee.touchables) {
lol.isEnabled = !(ctx.blockchain == Blockchain.Ethereum || ctx.blockchain == Blockchain.EthereumTestNet || ctx.blockchain == Blockchain.Token || ctx.blockchain == Blockchain.BitcoinCash || ctx.blockchain == Blockchain.Litecoin)
}
// set listeners
rgFee.setOnCheckedChangeListener { _, checkedId -> doSetFee(checkedId) }
@ -87,11 +88,11 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
try {
val engine = CoinEngineFactory.create(ctx)
val eqFee = engine!!.evaluateFeeEquivalent(etFee!!.text.toString())
val eqFee = engine?.evaluateFeeEquivalent(etFee!!.text.toString())
tvFeeEquivalent.text = eqFee
if (!ctx.coinData!!.amountEquivalentDescriptionAvailable) {
tvFeeEquivalent.error = "Service unavailable"
tvFeeEquivalent.error = getString(R.string.service_unavailable)
tvCurrency2.visibility = View.GONE
tvFeeEquivalent.visibility = View.GONE
} else
@ -108,48 +109,51 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
})
btnSend.setOnClickListener {
val calendar = Calendar.getInstance()
calendar.add(Calendar.MINUTE, -1)
if (UtilHelper.isOnline(this)) {
val calendar = Calendar.getInstance()
calendar.add(Calendar.MINUTE, -1)
if (dtVerified == null || dtVerified!!.before(calendar.time)) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.the_obtained_data_is_outdated_try_again))
return@setOnClickListener
}
if (dtVerified == null || dtVerified!!.before(calendar.time)) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.the_obtained_data_is_outdated_try_again))
return@setOnClickListener
}
val engineCoin = CoinEngineFactory.create(ctx)
val engineCoin = CoinEngineFactory.create(ctx)
if (engineCoin!!.isNeedCheckNode && !nodeCheck) {
Toast.makeText(baseContext, getString(R.string.cannot_reach_current_active_blockchain_node_try_again), Toast.LENGTH_LONG).show()
return@setOnClickListener
}
if (engineCoin!!.isNeedCheckNode && !nodeCheck) {
Toast.makeText(baseContext, getString(R.string.cannot_reach_current_active_blockchain_node_try_again), Toast.LENGTH_LONG).show()
return@setOnClickListener
}
val txFee = engineCoin.convertToAmount(etFee.text.toString(), tvCurrency2.text.toString())
val txAmount = engineCoin.convertToAmount(etAmount.text.toString(), tvCurrency.text.toString())
val txFee = engineCoin.convertToAmount(etFee.text.toString(), tvCurrency2.text.toString())
val txAmount = engineCoin.convertToAmount(etAmount.text.toString(), tvCurrency.text.toString())
if (!engineCoin.hasBalanceInfo()) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_check_balance_no_connection_with_blockchain_nodes))
return@setOnClickListener
if (!engineCoin.hasBalanceInfo()) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_check_balance_no_connection_with_blockchain_nodes))
return@setOnClickListener
} else if (!engineCoin.isBalanceNotZero) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.the_wallet_is_empty))
return@setOnClickListener
} else if (!engineCoin.isBalanceNotZero) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.the_wallet_is_empty))
return@setOnClickListener
} else if (!engineCoin.isExtractPossible) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.please_wait_for_confirmation_of_incoming_transaction))
return@setOnClickListener
}
} else if (!engineCoin.isExtractPossible) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.please_wait_for_confirmation_of_incoming_transaction))
return@setOnClickListener
}
if (!engineCoin.checkNewTransactionAmountAndFee(txAmount, txFee, isIncludeFee)) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.not_enough_funds_on_your_card))
return@setOnClickListener
}
if (!engineCoin.checkNewTransactionAmountAndFee(txAmount, txFee, isIncludeFee)) {
finishWithError(Activity.RESULT_CANCELED, getString(R.string.not_enough_funds_on_your_card))
return@setOnClickListener
}
requestPIN2Count = 0
val intent = Intent(baseContext, PinRequestActivity::class.java)
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
ctx.saveToIntent(intent)
intent.putExtra(Constant.EXTRA_FEE_INCLUDED, isIncludeFee)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_)
requestPIN2Count = 0
val intent = Intent(baseContext, PinRequestActivity::class.java)
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
ctx.saveToIntent(intent)
intent.putExtra(Constant.EXTRA_FEE_INCLUDED, isIncludeFee)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_)
} else
Toast.makeText(this, getString(R.string.no_connection), Toast.LENGTH_SHORT).show()
}
val coinEngine = CoinEngineFactory.create(ctx)
@ -173,7 +177,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
override fun allowAdvance(): Boolean {
return UtilHelper.isOnline(this@ConfirmPaymentActivity)
return UtilHelper.isOnline(this@ConfirmTransactionActivity)
}
},
etWallet.text.toString(),
@ -197,7 +201,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == Constant.REQUEST_CODE_SIGN_PAYMENT) {
if (requestCode == Constant.REQUEST_CODE_SIGN_TRANSACTION) {
if (data != null && data.extras != null) {
if (data.extras!!.containsKey("UID") && data.extras!!.containsKey("Card")) {
val updatedCard = TangemCard(data.getStringExtra("UID"))
@ -220,7 +224,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
finish()
} else if (requestCode == Constant.REQUEST_CODE_REQUEST_PIN2_) {
if (resultCode == Activity.RESULT_OK) {
val intent = Intent(baseContext, SignPaymentActivity::class.java)
val intent = Intent(baseContext, SignTransactionActivity::class.java)
ctx.saveToIntent(intent)
intent.putExtra(Constant.EXTRA_TARGET_ADDRESS, etWallet!!.text.toString())
intent.putExtra(Constant.EXTRA_AMOUNT, etAmount.text.toString())
@ -228,9 +232,9 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
intent.putExtra(Constant.EXTRA_FEE, etFee.text.toString())
intent.putExtra(Constant.EXTRA_FEE_CURRENCY, tvCurrency2.text.toString())
intent.putExtra(Constant.EXTRA_FEE_INCLUDED, isIncludeFee)
startActivityForResult(intent, Constant.REQUEST_CODE_SIGN_PAYMENT)
startActivityForResult(intent, Constant.REQUEST_CODE_SIGN_TRANSACTION)
} else
Toast.makeText(baseContext, R.string.pin_2_is_required_to_sign_the_payment, Toast.LENGTH_LONG).show()
Toast.makeText(baseContext, R.string.pin_2_is_required_to_sign_the_transaction, Toast.LENGTH_LONG).show()
}
}

View file

@ -9,15 +9,20 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.view.animation.Transformation
import android.widget.ProgressBar
import android.widget.RelativeLayout
import android.widget.Toast
import com.tangem.App
import com.tangem.Constant
import com.tangem.domain.wallet.TangemContext
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
import com.tangem.tangemcard.android.nfc.DeviceNFCAntennaLocation
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.tangemcard.android.reader.NfcReader
import com.tangem.tangemcard.data.asBundle
@ -26,6 +31,7 @@ import com.tangem.tangemcard.tasks.CreateNewWalletTask
import com.tangem.tangemcard.util.Util
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_create_new_wallet.*
import kotlinx.android.synthetic.main.layout_touch_card.*
class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
companion object {
@ -40,6 +46,8 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
private lateinit var nfcManager: NfcManager
private lateinit var ctx: TangemContext
private lateinit var antenna: DeviceNFCAntennaLocation
private var createNewWalletTask: CreateNewWalletTask? = null
private var lastReadSuccess = true
@ -58,6 +66,31 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
progressBar = findViewById(R.id.progressBar)
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
// get NFC Antenna
antenna = DeviceNFCAntennaLocation()
antenna.getAntennaLocation()
// set card orientation
when (antenna.orientation) {
DeviceNFCAntennaLocation.CARD_ORIENTATION_HORIZONTAL -> {
ivHandCardHorizontal.visibility = View.VISIBLE
ivHandCardVertical.visibility = View.GONE
}
DeviceNFCAntennaLocation.CARD_ORIENTATION_VERTICAL -> {
ivHandCardVertical.visibility = View.VISIBLE
ivHandCardHorizontal.visibility = View.GONE
}
}
// set card z position
when (antenna.z) {
DeviceNFCAntennaLocation.CARD_ON_BACK -> llHand.elevation = 0.0f
DeviceNFCAntennaLocation.CARD_ON_FRONT -> llHand.elevation = 30.0f
}
animate()
}
override fun onTagDiscovered(tag: Tag) {
@ -70,11 +103,11 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
// Log.v(TAG, "UID: " + sUID);
if (sUID == ctx.card!!.uid) {
if (lastReadSuccess) {
if (lastReadSuccess)
isoDep.timeout = ctx.card!!.pauseBeforePIN2 + 5000
} else {
else
isoDep.timeout = ctx.card!!.pauseBeforePIN2 + 65000
}
createNewWalletTask = CreateNewWalletTask(ctx.card, NfcReader(nfcManager, isoDep), App.localStorage, App.pinStorage, this)
createNewWalletTask!!.start()
} else {
@ -108,6 +141,8 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
}
override fun onReadStart(cardProtocol: CardProtocol) {
rlProgressBar.post { rlProgressBar.visibility = View.VISIBLE }
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
@ -118,6 +153,8 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
createNewWalletTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
rlProgressBar.post { rlProgressBar.visibility = View.GONE }
progressBar!!.post {
progressBar!!.progress = 100
progressBar!!.progressTintList = ColorStateList.valueOf(Color.GREEN)
@ -165,6 +202,14 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
}
}
rlProgressBar.postDelayed({
try {
rlProgressBar.visibility = View.GONE
} catch (e: Exception) {
e.printStackTrace()
}
}, 500)
progressBar!!.postDelayed({
try {
progressBar!!.progress = 0
@ -206,4 +251,24 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
WaitSecurityDelayDialog.onReadAfterRequest(this)
}
private fun animate() {
val lp = llHand.layoutParams as RelativeLayout.LayoutParams
val lp2 = llNfc.layoutParams as RelativeLayout.LayoutParams
val dp = resources.displayMetrics.density
val lm = dp * (69 + antenna.x * 75)
lp.topMargin = (dp * (-100 + antenna.y * 250)).toInt()
lp2.topMargin = (dp * (-125 + antenna.y * 250)).toInt()
llNfc.layoutParams = lp2
val a = object : Animation() {
override fun applyTransformation(interpolatedTime: Float, t: Transformation) {
lp.leftMargin = (lm * interpolatedTime).toInt()
llHand.layoutParams = lp
}
}
a.duration = 2000
a.interpolator = DecelerateInterpolator()
llHand.startAnimation(a)
}
}

View file

@ -9,7 +9,7 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.text.Html
import android.view.View
import android.widget.Toast
@ -28,8 +28,10 @@ import com.tangem.tangemcard.reader.CardProtocol
import com.tangem.tangemcard.tasks.VerifyCardTask
import com.tangem.tangemcard.util.Util
import com.tangem.util.LOG
import com.tangem.util.UtilHelper
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_empty_wallet.*
import kotlinx.android.synthetic.main.layout_tangem_card.*
import javax.inject.Inject
class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
@ -52,6 +54,8 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
private var verifyCardTask: VerifyCardTask? = null
private var requestPIN2Count = 0
private var cardProtocol: CardProtocol? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_empty_wallet)
@ -71,34 +75,7 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
tvBlockchain.text = ctx.blockchainName
tvCardID.text = ctx.card!!.cidDescription
imgBlockchain.setImageResource(ctx.blockchain.getImageResource(this, ctx.card!!.tokenSymbol))
if (ctx.card!!.useDefaultPIN1()) {
imgPIN.setImageResource(R.drawable.unlock_pin1)
imgPIN.setOnClickListener { Toast.makeText(this@EmptyWalletActivity, R.string.this_banknote_protected_default_PIN1_code, Toast.LENGTH_LONG).show() }
} else {
imgPIN.setImageResource(R.drawable.lock_pin1)
imgPIN.setOnClickListener { Toast.makeText(this@EmptyWalletActivity, R.string.this_banknote_protected_user_PIN1_code, Toast.LENGTH_LONG).show() }
}
if (ctx.card!!.pauseBeforePIN2 > 0 && (ctx.card!!.useDefaultPIN2()!! || !ctx.card!!.useSmartSecurityDelay())) {
imgPIN2orSecurityDelay.setImageResource(R.drawable.timer)
imgPIN2orSecurityDelay.setOnClickListener { Toast.makeText(this@EmptyWalletActivity, String.format(getString(R.string.this_banknote_will_enforce), ctx.card!!.pauseBeforePIN2 / 1000.0), Toast.LENGTH_LONG).show() }
} else if (ctx.card!!.useDefaultPIN2()!!) {
imgPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2)
imgPIN2orSecurityDelay.setOnClickListener { Toast.makeText(this@EmptyWalletActivity, R.string.this_banknote_protected_default_PIN2_code, Toast.LENGTH_LONG).show() }
} else {
imgPIN2orSecurityDelay.setImageResource(R.drawable.lock_pin2)
imgPIN2orSecurityDelay.setOnClickListener { Toast.makeText(this@EmptyWalletActivity, R.string.this_banknote_protected_user_PIN2_code, Toast.LENGTH_LONG).show() }
}
if (ctx.card!!.useDevelopersFirmware()!!) {
imgDeveloperVersion.setImageResource(R.drawable.ic_developer_version)
imgDeveloperVersion.visibility = View.VISIBLE
imgDeveloperVersion.setOnClickListener { Toast.makeText(this@EmptyWalletActivity, R.string.unlocked_banknote_only_development_use, Toast.LENGTH_LONG).show() }
} else
imgDeveloperVersion.visibility = View.INVISIBLE
ivTangemCard.setImageBitmap(App.localStorage.getCardArtworkBitmap(ctx.card))
// set listeners
btnNewWallet.setOnClickListener {
@ -109,6 +86,13 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
intent.putExtra("Card", ctx.card!!.asBundle)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2)
}
btnDetails.setOnClickListener {
if (cardProtocol != null)
navigator.showVerifyCard(this, ctx)
else
UtilHelper.showSingleToast(this, getString(R.string.need_attach_card_again))
}
}
public override fun onResume() {
@ -129,7 +113,6 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == Constant.REQUEST_CODE_CREATE_NEW_WALLET_ACTIVITY) {
if (resultCode == Activity.RESULT_OK) {
if (data != null) {
data.putExtra("modification", "updateAndViewCard")
data.putExtra("updateDelay", 0)
@ -175,23 +158,24 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
LOG.d(TAG, "UID: $sUID")
}
if (lastReadSuccess) {
if (lastReadSuccess)
isoDep.timeout = 1000
} else {
else
isoDep.timeout = 65000
}
//lastTag = tag;
verifyCardTask = VerifyCardTask(ctx.card, NfcReader(nfcManager, isoDep), App.localStorage, App.pinStorage, App.firmwaresStorage, this)
verifyCardTask!!.start()
verifyCardTask?.start()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onReadStart(cardProtocol: CardProtocol) {
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
rlProgressBar?.post { rlProgressBar.visibility = View.VISIBLE }
progressBar?.post {
progressBar?.visibility = View.VISIBLE
progressBar?.progress = 5
}
}
@ -199,37 +183,42 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
verifyCardTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
progressBar!!.post {
progressBar!!.progress = 100
progressBar!!.progressTintList = ColorStateList.valueOf(Color.GREEN)
// val intent = Intent(this@EmptyWalletActivity, VerifyCardActivity::class.java)
// intent.putExtra("UID", cardProtocol.card.uid)
// intent.putExtra("Card", cardProtocol.card.asBundle)
// startActivityForResult(intent, REQUEST_CODE_VERIFY_CARD)
//addCard(cardProtocol.getCard());
rlProgressBar?.post { rlProgressBar.visibility = View.GONE }
progressBar?.post {
progressBar?.progress = 100
progressBar?.progressTintList = ColorStateList.valueOf(Color.GREEN)
this.cardProtocol = cardProtocol
}
} else {
// remove last UIDs because of error and no card read
progressBar!!.post {
progressBar?.post {
lastReadSuccess = false
if (cardProtocol.error is CardProtocol.TangemException_ExtendedLengthNotSupported) {
if (!NoExtendedLengthSupportDialog.allReadyShowed) {
if (!NoExtendedLengthSupportDialog.allReadyShowed)
NoExtendedLengthSupportDialog().show(supportFragmentManager, NoExtendedLengthSupportDialog.TAG)
}
} else {
} else
Toast.makeText(this@EmptyWalletActivity, R.string.try_to_scan_again, Toast.LENGTH_LONG).show()
}
progressBar!!.progress = 100
progressBar!!.progressTintList = ColorStateList.valueOf(Color.RED)
progressBar?.progress = 100
progressBar?.progressTintList = ColorStateList.valueOf(Color.RED)
}
}
}
progressBar!!.postDelayed({
rlProgressBar?.postDelayed({
try {
progressBar!!.progress = 0
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
rlProgressBar?.visibility = View.GONE
} catch (e: Exception) {
e.printStackTrace()
}
}, 500)
progressBar?.postDelayed({
try {
progressBar?.progress = 0
progressBar?.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar?.visibility = View.INVISIBLE
} catch (e: Exception) {
e.printStackTrace()
}
@ -237,16 +226,25 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
progressBar?.post { progressBar!!.progress = progress }
}
override fun onReadCancel() {
verifyCardTask = null
progressBar!!.postDelayed({
rlProgressBar?.postDelayed({
try {
progressBar!!.progress = 0
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
rlProgressBar?.visibility = View.GONE
} catch (e: Exception) {
e.printStackTrace()
}
}, 500)
progressBar?.postDelayed({
try {
progressBar?.progress = 0
progressBar?.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar?.visibility = View.INVISIBLE
} catch (e: Exception) {
e.printStackTrace()
}

View file

@ -5,7 +5,7 @@ import android.content.Intent
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import com.tangem.App
import com.tangem.Constant
import com.tangem.di.Navigator

View file

@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import com.tangem.App
import com.tangem.Constant
import com.tangem.di.Navigator

View file

@ -10,10 +10,10 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.PopupMenu
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.PopupMenu
import android.util.Log
import android.view.Menu
import android.view.MenuItem
@ -48,6 +48,7 @@ import com.tangem.util.PhoneUtility
import com.tangem.wallet.BuildConfig
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.layout_touch_card.*
import java.io.File
import java.util.*
import javax.inject.Inject
@ -65,7 +66,7 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
private lateinit var nfcManager: NfcManager
private var zipFile: File? = null
private var antenna: DeviceNFCAntennaLocation? = null
private lateinit var antenna: DeviceNFCAntennaLocation
private var unsuccessReadCount = 0
private var lastTag: Tag? = null
private var readCardInfoTask: ReadCardInfoTask? = null
@ -98,11 +99,12 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
rippleBackgroundNfc.startRippleAnimation()
// get NFC Antenna
antenna = DeviceNFCAntennaLocation()
antenna!!.getAntennaLocation()
antenna.getAntennaLocation()
// set card orientation
when (antenna!!.orientation) {
when (antenna.orientation) {
DeviceNFCAntennaLocation.CARD_ORIENTATION_HORIZONTAL -> {
ivHandCardHorizontal.visibility = View.VISIBLE
ivHandCardVertical.visibility = View.GONE
@ -115,19 +117,19 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
}
// set card z position
when (antenna!!.z) {
when (antenna.z) {
DeviceNFCAntennaLocation.CARD_ON_BACK -> llHand.elevation = 0.0f
DeviceNFCAntennaLocation.CARD_ON_FRONT -> llHand.elevation = 30.0f
}
animate()
// set phone name
if (antenna!!.fullName != "")
if (antenna.fullName != "")
tvNFCHint.text = String.format(getString(R.string.scan_banknote), antenna!!.fullName)
else
tvNFCHint.text = String.format(getString(R.string.scan_banknote), getString(R.string.phone))
animate()
// NFC
val intent = intent
if (intent != null && (NfcAdapter.ACTION_TECH_DISCOVERED == intent.action || NfcAdapter.ACTION_NDEF_DISCOVERED == intent.action)) {
@ -388,9 +390,9 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
val lp = llHand.layoutParams as RelativeLayout.LayoutParams
val lp2 = llNfc.layoutParams as RelativeLayout.LayoutParams
val dp = resources.displayMetrics.density
val lm = dp * (69 + antenna!!.x * 75)
lp.topMargin = (dp * (-100 + antenna!!.y * 250)).toInt()
lp2.topMargin = (dp * (-125 + antenna!!.y * 250)).toInt()
val lm = dp * (69 + antenna.x * 75)
lp.topMargin = (dp * (-100 + antenna.y * 250)).toInt()
lp2.topMargin = (dp * (-125 + antenna.y * 250)).toInt()
llNfc.layoutParams = lp2
val a = object : Animation() {

View file

@ -13,8 +13,8 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Build
import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.support.v7.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils
import android.util.Log
import android.view.View

View file

@ -14,8 +14,8 @@ import android.os.Bundle
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyPermanentlyInvalidatedException
import android.security.keystore.KeyProperties
import android.support.v4.app.ActivityCompat
import android.support.v7.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import android.widget.Button

View file

@ -9,7 +9,7 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.widget.ProgressBar
import android.widget.Toast

View file

@ -7,7 +7,7 @@ import android.graphics.Color
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import com.tangem.App
import com.tangem.Constant

View file

@ -6,7 +6,7 @@ import android.graphics.Color
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.text.InputFilter
import android.view.View
import android.view.inputmethod.EditorInfo

View file

@ -10,7 +10,7 @@ import android.graphics.Color
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager

View file

@ -7,7 +7,7 @@ import android.content.Intent
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.text.Html
import android.view.View
import android.view.inputmethod.EditorInfo
@ -20,20 +20,22 @@ import com.tangem.domain.wallet.CoinEngineFactory
import com.tangem.domain.wallet.TangemContext
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_prepare_payment.*
import kotlinx.android.synthetic.main.activity_prepare_transaction.*
import java.io.IOException
import javax.inject.Inject
class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
class PrepareTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
companion object {
val TAG: String = PreparePaymentActivity::class.java.simpleName
val TAG: String = PrepareTransactionActivity::class.java.simpleName
fun callingIntent(context: Context, ctx: TangemContext): Intent {
val intent = Intent(context, PreparePaymentActivity::class.java)
val intent = Intent(context, PrepareTransactionActivity::class.java)
ctx.saveToIntent(intent)
return intent
}
}
@Inject
internal lateinit var navigator: Navigator
@ -43,7 +45,7 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_prepare_payment)
setContentView(R.layout.activity_prepare_transaction)
App.getNavigatorComponent().inject(this)
@ -116,13 +118,13 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
return@setOnClickListener
}
val intent = Intent(baseContext, ConfirmPaymentActivity::class.java)
val intent = Intent(baseContext, ConfirmTransactionActivity::class.java)
ctx.saveToIntent(intent)
intent.putExtra(Constant.EXTRA_TARGET_ADDRESS, etWallet!!.text.toString())
intent.putExtra(Constant.EXTRA_FEE_INCLUDED, (rgIncFee!!.checkedRadioButtonId == R.id.rbFeeIn))
intent.putExtra(Constant.EXTRA_AMOUNT, strAmount)
intent.putExtra(Constant.EXTRA_AMOUNT_CURRENCY, tvCurrency.text.toString())
startActivityForResult(intent, Constant.REQUEST_CODE_SEND_PAYMENT__)
startActivityForResult(intent, Constant.REQUEST_CODE_SEND_TRANSACTION__)
}
ivCamera.setOnClickListener { navigator.showQrScanActivity(this, Constant.REQUEST_CODE_SCAN_QR) }
@ -167,7 +169,7 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
}
etWallet!!.setText(code)
} else if (requestCode == Constant.REQUEST_CODE_SEND_PAYMENT__) {
} else if (requestCode == Constant.REQUEST_CODE_SEND_TRANSACTION__) {
setResult(resultCode, data)
finish()
}

View file

@ -10,8 +10,12 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.View
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.view.animation.Transformation
import android.widget.RelativeLayout
import android.widget.Toast
import com.tangem.App
import com.tangem.tangemcard.tasks.PurgeTask
@ -20,15 +24,18 @@ import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.domain.wallet.TangemContext
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
import com.tangem.presentation.event.DeletingWalletFinish
import com.tangem.tangemcard.android.nfc.DeviceNFCAntennaLocation
import com.tangem.tangemcard.android.reader.NfcReader
import com.tangem.tangemcard.data.asBundle
import com.tangem.tangemcard.util.Util
import com.tangem.util.LOG
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_purge.*
import kotlinx.android.synthetic.main.layout_touch_card.*
import org.greenrobot.eventbus.EventBus
class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
companion object {
val TAG: String = PurgeActivity::class.java.simpleName
@ -44,6 +51,8 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
private lateinit var nfcManager: NfcManager
private lateinit var ctx: TangemContext
private lateinit var antenna: DeviceNFCAntennaLocation
private var purgeTask: PurgeTask? = null
override fun onCreate(savedInstanceState: Bundle?) {
@ -59,6 +68,31 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
tvCardID.text = ctx.card!!.cidDescription
progressBar.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar.visibility = View.INVISIBLE
// get NFC Antenna
antenna = DeviceNFCAntennaLocation()
antenna.getAntennaLocation()
// set card orientation
when (antenna.orientation) {
DeviceNFCAntennaLocation.CARD_ORIENTATION_HORIZONTAL -> {
ivHandCardHorizontal.visibility = View.VISIBLE
ivHandCardVertical.visibility = View.GONE
}
DeviceNFCAntennaLocation.CARD_ORIENTATION_VERTICAL -> {
ivHandCardVertical.visibility = View.VISIBLE
ivHandCardHorizontal.visibility = View.GONE
}
}
// set card z position
when (antenna.z) {
DeviceNFCAntennaLocation.CARD_ON_BACK -> llHand.elevation = 0.0f
DeviceNFCAntennaLocation.CARD_ON_FRONT -> llHand.elevation = 30.0f
}
animate()
}
public override fun onResume() {
@ -114,6 +148,8 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
}
override fun onReadStart(cardProtocol: CardProtocol) {
rlProgressBar.post { rlProgressBar.visibility = View.VISIBLE }
progressBar.post {
progressBar.visibility = View.VISIBLE
progressBar.progress = 5
@ -125,26 +161,33 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
if (cardProtocol != null) {
if (cardProtocol.error == null) {
progressBar!!.post {
progressBar!!.progress = 100
progressBar!!.progressTintList = ColorStateList.valueOf(Color.GREEN)
rlProgressBar.post { rlProgressBar.visibility = View.GONE }
progressBar?.post {
progressBar?.progress = 100
progressBar?.progressTintList = ColorStateList.valueOf(Color.GREEN)
val intent = Intent()
intent.putExtra("UID", cardProtocol.card.uid)
intent.putExtra("Card", cardProtocol.card.asBundle)
setResult(Activity.RESULT_OK, intent)
EventBus.getDefault().post(DeletingWalletFinish())
finish()
}
} else {
if (cardProtocol.error is CardProtocol.TangemException_InvalidPIN) {
progressBar!!.post {
progressBar!!.progress = 100
progressBar!!.progressTintList = ColorStateList.valueOf(Color.RED)
progressBar?.post {
progressBar?.progress = 100
progressBar?.progressTintList = ColorStateList.valueOf(Color.RED)
}
progressBar!!.postDelayed({
progressBar?.postDelayed({
try {
progressBar!!.progress = 0
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
progressBar?.progress = 0
progressBar?.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar?.visibility = View.INVISIBLE
val intent = Intent()
intent.putExtra("UID", cardProtocol.card.uid)
intent.putExtra("Card", cardProtocol.card.asBundle)
@ -170,11 +213,19 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
}
}
progressBar!!.postDelayed({
rlProgressBar?.postDelayed({
try {
progressBar!!.progress = 0
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
rlProgressBar.visibility = View.GONE
} catch (e: Exception) {
e.printStackTrace()
}
}, 500)
progressBar?.postDelayed({
try {
progressBar?.progress = 0
progressBar?.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar?.visibility = View.INVISIBLE
} catch (e: Exception) {
e.printStackTrace()
}
@ -182,20 +233,40 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
}
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
progressBar!!.post { progressBar!!.progress = progress }
progressBar?.post { progressBar?.progress = progress }
}
override fun onReadCancel() {
purgeTask = null
progressBar!!.postDelayed({
progressBar?.postDelayed({
try {
progressBar!!.progress = 0
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
progressBar?.progress = 0
progressBar?.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar?.visibility = View.INVISIBLE
} catch (e: Exception) {
e.printStackTrace()
}
}, 500)
}
private fun animate() {
val lp = llHand.layoutParams as RelativeLayout.LayoutParams
val lp2 = llNfc.layoutParams as RelativeLayout.LayoutParams
val dp = resources.displayMetrics.density
val lm = dp * (69 + antenna.x * 75)
lp.topMargin = (dp * (-100 + antenna.y * 250)).toInt()
lp2.topMargin = (dp * (-125 + antenna.y * 250)).toInt()
llNfc.layoutParams = lp2
val a = object : Animation() {
override fun applyTransformation(interpolatedTime: Float, t: Transformation) {
lp.leftMargin = (lm * interpolatedTime).toInt()
llHand.layoutParams = lp
}
}
a.duration = 2000
a.interpolator = DecelerateInterpolator()
llHand.startAnimation(a)
}
}

View file

@ -6,8 +6,8 @@ import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.support.v7.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.appcompat.app.AppCompatActivity
import com.google.zxing.Result
import com.tangem.Constant
import me.dm7.barcodescanner.zxing.ZXingScannerView

View file

@ -4,7 +4,7 @@ import android.content.Intent
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.KeyEvent
import android.widget.Toast
import com.tangem.Constant
@ -43,7 +43,7 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
if (success)
finishWithSuccess()
else
finishWithError(this@SendTransactionActivity.getString(R.string.try_again_failed_to_send_transaction))
finishWithError(ctx.error)
}
override fun onProgress() {

View file

@ -8,10 +8,14 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import android.view.KeyEvent
import android.view.View
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.view.animation.Transformation
import android.widget.ProgressBar
import android.widget.RelativeLayout
import android.widget.Toast
import com.tangem.App
import com.tangem.Constant
@ -20,6 +24,7 @@ import com.tangem.domain.wallet.CoinEngineFactory
import com.tangem.domain.wallet.TangemContext
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
import com.tangem.tangemcard.android.nfc.DeviceNFCAntennaLocation
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.tangemcard.android.reader.NfcReader
import com.tangem.tangemcard.data.asBundle
@ -28,18 +33,21 @@ import com.tangem.tangemcard.tasks.SignTask
import com.tangem.tangemcard.util.Util
import com.tangem.util.LOG
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_sign_payment.*
import kotlinx.android.synthetic.main.activity_sign_transaction.*
import kotlinx.android.synthetic.main.layout_touch_card.*
class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
class SignTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
companion object {
val TAG: String = SignPaymentActivity::class.java.simpleName
val TAG: String = SignTransactionActivity::class.java.simpleName
}
private lateinit var nfcManager: NfcManager
private lateinit var ctx: TangemContext
private var signPaymentTask: SignTask? = null
private lateinit var antenna: DeviceNFCAntennaLocation
private var signTransactionTask: SignTask? = null
private lateinit var amount: CoinEngine.Amount
private lateinit var fee: CoinEngine.Amount
@ -51,7 +59,7 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sign_payment)
setContentView(R.layout.activity_sign_transaction)
nfcManager = NfcManager(this, this)
@ -67,6 +75,31 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
progressBar = findViewById(R.id.progressBar)
progressBar!!.progressTintList = ColorStateList.valueOf(Color.DKGRAY)
progressBar!!.visibility = View.INVISIBLE
// get NFC Antenna
antenna = DeviceNFCAntennaLocation()
antenna.getAntennaLocation()
// set card orientation
when (antenna.orientation) {
DeviceNFCAntennaLocation.CARD_ORIENTATION_HORIZONTAL -> {
ivHandCardHorizontal.visibility = View.VISIBLE
ivHandCardVertical.visibility = View.GONE
}
DeviceNFCAntennaLocation.CARD_ORIENTATION_VERTICAL -> {
ivHandCardVertical.visibility = View.VISIBLE
ivHandCardHorizontal.visibility = View.GONE
}
}
// set card z position
when (antenna.z) {
DeviceNFCAntennaLocation.CARD_ON_BACK -> llHand.elevation = 0.0f
DeviceNFCAntennaLocation.CARD_ON_FRONT -> llHand.elevation = 30.0f
}
animate()
}
public override fun onResume() {
@ -76,21 +109,21 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
public override fun onPause() {
nfcManager.onPause()
if (signPaymentTask != null)
signPaymentTask!!.cancel(true)
if (signTransactionTask != null)
signTransactionTask!!.cancel(true)
super.onPause()
}
public override fun onStop() {
// dismiss enable NFC dialog
nfcManager.onStop()
if (signPaymentTask != null)
signPaymentTask!!.cancel(true)
if (signTransactionTask != null)
signTransactionTask!!.cancel(true)
super.onStop()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == Constant.REQUEST_CODE_SEND_PAYMENT_) {
if (requestCode == Constant.REQUEST_CODE_SEND_TRANSACTION_) {
setResult(resultCode, data)
finish()
return
@ -127,18 +160,18 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
val coinEngine = CoinEngineFactory.create(ctx)
?: throw CardProtocol.TangemException("Can't create CoinEngine!")
coinEngine.setOnNeedSendPayment { tx ->
coinEngine.setOnNeedSendTransaction { tx ->
if (tx != null) {
val intent = Intent(this, SendTransactionActivity::class.java)
ctx.saveToIntent(intent)
intent.putExtra(Constant.EXTRA_TX, tx)
startActivityForResult(intent, Constant.REQUEST_CODE_SEND_PAYMENT_)
startActivityForResult(intent, Constant.REQUEST_CODE_SEND_TRANSACTION_)
}
}
val paymentToSign = coinEngine.constructPayment(amount, fee, isIncludeFee, outAddressStr)
val transactionToSign = coinEngine.constructTransaction(amount, fee, isIncludeFee, outAddressStr)
signPaymentTask = SignTask(ctx.card, NfcReader(nfcManager, isoDep), App.localStorage, App.pinStorage, this, paymentToSign)
signPaymentTask!!.start()
signTransactionTask = SignTask(ctx.card, NfcReader(nfcManager, isoDep), App.localStorage, App.pinStorage, this, transactionToSign)
signTransactionTask!!.start()
} else
nfcManager.ignoreTag(isoDep.tag)
@ -159,6 +192,8 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
override fun onReadStart(cardProtocol: CardProtocol) {
rlProgressBar.post { rlProgressBar.visibility = View.VISIBLE }
progressBar!!.post {
progressBar!!.visibility = View.VISIBLE
progressBar!!.progress = 5
@ -170,9 +205,11 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
override fun onReadFinish(cardProtocol: CardProtocol?) {
signPaymentTask = null
signTransactionTask = null
if (cardProtocol != null) {
if (cardProtocol.error == null) {
rlProgressBar.post { rlProgressBar.visibility = View.GONE }
progressBar!!.post {
progressBar!!.progress = 100
progressBar!!.progressTintList = ColorStateList.valueOf(Color.GREEN)
@ -228,6 +265,14 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
}
rlProgressBar.postDelayed({
try {
rlProgressBar.visibility = View.GONE
} catch (e: Exception) {
e.printStackTrace()
}
}, 500)
progressBar!!.postDelayed({
try {
progressBar!!.progress = 0
@ -240,7 +285,7 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
override fun onReadCancel() {
signPaymentTask = null
signTransactionTask = null
progressBar!!.postDelayed({
try {
@ -289,5 +334,25 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
}
private fun animate() {
val lp = llHand.layoutParams as RelativeLayout.LayoutParams
val lp2 = llNfc.layoutParams as RelativeLayout.LayoutParams
val dp = resources.displayMetrics.density
val lm = dp * (69 + antenna.x * 75)
lp.topMargin = (dp * (-100 + antenna.y * 250)).toInt()
lp2.topMargin = (dp * (-125 + antenna.y * 250)).toInt()
llNfc.layoutParams = lp2
val a = object : Animation() {
override fun applyTransformation(interpolatedTime: Float, t: Transformation) {
lp.leftMargin = (lm * interpolatedTime).toInt()
llHand.layoutParams = lp
}
}
a.duration = 2000
a.interpolator = DecelerateInterpolator()
llHand.startAnimation(a)
}
}

View file

@ -3,7 +3,7 @@ package com.tangem.presentation.activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import com.tangem.App
import com.tangem.Constant
import com.tangem.di.Navigator

View file

@ -3,7 +3,7 @@ package com.tangem.presentation.dialog
import android.app.AlertDialog
import android.app.Dialog
import android.os.Bundle
import android.support.v4.app.DialogFragment
import androidx.fragment.app.DialogFragment
import com.tangem.wallet.R

View file

@ -4,7 +4,7 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import androidx.fragment.app.DialogFragment;
import com.tangem.wallet.R;

View file

@ -3,7 +3,7 @@ package com.tangem.presentation.dialog
import android.app.AlertDialog
import android.app.Dialog
import android.os.Bundle
import android.support.v4.app.DialogFragment
import androidx.fragment.app.DialogFragment
import com.tangem.wallet.R

View file

@ -3,7 +3,6 @@ package com.tangem.presentation.dialog;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.os.Bundle;
@ -16,6 +15,9 @@ import android.widget.TextView;
import com.tangem.util.UtilHelper;
import com.tangem.wallet.R;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
/**
* Created by dvol on 06.03.2018.
*/
@ -66,11 +68,11 @@ public class ShowQRCodeDialog extends DialogFragment {
}
}
public static void show(final Activity activity, final String content) {
public static void show(final AppCompatActivity activity, final String content) {
activity.runOnUiThread(() -> {
ShowQRCodeDialog instance = new ShowQRCodeDialog();
instance.setup(content);
instance.show(activity.getFragmentManager(), "ShowQRCodeDialog");
instance.show(activity.getSupportFragmentManager(), "ShowQRCodeDialog");
});
}

View file

@ -3,7 +3,7 @@ package com.tangem.presentation.dialog;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -15,6 +15,9 @@ import com.tangem.wallet.R;
import java.util.Timer;
import java.util.TimerTask;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
/**
* Created by dvol on 06.03.2018.
*/
@ -101,14 +104,15 @@ public class WaitSecurityDelayDialog extends DialogFragment {
// return instance;
// }
private final static int MinRemainingDelayToShowDialog=1000;
private final static int DelayBeforeShowDialog=5000;
private final static int MinRemainingDelayToShowDialog = 1000;
private final static int DelayBeforeShowDialog = 5000;
public static void onReadBeforeRequest(final Activity activity, final int timeout) {
public static void onReadBeforeRequest(final AppCompatActivity activity, final int timeout) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (timerToShowDelayDialog != null || timeout < DelayBeforeShowDialog+MinRemainingDelayToShowDialog) return;
if (timerToShowDelayDialog != null || timeout < DelayBeforeShowDialog + MinRemainingDelayToShowDialog)
return;
timerToShowDelayDialog = new Timer();
timerToShowDelayDialog.schedule(new TimerTask() {
@Override
@ -117,7 +121,7 @@ public class WaitSecurityDelayDialog extends DialogFragment {
instance = new WaitSecurityDelayDialog();
instance.setup(timeout, DelayBeforeShowDialog);
instance.setCancelable(false);
instance.show(activity.getFragmentManager(), "WaitSecurityDelayDialog");
instance.show(activity.getSupportFragmentManager(), "WaitSecurityDelayDialog");
}
}, DelayBeforeShowDialog);
}
@ -135,7 +139,7 @@ public class WaitSecurityDelayDialog extends DialogFragment {
});
}
public static void onReadWait(final Activity activity, final int msec) {
public static void onReadWait(final AppCompatActivity activity, final int msec) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
@ -146,18 +150,19 @@ public class WaitSecurityDelayDialog extends DialogFragment {
if (msec == 0) {
if (instance != null) {
//TODO remove onNext java.lang.IllegalStateException: Fragment WaitSecurityDelayDialog{ba2c429 (2368a785-523e-4c3d-b46a-402d2c4f102b)} not associated with a fragment manager.
instance.dismiss();
instance = null;
}
return;
}
if (instance == null) {
if( msec>MinRemainingDelayToShowDialog ) {
if (msec > MinRemainingDelayToShowDialog) {
instance = new WaitSecurityDelayDialog();
// 1000ms - card delay notification interval
instance.setup(msec + 1000, 1000);
instance.setCancelable(false);
instance.show(activity.getFragmentManager(), "WaitSecurityDelayDialog");
instance.show(activity.getSupportFragmentManager(), "WaitSecurityDelayDialog");
}
} else {
instance.setRemainingTimeout(msec);

View file

@ -4,13 +4,11 @@ import android.annotation.SuppressLint
import android.app.AlertDialog
import android.app.Dialog
import android.os.Bundle
import android.support.v7.app.AppCompatDialogFragment
import androidx.appcompat.app.AppCompatDialogFragment
import android.widget.ProgressBar
import com.tangem.presentation.activity.SignPaymentActivity
import com.tangem.presentation.event.ReadAfterRequest
import com.tangem.presentation.event.ReadBeforeRequest
import com.tangem.presentation.event.ReadWait
import com.tangem.presentation.event.TransactionFinishWithSuccess
import com.tangem.util.LOG
import com.tangem.wallet.R
import org.greenrobot.eventbus.EventBus
@ -84,8 +82,11 @@ class WaitSecurityDelayDialogNew : AppCompatDialogFragment() {
override fun run() {
setup(readBeforeRequest.timeout!!, DELAY_BEFORE_SHOW_DIALOG)
isCancelable = false
if (!isAdded)
show(activity?.supportFragmentManager, TAG)
// if (!isAdded)
// show(activity?.supportFragmentManager, TAG)
}
}, DELAY_BEFORE_SHOW_DIALOG.toLong())
}

View file

@ -0,0 +1,3 @@
package com.tangem.presentation.event
class DeletingWalletFinish

View file

@ -1,4 +1,3 @@
package com.tangem.presentation.event
class ReadAfterRequest {
}
class ReadAfterRequest

View file

@ -10,14 +10,14 @@ import android.nfc.NfcAdapter
import android.nfc.Tag
import android.nfc.tech.IsoDep
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
import androidx.core.content.ContextCompat
import android.text.Html
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.tangem.App
import com.tangem.Constant
import com.tangem.data.Blockchain
@ -34,6 +34,7 @@ import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
import com.tangem.presentation.dialog.PINSwapWarningDialog
import com.tangem.presentation.dialog.ShowQRCodeDialog
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
import com.tangem.presentation.event.DeletingWalletFinish
import com.tangem.presentation.event.TransactionFinishWithError
import com.tangem.presentation.event.TransactionFinishWithSuccess
import com.tangem.tangemcard.android.reader.NfcManager
@ -51,13 +52,15 @@ import com.tangem.util.LOG
import com.tangem.util.UtilHelper
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.fr_loaded_wallet.*
import kotlinx.android.synthetic.main.layout_btn_details.*
import kotlinx.android.synthetic.main.layout_tangem_card.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import java.io.InputStream
import java.util.*
import kotlin.concurrent.timerTask
class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notifications, SharedPreferences.OnSharedPreferenceChangeListener {
class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notifications, SharedPreferences.OnSharedPreferenceChangeListener {
companion object {
val TAG: String = LoadedWallet::class.java.simpleName
}
@ -90,6 +93,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
//updateViews()
} else if (srl != null && !srl.isRefreshing) srl.isRefreshing = true
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
nfcManager = NfcManager(activity, this)
@ -123,7 +127,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
btnExplore.setOnClickListener {
val engine = CoinEngineFactory.create(ctx)
startActivity(Intent(Intent.ACTION_VIEW, engine?.shareWalletUriExplorer))
startActivity(Intent(Intent.ACTION_VIEW, engine?.walletExplorerUri))
}
btnCopy.setOnClickListener { doShareWallet(false) }
@ -150,19 +154,19 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
getString(R.string.load_via_qr) -> {
val engine = CoinEngineFactory.create(ctx)
ShowQRCodeDialog.show(activity, engine!!.shareWalletUri.toString())
ShowQRCodeDialog.show(activity as AppCompatActivity?, engine!!.shareWalletUri.toString())
}
getString(R.string.via_cryptonit) -> {
val intent = Intent(activity, PrepareCryptonitWithdrawalActivity::class.java)
ctx.saveToIntent(intent)
startActivityForResult(intent, Constant.REQUEST_CODE_RECEIVE_PAYMENT)
startActivityForResult(intent, Constant.REQUEST_CODE_RECEIVE_TRANSACTION)
}
getString(R.string.via_kraken) -> {
val intent = Intent(activity, PrepareKrakenWithdrawalActivity::class.java)
ctx.saveToIntent(intent)
startActivityForResult(intent, Constant.REQUEST_CODE_RECEIVE_PAYMENT)
startActivityForResult(intent, Constant.REQUEST_CODE_RECEIVE_TRANSACTION)
}
else -> {
}
@ -182,7 +186,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
else if (ctx.card!!.remainingSignatures == 0)
UtilHelper.showSingleToast(context, getString(R.string.card_has_no_remaining_signature))
else
(activity as LoadedWalletActivity).navigator.showPreparePayment(context as Activity, ctx)
(activity as LoadedWalletActivity).navigator.showPrepareTransaction(context as Activity, ctx)
else
Toast.makeText(activity, getString(R.string.no_connection), Toast.LENGTH_SHORT).show()
}
@ -258,8 +262,8 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
serverApiTangem.setArtworkListener(artworkListener)
// request rate info listener
serverApiCommon.setRateInfoData {
if (activity == null || !UtilHelper.isOnline(activity!!)) return@setRateInfoData
serverApiCommon.setRateInfoListener {
if (activity == null || !UtilHelper.isOnline(activity!!)) return@setRateInfoListener
val rate = it.priceUsd.toFloat()
ctx.coinData!!.rate = rate
ctx.coinData!!.rateAlter = rate
@ -305,7 +309,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
ctx.message = transactionFinishWithSuccess.message
ctx.coinData.clearInfo()
updateViews()
srl?.isRefreshing=true
srl?.isRefreshing = true
srl?.postDelayed({ refresh() }, 5000)
}
@ -315,6 +319,11 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
updateViews()
}
@Subscribe
fun onDeleteWalletFinish(deletingWalletFinish: DeletingWalletFinish) {
activity?.finish()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
@ -353,7 +362,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
else
bundle.putString(PINSwapWarningDialog.EXTRA_MESSAGE, getString(R.string.if_you_use_default))
pinSwapWarningDialog.arguments = bundle
pinSwapWarningDialog.show(activity?.supportFragmentManager, PINSwapWarningDialog.TAG)
activity?.supportFragmentManager?.let { pinSwapWarningDialog.show(it, PINSwapWarningDialog.TAG) }
}
Constant.REQUEST_CODE_SWAP_PIN -> if (resultCode == Activity.RESULT_OK) {
@ -416,7 +425,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
updateViews()
}
Constant.REQUEST_CODE_SEND_PAYMENT, Constant.REQUEST_CODE_RECEIVE_PAYMENT -> {
Constant.REQUEST_CODE_SEND_TRANSACTION, Constant.REQUEST_CODE_RECEIVE_TRANSACTION -> {
if (resultCode == Activity.RESULT_OK) {
ctx.coinData?.clearInfo()
srl?.postDelayed({ this.refresh() }, 5000)
@ -448,8 +457,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
override fun onReadStart(cardProtocol: CardProtocol) {
if (rlProgressBar != null)
rlProgressBar.post { rlProgressBar.visibility = View.VISIBLE }
rlProgressBar?.post { rlProgressBar.visibility = View.VISIBLE }
}
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
@ -472,7 +480,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
lastReadSuccess = false
if (cardProtocol.error is CardProtocol.TangemException_ExtendedLengthNotSupported)
if (!NoExtendedLengthSupportDialog.allReadyShowed)
NoExtendedLengthSupportDialog().show(activity?.supportFragmentManager, NoExtendedLengthSupportDialog.TAG)
activity?.supportFragmentManager?.let { NoExtendedLengthSupportDialog().show(it, NoExtendedLengthSupportDialog.TAG) }
else
Toast.makeText(activity, R.string.try_to_scan_again, Toast.LENGTH_SHORT).show()
}
@ -500,11 +508,11 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
override fun onReadWait(msec: Int) {
WaitSecurityDelayDialog.onReadWait(activity, msec)
WaitSecurityDelayDialog.onReadWait(activity as AppCompatActivity?, msec)
}
override fun onReadBeforeRequest(timeout: Int) {
WaitSecurityDelayDialog.onReadBeforeRequest(activity, timeout)
WaitSecurityDelayDialog.onReadBeforeRequest(activity as AppCompatActivity?, timeout)
}
override fun onReadAfterRequest() {
@ -632,8 +640,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
requestRateInfo()
if( requestCounter==0 )
{
if (requestCounter == 0) {
// if no connection and no requests posted
srl?.isRefreshing = false
updateViews()
@ -647,7 +654,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
coinEngine!!.requestBalanceAndUnspentTransactions(
object : CoinEngine.BlockchainRequestsCallbacks {
override fun onComplete(success: Boolean) {
LOG.i(TAG, "requestBalanceAndUnspentTransactions onComplete: " + success.toString() + ", request counter " + requestCounter.toString())
LOG.i(TAG, "requestBalanceAndUnspentTransactions onComplete: $success, request counter $requestCounter")
if (activity == null) return
requestCounter--
if (!success) {
@ -666,7 +673,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
override fun allowAdvance(): Boolean {
return UtilHelper.isOnline(context as Activity)
return context?.let { UtilHelper.isOnline(it) }!!
}
}
)
@ -706,12 +713,12 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
Blockchain.BitcoinCash -> "bitcoin-cash"
Blockchain.Litecoin -> "litecoin"
Blockchain.Rootstock -> "bitcoin"
Blockchain.RootstockToken ->"bitcoin"
Blockchain.RootstockToken -> "bitcoin"
else -> {
throw Exception("Can''t get rate for blockchain " + ctx.blockchainName)
}
}
serverApiCommon.rateInfoData(cryptoId)
serverApiCommon.requestRateInfo(cryptoId)
} else {
ctx.error = getString(R.string.no_connection)
updateViews()

View file

@ -5,8 +5,7 @@ import android.content.Intent
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
import androidx.core.content.ContextCompat
import android.text.Html
import android.text.format.DateUtils
import android.view.LayoutInflater
@ -21,24 +20,27 @@ import com.tangem.domain.wallet.CoinEngineFactory
import com.tangem.domain.wallet.TangemContext
import com.tangem.presentation.activity.*
import com.tangem.presentation.dialog.PINSwapWarningDialog
import com.tangem.presentation.event.DeletingWalletFinish
import com.tangem.tangemcard.android.data.PINStorage
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.tangemcard.data.TangemCard
import com.tangem.tangemcard.data.loadFromBundle
import com.tangem.tangemcard.reader.CardProtocol
import com.tangem.util.LOG
import com.tangem.wallet.BuildConfig
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.fr_verify_card.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import java.io.IOException
import java.util.*
class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
class VerifyCard : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback {
companion object {
val TAG: String = VerifyCard::class.java.simpleName
}
private var nfcManager: NfcManager? = null
private lateinit var nfcManager: NfcManager
private lateinit var ctx: TangemContext
private var requestPIN2Count = 0
@ -49,7 +51,6 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
nfcManager = NfcManager(activity, this)
ctx = TangemContext.loadFromBundle(activity, activity?.intent?.extras)
}
@ -74,24 +75,25 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
}
}
override fun onResume() {
super.onResume()
nfcManager!!.onResume()
override fun onStart() {
super.onStart()
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this)
}
override fun onPause() {
super.onPause()
nfcManager!!.onPause()
override fun onDestroy() {
EventBus.getDefault().unregister(this)
super.onDestroy()
}
override fun onStop() {
super.onStop()
nfcManager!!.onStop()
@Subscribe
fun onDeleteWalletFinish(deletingWalletFinish: DeletingWalletFinish) {
activity?.finish()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// var data = data
super.onActivityResult(requestCode, resultCode, data)
LOG.i(TAG, "requestCode $requestCode resultCode $resultCode")
when (requestCode) {
Constant.REQUEST_CODE_ENTER_NEW_PIN -> if (resultCode == Activity.RESULT_OK) {
if (data != null) {
@ -109,6 +111,7 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
}
}
}
Constant.REQUEST_CODE_ENTER_NEW_PIN2 -> if (resultCode == Activity.RESULT_OK) {
if (data != null) {
if (data.extras!!.containsKey("confirmPIN2")) {
@ -125,10 +128,11 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
}
}
}
Constant.REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN -> if (resultCode == Activity.RESULT_OK) {
if (newPIN == "") newPIN = ctx.card!!.pin
if (newPIN2 == "") newPIN2 = App.pinStorage.getPIN2()
if (newPIN2 == "") newPIN2 = App.pinStorage.piN2
val pinSwapWarningDialog = PINSwapWarningDialog()
pinSwapWarningDialog.setOnRefreshPage { (activity as VerifyCardActivity).navigator.showPinSwap(context as Activity, newPIN, newPIN2) }
@ -138,12 +142,11 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
else
bundle.putString(PINSwapWarningDialog.EXTRA_MESSAGE, getString(R.string.if_you_use_default))
pinSwapWarningDialog.arguments = bundle
pinSwapWarningDialog.show(activity?.supportFragmentManager, PINSwapWarningDialog.TAG)
activity?.supportFragmentManager?.let { pinSwapWarningDialog.show(it, PINSwapWarningDialog.TAG) }
}
Constant.REQUEST_CODE_SWAP_PIN -> if (resultCode == Activity.RESULT_OK) {
if (data == null) {
// data = Intent()
ctx.saveToIntent(data)
data?.putExtra("modification", "delete")
} else
@ -173,16 +176,18 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
Constant.REQUEST_CODE_REQUEST_PIN2_FOR_PURGE -> if (resultCode == Activity.RESULT_OK)
(activity as VerifyCardActivity).navigator.showPurge(context as Activity, ctx)
Constant.REQUEST_CODE_PURGE -> if (resultCode == Activity.RESULT_OK) {
if (data == null) {
ctx.saveToIntent(data)
data?.putExtra(Constant.EXTRA_MODIFICATION, "delete")
} else {
data.putExtra(Constant.EXTRA_MODIFICATION, "update")
}
activity!!.setResult(Activity.RESULT_OK, data)
activity!!.finish()
} else {
// Constant.REQUEST_CODE_PURGE -> if (resultCode == Activity.RESULT_OK) {
// if (data == null) {
// ctx.saveToIntent(data)
// data?.putExtra(Constant.EXTRA_MODIFICATION, "delete")
// } else
// data.putExtra(Constant.EXTRA_MODIFICATION, "update")
//
// activity?.setResult(Activity.RESULT_OK, data)
// activity?.finish()
// }
else {
if (data != null && data.extras!!.containsKey("UID") && data.extras!!.containsKey("Card")) {
val updatedCard = TangemCard(data.getStringExtra("UID"))
updatedCard.loadFromBundle(data.getBundleExtra("Card"))
@ -205,9 +210,24 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
}
}
override fun onTagDiscovered(tag: Tag) {
override fun onResume() {
super.onResume()
nfcManager.onResume()
}
override fun onPause() {
super.onPause()
nfcManager.onPause()
}
override fun onStop() {
super.onStop()
nfcManager.onStop()
}
override fun onTagDiscovered(tag: Tag?) {
try {
nfcManager!!.ignoreTag(tag)
nfcManager.ignoreTag(tag)
} catch (e: IOException) {
e.printStackTrace()
}
@ -369,20 +389,6 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
tvWallet!!.setText(R.string.not_available)
tvWalletIdentity.setText(R.string.no_data_string)
}
// timerHideErrorAndMessage = Timer()
// timerHideErrorAndMessage!!.schedule(object : TimerTask() {
// override fun run() {
// tvError.post {
// tvMessage!!.visibility = View.GONE
// tvError!!.visibility = View.GONE
// mCard!!.error = null
// mCard!!.message = null
// }
// }
// }, 5000)
} catch (e: Exception) {
e.printStackTrace()
}

View file

@ -15,8 +15,8 @@
*/
package com.tangem.presentation.viewmodel
import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.tangem.data.network.exception.Failure
/**

View file

@ -1,6 +1,6 @@
package com.tangem.presentation.viewmodel
import android.arch.lifecycle.MutableLiveData
import androidx.lifecycle.MutableLiveData
import com.tangem.data.network.exception.Failure
class LoadedWalletViewModel : BaseViewModel() {

View file

@ -28,7 +28,7 @@ package com.tangem.util;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.WorkerThread;
import androidx.annotation.WorkerThread;
import android.text.TextUtils;
import java.io.BufferedReader;
import java.io.IOException;

View file

@ -37,7 +37,7 @@ object UtilHelper {
return bmp
}
fun isOnline(context: Activity): Boolean {
fun isOnline(context: Context): Boolean {
return try {
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val netInfo: NetworkInfo?

View file

@ -1,338 +1,338 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.ConfirmPaymentActivity">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:text="@string/send_payment"
android:textAlignment="center"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_large"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/llPayment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/btn_light"
android:orientation="vertical"
android:paddingStart="5dp"
android:paddingTop="8dp"
android:paddingEnd="5dp"
android:paddingBottom="8dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/from_banknote"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="BB00 0000 1210 0233" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:fontFamily="@font/maax"
android:text="@string/with_balance"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/tvBalance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="4.51735 BTC" />
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/maax"
android:text="@string/send_to_wallet"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<EditText
android:id="@+id/etWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:fontFamily="@font/maax"
android:hint="@string/target_wallet_address"
android:inputType="text"
android:maxLines="2"
android:padding="12dp"
android:singleLine="false"
android:textColor="@color/black"
android:textSize="@dimen/text_size_1_small"
android:textStyle="bold" />
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/maax"
android:text="@string/amount"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvIncFee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginBottom="1dp"
android:fontFamily="@font/maax"
android:textColor="@color/primary"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintLeft_toRightOf="@+id/textView3"
tools:text="(including fee)" />
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:fontFamily="@font/maax"
android:hint="@string/payment_amount"
android:inputType="numberDecimal"
android:padding="12dp"
android:textColor="@color/black"
android:textColorLink="@color/colorPrimary"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCurrency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fontFamily="@font/maax"
android:text="@string/m_btc"
android:textSize="@dimen/text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/etAmount"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llFee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/llPayment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="4dp"
android:fontFamily="@font/maax"
android:text="@string/fee"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<info.hoang8f.android.segmented.SegmentedGroup
android:id="@+id/rgFee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checkedButton="@+id/rbNormalFee"
android:gravity="center"
android:orientation="horizontal"
app:sc_border_width="2dp"
app:sc_corner_radius="10dp"
app:sc_tint_color="@color/colorPrimary">
<RadioButton
android:id="@+id/rbMinimalFee"
style="@style/RadioButton"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/minimal"
android:textSize="@dimen/text_size_medium" />
<RadioButton
android:id="@+id/rbNormalFee"
style="@style/RadioButton"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/normal"
android:textSize="@dimen/text_size_medium" />
<RadioButton
android:id="@+id/rbMaximumFee"
style="@style/RadioButton"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/priority"
android:textSize="@dimen/text_size_medium" />
</info.hoang8f.android.segmented.SegmentedGroup>
</LinearLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/etFee"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:enabled="false"
android:fontFamily="@font/maax"
android:inputType="numberDecimal"
android:padding="12dp"
android:textColor="@color/black"
android:textColorLink="@android:color/holo_blue_dark"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="150dp" />
<TextView
android:id="@+id/tvCurrency2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:fontFamily="@font/maax"
android:text="@string/m_btc"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etFee"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvFeeEquivalent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="@android:color/darker_gray"
android:textSize="@dimen/text_size_1_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tvCurrency2"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
<Button
android:id="@+id/btnSend"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="16dp"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/send_1"
android:textSize="@dimen/text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<ProgressBar
android:id="@+id/progressBar"
style="@android:style/Widget.Holo.Light.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="4dp"
android:elevation="1dp"
android:indeterminate="true"
android:indeterminateTint="@color/colorPrimary"
android:visibility="invisible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/llFee" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.ConfirmTransactionActivity"
tools:ignore="Autofill">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:text="@string/send_transaction"
android:textAlignment="center"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_large"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/llTransaction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/btn_light"
android:orientation="vertical"
android:paddingStart="5dp"
android:paddingTop="8dp"
android:paddingEnd="5dp"
android:paddingBottom="8dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/from_banknote"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="BB00 0000 1210 0233" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:fontFamily="@font/maax"
android:text="@string/with_balance"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/tvBalance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="4.51735 BTC" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/maax"
android:text="@string/send_to_wallet"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<EditText
android:id="@+id/etWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:fontFamily="@font/maax"
android:hint="@string/target_wallet_address"
android:inputType="text"
android:maxLines="2"
android:padding="12dp"
android:singleLine="false"
android:textColor="@color/black"
android:textSize="@dimen/text_size_1_small"
android:textStyle="bold" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/maax"
android:text="@string/amount"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvIncFee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginBottom="1dp"
android:fontFamily="@font/maax"
android:textColor="@color/primary"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintLeft_toRightOf="@+id/textView3"
tools:text="(including fee)" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:fontFamily="@font/maax"
android:hint="@string/transaction_amount"
android:inputType="numberDecimal"
android:padding="12dp"
android:textColor="@color/black"
android:textColorLink="@color/colorPrimary"
android:textSize="@dimen/text_size_1_large"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCurrency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:fontFamily="@font/maax"
android:text="@string/m_btc"
android:textSize="@dimen/text_size_1_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/etAmount"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llFee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/llTransaction">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="4dp"
android:fontFamily="@font/maax"
android:text="@string/fee"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<info.hoang8f.android.segmented.SegmentedGroup
android:id="@+id/rgFee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checkedButton="@+id/rbNormalFee"
android:gravity="center"
android:orientation="horizontal"
app:sc_border_width="2dp"
app:sc_corner_radius="10dp"
app:sc_tint_color="@color/colorPrimary">
<RadioButton
android:id="@+id/rbMinimalFee"
style="@style/RadioButton"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/minimal"
android:textSize="@dimen/text_size_medium" />
<RadioButton
android:id="@+id/rbNormalFee"
style="@style/RadioButton"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/normal"
android:textSize="@dimen/text_size_medium" />
<RadioButton
android:id="@+id/rbMaximumFee"
style="@style/RadioButton"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/priority"
android:textSize="@dimen/text_size_medium" />
</info.hoang8f.android.segmented.SegmentedGroup>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/etFee"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:enabled="false"
android:fontFamily="@font/maax"
android:inputType="numberDecimal"
android:textColor="@color/black"
android:textColorLink="@android:color/holo_blue_dark"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="150dp" />
<TextView
android:id="@+id/tvCurrency2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:fontFamily="@font/maax"
android:text="@string/m_btc"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etFee"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvFeeEquivalent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="@android:color/darker_gray"
android:textSize="@dimen/text_size_1_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tvCurrency2"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<Button
android:id="@+id/btnSend"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="16dp"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/send_1"
android:textSize="@dimen/text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<ProgressBar
android:id="@+id/progressBar"
style="@android:style/Widget.Holo.Light.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="4dp"
android:elevation="1dp"
android:indeterminate="true"
android:indeterminateTint="@color/colorPrimary"
android:visibility="invisible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/llFee" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,15 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.CreateNewWalletActivity">
<include
layout="@layout/layout_touch_card"
android:layout_width="400dp"
android:layout_height="250dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.25" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75">
<TextView
android:layout_width="match_parent"
@ -23,8 +39,8 @@
android:id="@+id/tvCardId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/maax"
android:textAlignment="center"
android:textColor="@color/black"
@ -41,6 +57,8 @@
</LinearLayout>
<include layout="@layout/layout_progress_horizontal" />
<include
android:id="@+id/progressBar"
layout="@layout/layout_progress_horizontal" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -9,168 +9,163 @@
tools:context="com.tangem.presentation.activity.EmptyWalletActivity"
tools:ignore="contentDescription">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp">
<include
android:id="@+id/loCard"
layout="@layout/layout_tangem_card"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loCard">
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@color/white"
android:fontFamily="@font/maax"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="8dp">
android:text="@string/wallet_has_not_been_yet_created"
android:textAlignment="center"
android:textSize="@dimen/text_size_1_small"
app:layout_constraintBottom_toTopOf="@+id/btnNewWallet"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="8dp" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnNewWallet"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="32dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/create_wallet"
android:textSize="@dimen/text_size_large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<include
android:id="@+id/btnDetails"
layout="@layout/layout_btn_details"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnNewWallet" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnDetails">
<TextView
android:layout_width="match_parent"
android:layout_width="@dimen/empty_wallet_left_col_width"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="@dimen/empty_wallet_left_col_margin"
android:fontFamily="@font/maax"
android:gravity="center_vertical"
android:text="@string/wallet_has_not_been_yet_created"
android:textAlignment="center"
android:text="@string/blockchain"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small" />
<android.support.v7.widget.AppCompatButton
android:id="@+id/btnNewWallet"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="32dp"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/create_wallet"
android:textSize="@dimen/text_size_large" />
<LinearLayout
android:layout_width="match_parent"
<TextView
android:id="@+id/tvBlockchain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="@dimen/empty_wallet_left_col_width"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/empty_wallet_left_col_margin"
android:fontFamily="@font/maax"
android:text="@string/blockchain"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small" />
<TextView
android:id="@+id/tvBlockchain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small"
android:textStyle="normal|bold"
tools:text="12345" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="@dimen/empty_wallet_left_col_width"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/empty_wallet_left_col_margin"
android:fontFamily="@font/maax"
android:text="@string/issuer"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small" />
<TextView
android:id="@+id/tvIssuer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small"
android:textStyle="normal|bold"
tools:text="5555" />
</LinearLayout>
android:fontFamily="@font/maax"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small"
android:textStyle="normal|bold"
tools:text="Bitcoin" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:orientation="vertical">
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/linearLayout">
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_width="@dimen/empty_wallet_left_col_width"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/empty_wallet_left_col_margin"
android:fontFamily="@font/maax"
android:text="@string/issuer"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small" />
<TextView
android:id="@+id/tvIssuer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/no_data_string_1"
android:textAlignment="center"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small"
android:textStyle="normal|bold" />
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/scan_again_to_verify_the_card"
android:textAlignment="center"
android:textColor="@android:color/darker_gray"
android:textSize="@dimen/text_size_small" />
android:textStyle="normal|bold"
tools:text="TANGEM" />
</LinearLayout>
<ImageView
android:id="@+id/imgBlockchain"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/tangem_logo_small_new" />
<ImageView
android:id="@+id/imgPIN"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="false"
android:layout_margin="8dp"
android:layout_marginEnd="4dp"
android:layout_toStartOf="@+id/imgPIN2orSecurityDelay"
android:src="@drawable/unlock_pin1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/imgPIN2orSecurityDelay"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="false"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:src="@drawable/unlock_pin2" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="8dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView
android:id="@+id/imgDeveloperVersion"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:src="@drawable/ic_developer_version" />
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/no_data_string_1"
android:textAlignment="center"
android:textColor="@color/primary_dark"
android:textSize="@dimen/text_size_1_small"
android:textStyle="normal|bold" />
</RelativeLayout>
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/scan_again_to_verify_the_card"
android:textAlignment="center"
android:textColor="@android:color/darker_gray"
android:textSize="@dimen/text_size_small" />
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
@ -184,4 +179,4 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@ -18,4 +18,4 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:layout="@layout/fr_loaded_wallet"/>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@ -17,115 +17,11 @@
android:orientation="vertical">
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="30dp"
app:srcCompat="@drawable/tangem_logo_full_new" />
<RelativeLayout
android:layout_width="400dp"
android:layout_height="250dp"
android:gravity="center_vertical|center_horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="100dp"
android:elevation="2dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/imSmartphone"
android:layout_width="75dp"
android:layout_height="150dp"
app:srcCompat="@drawable/smartphone"/>
</LinearLayout>
<LinearLayout
android:id="@+id/llNfc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="100dp"
android:elevation="1dp"
android:gravity="center"
android:orientation="vertical">
<com.skyfishjy.library.RippleBackground
android:id="@+id/rippleBackgroundNfc"
android:layout_width="150dp"
android:layout_height="150dp"
app:rb_color="@color/fab"
app:rb_duration="3000"
app:rb_radius="16dp"
app:rb_rippleAmount="4"
app:rb_scale="4"
app:rb_strokeWidth="8dp"
app:rb_type="strokeRipple">
</com.skyfishjy.library.RippleBackground>
</LinearLayout>
<LinearLayout
android:id="@+id/llHand"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:elevation="0dp"
android:gravity="center_vertical"
android:orientation="vertical">
<ImageView
android:id="@+id/ivHandCardHorizontal"
android:layout_width="190dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/hand_card_horizontal"/>
<ImageView
android:id="@+id/ivHandCardVertical"
android:layout_width="190dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/hand_card_vertical"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/rlProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:elevation="10dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.75"
android:background="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:alpha="1"
android:text="@string/reading"
android:textColor="@color/colorPrimary"
android:textSize="10sp"
android:textStyle="bold" />
<ProgressBar
android:layout_width="@dimen/size_progress_bar_big"
android:layout_height="@dimen/size_progress_bar_big"
android:layout_centerInParent="true"
android:alpha="1"
android:elevation="1dp" />
</RelativeLayout>
</RelativeLayout>
<include layout="@layout/layout_touch_card" />
<TextView
android:id="@+id/tvNFCHint"
@ -158,7 +54,7 @@
android:elevation="3dp"
android:visibility="visible">
<android.support.design.widget.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -169,4 +65,4 @@
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -45,7 +45,7 @@
<include layout="@layout/layout_pin_buttons" />
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnContinue"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -291,7 +291,7 @@
tools:text="BB00 0000 1210 0233" />
</LinearLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -322,9 +322,9 @@
android:textSize="@dimen/text_size_1_small"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintLeft_toRightOf="@+id/textView3" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp">
@ -359,7 +359,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etAmount" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tvError"
@ -378,7 +378,7 @@
</LinearLayout>
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLoad"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
@ -431,4 +431,4 @@
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -284,7 +284,7 @@
tools:text="BB00 0000 1210 0233" />
</LinearLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -304,9 +304,9 @@
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp">
@ -342,7 +342,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etAmount" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
@ -362,7 +362,7 @@
</LinearLayout>
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLoad"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
@ -420,4 +420,4 @@
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -249,7 +249,7 @@
tools:text="BB00 0000 1210 0233" />
</LinearLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="24dp">
@ -269,9 +269,9 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp">
@ -307,7 +307,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etAmount" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tvError"
@ -326,7 +326,7 @@
</LinearLayout>
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLoad"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
@ -386,4 +386,4 @@
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,262 +1,262 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.PreparePaymentActivity">
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:text="@string/send_payment"
android:textAlignment="center"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_large"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/llFrom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/btn_light"
android:orientation="vertical"
android:paddingBottom="24dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingTop="24dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/maax"
android:text="@string/from_banknote"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"/>
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="BB00 0000 1210 0233"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="12dp"
android:fontFamily="@font/maax"
android:text="@string/with_balance"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvBalance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="4.51735 Btc"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llTo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/card_state_loaded_with_zero"
android:orientation="vertical"
android:paddingTop="32dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintLeft_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/llFrom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:text="@string/send_to_wallet"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/ivCamera"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="12dp"
android:src="@drawable/qr_scan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</LinearLayout>
<EditText
android:id="@+id/etWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:fontFamily="@font/maax"
android:hint="@string/enter_wallet_address"
android:inputType="text|textMultiLine|textNoSuggestions"
android:imeOptions="actionNext"
android:padding="12dp"
android:singleLine="false"
android:textColor="@color/colorPrimaryDark"
android:textColorLink="@android:color/holo_blue_dark"
android:textSize="@dimen/text_size_medium"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/ivCamera"
tools:layout_editor_absoluteY="2dp"/>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="7dp"
android:layout_marginTop="24dp"
android:fontFamily="@font/maax"
android:text="@string/amount"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp">
<EditText
android:id="@+id/etAmount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:digits="0123456789.,"
android:fontFamily="@font/maax"
android:hint="@string/enter_amount"
android:inputType="numberDecimal"
android:imeOptions="actionDone"
android:padding="12dp"
android:textColor="@color/colorPrimaryDark"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="150dp" />
<TextView
android:id="@+id/tvCurrency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:fontFamily="@font/maax"
android:text="@string/m_btc"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etAmount" />
</android.support.constraint.ConstraintLayout>
<info.hoang8f.android.segmented.SegmentedGroup
android:id="@+id/rgIncFee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checkedButton="@+id/rbFeeIn"
android:gravity="center"
android:orientation="horizontal"
app:sc_border_width="2dp"
app:sc_corner_radius="10dp"
app:sc_tint_color="@color/colorPrimary"
tools:layout_editor_absoluteX="10dp">
<RadioButton
android:id="@+id/rbFeeIn"
style="@style/RadioButton"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/including_fee_"
android:textSize="@dimen/text_size_medium" />
<RadioButton
android:id="@+id/rbFeeOut"
style="@style/RadioButton"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/not_including_fee_"
android:textSize="@dimen/text_size_medium" />
</info.hoang8f.android.segmented.SegmentedGroup>
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btnVerify"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="16dp"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/verify"
android:textSize="@dimen/text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.PrepareTransactionActivity">
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:text="@string/send_transaction"
android:textAlignment="center"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_large"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:id="@+id/llFrom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/btn_light"
android:orientation="vertical"
android:paddingBottom="24dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingTop="24dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/maax"
android:text="@string/from_banknote"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"/>
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="BB00 0000 1210 0233"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginTop="12dp"
android:fontFamily="@font/maax"
android:text="@string/with_balance"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvBalance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:textColor="@color/black"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"
tools:text="4.51735 Btc"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llTo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/card_state_loaded_with_zero"
android:orientation="vertical"
android:paddingTop="32dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintLeft_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/llFrom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/maax"
android:text="@string/send_to_wallet"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/ivCamera"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="12dp"
android:src="@drawable/qr_scan"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</LinearLayout>
<EditText
android:id="@+id/etWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:fontFamily="@font/maax"
android:hint="@string/enter_wallet_address"
android:inputType="text|textMultiLine|textNoSuggestions"
android:imeOptions="actionNext"
android:padding="12dp"
android:singleLine="false"
android:textColor="@color/colorPrimaryDark"
android:textColorLink="@android:color/holo_blue_dark"
android:textSize="@dimen/text_size_medium"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/ivCamera"
tools:layout_editor_absoluteY="2dp"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="7dp"
android:layout_marginTop="24dp"
android:fontFamily="@font/maax"
android:text="@string/amount"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp">
<EditText
android:id="@+id/etAmount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:digits="0123456789.,"
android:fontFamily="@font/maax"
android:hint="@string/enter_amount"
android:imeOptions="actionDone"
android:inputType="numberDecimal"
android:padding="12dp"
android:textColor="@color/colorPrimaryDark"
android:textSize="@dimen/text_size_1_large"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="150dp"/>
<TextView
android:id="@+id/tvCurrency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:fontFamily="@font/maax"
android:text="@string/m_btc"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_1_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/etAmount" />
</androidx.constraintlayout.widget.ConstraintLayout>
<info.hoang8f.android.segmented.SegmentedGroup
android:id="@+id/rgIncFee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checkedButton="@+id/rbFeeIn"
android:gravity="center"
android:orientation="horizontal"
app:sc_border_width="2dp"
app:sc_corner_radius="10dp"
app:sc_tint_color="@color/colorPrimary"
tools:layout_editor_absoluteX="10dp">
<RadioButton
android:id="@+id/rbFeeIn"
style="@style/RadioButton"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/including_fee_"
android:textSize="@dimen/text_size_medium" />
<RadioButton
android:id="@+id/rbFeeOut"
style="@style/RadioButton"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/not_including_fee_"
android:textSize="@dimen/text_size_medium" />
</info.hoang8f.android.segmented.SegmentedGroup>
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnVerify"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="16dp"
android:fontFamily="@font/saira_condensed_bold"
android:text="@string/verify"
android:textSize="@dimen/text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,16 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.PurgeActivity">
<include
layout="@layout/layout_touch_card"
android:layout_width="400dp"
android:layout_height="250dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.15" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.85">
<TextView
android:layout_width="match_parent"
@ -24,8 +39,8 @@
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/maax"
android:textAlignment="center"
android:textColor="@color/black"
@ -62,4 +77,4 @@
android:elevation="1dp"
app:layout_constraintBottom_toBottomOf="parent" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,4 +1,4 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -43,4 +43,4 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.378" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,46 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.SignPaymentActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/now_touch_the_banknote_with_id"
android:textAlignment="center"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:fontFamily="@font/maax"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/text_size_large"
tools:text="CB02 0000 0002 5000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/to_sign_the_payment"
android:textAlignment="center"
android:textSize="@dimen/text_size_medium" />
</LinearLayout>
<include layout="@layout/layout_progress_horizontal" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tangem.presentation.activity.SignTransactionActivity">
<include
layout="@layout/layout_touch_card"
android:layout_width="400dp"
android:layout_height="250dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.25" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/now_touch_the_banknote_with_id"
android:textAlignment="center"
android:textSize="@dimen/text_size_medium" />
<TextView
android:id="@+id/tvCardID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:fontFamily="@font/maax"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/text_size_large"
tools:text="CB02 0000 0002 5000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/maax"
android:text="@string/to_sign_the_transaction"
android:textAlignment="center"
android:textSize="@dimen/text_size_medium" />
</LinearLayout>
<include layout="@layout/layout_progress_horizontal" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@ -15,4 +15,4 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:layout="@layout/fr_verify_card"/>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -18,7 +18,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:fontFamily="@font/maax"
android:text="TextView"
android:textAlignment="center"
android:textSize="@dimen/text_size_2_small" />

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
@ -72,4 +72,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progressBar"/>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -11,7 +11,7 @@
tools:ignore="contentDescription"
tools:showIn="@layout/activity_loaded_wallet">
<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/srl"
android:layout_width="0dp"
android:layout_height="0dp"
@ -22,69 +22,18 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0">
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="false"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
<include
android:id="@+id/loCard"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="200dp"
android:padding="3dp"
app:layout_constraintHeight_max="200dp"
app:layout_constraintTop_toTopOf="parent">
layout="@layout/layout_tangem_card" />
<ImageView
android:id="@+id/ivTangemCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:src="@drawable/card_default" />
<RelativeLayout
android:id="@+id/rlProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:elevation="3dp"
android:padding="5dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/textView10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.75"
android:background="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:alpha="1"
android:fontFamily="@font/maaxmedium"
android:text="@string/verifying"
android:textColor="@color/colorPrimary"
android:textSize="10sp"
android:textStyle="bold" />
<ProgressBar
android:layout_width="@dimen/size_progress_bar_big"
android:layout_height="@dimen/size_progress_bar_big"
android:layout_centerInParent="true"
android:alpha="1"
android:elevation="1dp"
android:progressTint="@color/colorPrimary" />
</RelativeLayout>
</RelativeLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
@ -157,7 +106,7 @@
</LinearLayout>
<android.support.constraint.Guideline
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -172,7 +121,8 @@
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHeight_min="wrap"
app:layout_constraintTop_toBottomOf="@+id/guideline">
app:layout_constraintTop_toBottomOf="@+id/guideline"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"
@ -212,7 +162,7 @@
android:layout_height="match_parent"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnExplore"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
@ -229,7 +179,7 @@
android:text="@string/explore"
android:textColor="@color/primary_dark" />
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnCopy"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
@ -250,11 +200,11 @@
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<RelativeLayout
android:id="@+id/rlMessageAndError"
@ -303,7 +253,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/rlAuxButtons">
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLoad"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
@ -318,7 +268,7 @@
android:text="@string/load"
android:textSize="@dimen/text_size_large" />
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnExtract"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
@ -345,24 +295,9 @@
android:paddingBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent">
<android.support.v7.widget.AppCompatButton
android:id="@+id/btnDetails"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
android:layout_height="34dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:backgroundTint="@color/white"
android:drawableStart="@drawable/ic_settings_black_24dp"
android:elevation="15dp"
android:fontFamily="@font/saira_condensed_bold"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="@string/details"
android:textColor="@color/primary_dark" />
<include layout="@layout/layout_btn_details" />
<android.support.v7.widget.AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnNewScan"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
@ -381,4 +316,4 @@
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -10,7 +10,7 @@
tools:ignore="contentDescription"
tools:showIn="@layout/activity_verify_card">
<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/srlVerifyCard"
android:layout_width="match_parent"
android:layout_height="0dp"
@ -100,7 +100,7 @@
</LinearLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -136,7 +136,7 @@
android:src="@drawable/tangem_logo_small_new"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
@ -554,7 +554,7 @@
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<RelativeLayout
android:id="@+id/rlToolButtons1"
@ -606,7 +606,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<android.support.design.widget.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -626,4 +626,4 @@
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/btnDetails"
style="@style/AppTheme.RoundedCornerMaterialButton"
android:layout_width="0dp"
android:layout_height="34dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:backgroundTint="@color/white"
android:drawableStart="@drawable/ic_settings_black_24dp"
android:elevation="15dp"
android:fontFamily="@font/saira_condensed_bold"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="@string/details"
android:textColor="@color/primary_dark"
tools:showIn="@layout/fr_loaded_wallet" />

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/loCard"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxHeight="200dp"
android:padding="3dp"
app:layout_constraintHeight_max="200dp"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="contentDescription"
tools:showIn="@layout/fr_loaded_wallet">
<ImageView
android:id="@+id/ivTangemCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:src="@drawable/card_default" />
<RelativeLayout
android:id="@+id/rlProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:elevation="3dp"
android:padding="5dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.75"
android:background="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:alpha="1"
android:fontFamily="@font/maaxmedium"
android:text="@string/verifying"
android:textColor="@color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
<ProgressBar
android:layout_width="@dimen/size_progress_bar_big"
android:layout_height="@dimen/size_progress_bar_big"
android:layout_centerInParent="true"
android:alpha="1"
android:elevation="1dp"
android:progressTint="@color/colorPrimary" />
</RelativeLayout>
</RelativeLayout>

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="400dp"
android:layout_height="250dp"
android:gravity="center_vertical|center_horizontal"
tools:ignore="contentDescription"
tools:showIn="@layout/activity_main">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="100dp"
android:elevation="2dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/imSmartphone"
android:layout_width="75dp"
android:layout_height="150dp"
app:srcCompat="@drawable/smartphone" />
</LinearLayout>
<LinearLayout
android:id="@+id/llNfc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="100dp"
android:elevation="1dp"
android:gravity="center"
android:orientation="vertical">
<com.skyfishjy.library.RippleBackground
android:id="@+id/rippleBackgroundNfc"
android:layout_width="150dp"
android:layout_height="150dp"
app:rb_color="@color/fab"
app:rb_duration="3000"
app:rb_radius="16dp"
app:rb_rippleAmount="4"
app:rb_scale="4"
app:rb_strokeWidth="8dp"
app:rb_type="strokeRipple" />
</LinearLayout>
<LinearLayout
android:id="@+id/llHand"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:elevation="0dp"
android:gravity="center_vertical"
android:orientation="vertical">
<ImageView
android:id="@+id/ivHandCardHorizontal"
android:layout_width="190dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/hand_card_horizontal" />
<ImageView
android:id="@+id/ivHandCardVertical"
android:layout_width="190dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/hand_card_vertical" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rlProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:elevation="10dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.75"
android:background="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:alpha="1"
android:text="@string/reading"
android:textColor="@color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
<ProgressBar
android:layout_width="@dimen/size_progress_bar_big"
android:layout_height="@dimen/size_progress_bar_big"
android:layout_centerInParent="true"
android:alpha="1"
android:elevation="1dp" />
</RelativeLayout>
</RelativeLayout>

View file

@ -1,4 +1,4 @@
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
@ -7,4 +7,4 @@
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>

View file

@ -21,6 +21,7 @@
<dimen name="text_size_small">13sp</dimen>
<dimen name="text_size_1_small">15sp</dimen>
<dimen name="text_size_medium">19sp</dimen>
<dimen name="text_size_1_large">23sp</dimen>
<dimen name="text_size_large">26sp</dimen>
<dimen name="text_size_pin">34sp</dimen>

View file

@ -35,7 +35,7 @@
<string name="last_withdrawal">Last withdrawal</string>
<string name="try_to_scan_again">Try to scan again</string>
<string name="cannot_erase_wallet_with_non_zero_balance">Cannot erase wallet with non-zero balance</string>
<string name="send_payment">Send payment</string>
<string name="send_transaction">Send payment</string>
<string name="from_banknote">From banknote</string>
<string name="on_banknote">on banknote</string>
<string name="with_balance">with balance</string>
@ -49,6 +49,15 @@
<string name="reading">READING…</string>
<string name="verifying">VERIFYING…</string>
<string name="debug_settings">Дебаг</string>
<string name="select_loading_method">Select loading method</string>
<string name="via_cryptonit">via CRYPTONIT</string>
<string name="via_cryptonit2">via CRYPTONIT2</string>
<string name="via_kraken">via KRAKEN</string>
<string name="in_app">Another wallet app</string>
<string name="load_via_share_address">Share address</string>
<string name="load_via_qr">Show QR-code</string>
<string name="show_wallet_qr_code">LOAD</string>
<string name="beta">BETA</string>
<!-- dialogs -->
<string name="device_is_rooted">Your Android device is rooted. Security at risk!</string>
@ -62,14 +71,6 @@
<string name="please_hold_banknote">Please hold the banknote firmly\n until the operation is completed…</string>
<string name="you_may_be_required_to_repeat">You may be required to repeat this operation a few times depending on the NFC performance of your smartphone.\n This is made for safety of your funds.</string>
<string name="select_loading_method">Select loading method</string>
<string name="via_cryptonit">via CRYPTONIT</string>
<string name="via_cryptonit2">via CRYPTONIT2</string>
<string name="via_kraken">via KRAKEN</string>
<string name="in_app">Another wallet app</string>
<string name="load_via_share_address">Share address</string>
<string name="load_via_qr">Show QR-code</string>
<string name="show_wallet_qr_code">LOAD</string>
<!-- menu main -->
<string name="clean_up">Clean up</string>
<string name="manage_user_pin_1">Manage user PIN1…</string>
@ -128,19 +129,16 @@
<string name="new_scan">NEW SCAN</string>
<string name="verifying_in_blockchain">Verifying in blockchain…</string>
<!-- LogoActivity -->
<string name="beta">BETA</string>
<!-- CreateNewWalletActivity, PurgeActivity, SignPaymentActivity -->
<!-- CreateNewWalletActivity, PurgeActivity, SignTransactionActivity -->
<string name="now_touch_the_banknote_with_id">Now touch the banknote with ID</string>
<string name="to_create_the_wallet">to create the wallet</string>
<string name="to_erase_the_wallet">to erase the wallet</string>
<string name="to_sign_the_payment">to sign the payment</string>
<string name="to_sign_the_transaction">to sign the payment</string>
<string name="to_change_pin_codes">to change PIN/PIN2 codes</string>
<string name="by_tapping_the_card">By tapping the card, you will permanently remove the blockchain wallet. Ensure there will be no further incoming transactions</string>
<string name="cannot_erase_wallet">Cannot erase wallet. Make sure you enter correct PIN2!</string>
<!-- PreparePaymentActivity -->
<!-- PrepareTransactionActivity -->
<string name="enter_wallet_address">enter wallet address</string>
<string name="enter_amount">enter amount</string>
<string name="verify">Verify</string>
@ -164,15 +162,15 @@
<string name="cannot_sign_transaction_make_sure_you_enter_correct_pin_2">Cannot sign transaction. Make sure you enter correct PIN2!</string>
<string name="cannot_sign_transaction_wrong_amount">Amount and fee exceed total wallet balance!</string>
<!-- PreparePaymentActivity -->
<!-- PrepareTransactionActivity -->
<string name="not_enough_funds_on_your_card">Not enough funds</string>
<string name="unknown_amount_format">Unknown amount format</string>
<string name="incorrect_destination_wallet_address">Incorrect destination wallet address</string>
<string name="destination_wallet_address_equal_source_address">Destination wallet address equal source address</string>
<!-- ConfirmPaymentActivity -->
<!-- ConfirmTransactionActivity -->
<string name="target_wallet_address">target wallet address</string>
<string name="payment_amount">payment amount</string>
<string name="transaction_amount">payment amount</string>
<string name="fee">Fee</string>
<string name="send_1">Send</string>
<string name="minimal">Minimal</string>
@ -191,8 +189,9 @@
<string name="please_wait_for_confirmation_of_incoming_transaction">Please wait for confirmation of incoming transaction</string>
<string name="not_enough_eth_for_fee">Not enough ETH funds for fee</string>
<string name="not_enough_rbtc_for_fee">Not enough RBTC funds for fee</string>
<string name="pin_2_is_required_to_sign_the_payment">PIN2 is required to sign the payment</string>
<string name="pin_2_is_required_to_sign_the_transaction">PIN2 is required to sign the payment</string>
<string name="not_enough_funds">Not enough funds</string>
<string name="service_unavailable">Service unavailable</string>
<!-- EmptyWalletActivity -->
<string name="wallet_has_not_been_yet_created">Wallet hasn\'t been yet created</string>
@ -257,4 +256,5 @@
<string name="kraken_not_enough_account_data">Please enter account data</string>
<string name="kraken_request_balance">Get balance</string>
<string name="kraken_request_withdrawal">Withdrawal</string>
</resources>

View file

@ -1,11 +1,11 @@
buildscript {
ext.kotlin_version = '1.3.11'
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

View file

@ -11,4 +11,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.daemon=true
android.useAndroidX=true
android.enableJetifier=true

View file

@ -1,6 +1,6 @@
#Tue Sep 25 21:50:16 MSK 2018
#Fri Jan 18 12:06:47 MSK 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

Binary file not shown.

View file

@ -0,0 +1,29 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>

21
tangemcard-android/.idea/gradle.xml generated Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$/.." />
<option value="$PROJECT_DIR$/../app" />
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/../tangemcard-common" />
<option value="$PROJECT_DIR$/../tangemserver-android" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View file

@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="Gradle: android.arch.core:common:1.1.1@jar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.core/common/1.1.1/e55b70d1f5620db124b3e85a7f4bdc7bd48d9f95/common-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.core/common/1.1.1/ae9b923fc99c1fc5a7a9b6cedc6df8b2b8529c54/common-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="Gradle: android.arch.core:runtime-1.1.1">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/runtime-1.1.1.aar/4a1059a106c916ccb5b71904416088f8/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/runtime-1.1.1.aar/4a1059a106c916ccb5b71904416088f8/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.core/runtime/1.1.1/25df553df10af32bede9dd768a2d15299543d84/runtime-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="Gradle: android.arch.lifecycle:common:1.1.1@jar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common/1.1.1/207a6efae6a3555e326de41f76bdadd9a239cbce/common-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common/1.1.1/bcdaa509a856d1430e736b102f899aa9870a8f83/common-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="Gradle: android.arch.lifecycle:livedata-1.1.1">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/livedata-1.1.1.aar/a494498292d08adc6a120fde351f25d6/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/livedata-1.1.1.aar/a494498292d08adc6a120fde351f25d6/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/livedata/1.1.1/bf27acaa4953c98cd519756ed7b7caacf94407d4/livedata-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="Gradle: android.arch.lifecycle:livedata-core-1.1.1">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/livedata-core-1.1.1.aar/cfeb39be0c5aff1228106664eb420061/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/livedata-core-1.1.1.aar/cfeb39be0c5aff1228106664eb420061/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/livedata-core/1.1.1/c38818e006ea7a408c05e3090364332d46494ef/livedata-core-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="Gradle: android.arch.lifecycle:runtime-1.1.1">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/runtime-1.1.1.aar/d8218a8462b74d6031faa56aa9d22e91/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/runtime-1.1.1.aar/d8218a8462b74d6031faa56aa9d22e91/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/runtime/1.1.1/8e4214221b3797b863dc9998d16abb4af043e784/runtime-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="Gradle: android.arch.lifecycle:viewmodel-1.1.1">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/viewmodel-1.1.1.aar/ea100be61f7d27ef3349511f13a0f0bf/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/viewmodel-1.1.1.aar/ea100be61f7d27ef3349511f13a0f0bf/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/viewmodel/1.1.1/d1cc8e805317f171be63c68341f499acda7e42d6/viewmodel-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="Gradle: com.android.support:animated-vector-drawable-28.0.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/animated-vector-drawable-28.0.0.aar/8f021354f4feecdb64026aee215b995c/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/animated-vector-drawable-28.0.0.aar/8f021354f4feecdb64026aee215b995c/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Gradle: com.android.support:appcompat-v7-28.0.0">
<ANNOTATIONS>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0.aar/b6b1fb8b18c597bf8a0aa01655587d15/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0.aar/b6b1fb8b18c597bf8a0aa01655587d15/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0.aar/b6b1fb8b18c597bf8a0aa01655587d15/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="Gradle: com.android.support:asynclayoutinflater-28.0.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/asynclayoutinflater-28.0.0.aar/f704b223c2a72ff8c1289b62b5899b36/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/asynclayoutinflater-28.0.0.aar/f704b223c2a72ff8c1289b62b5899b36/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="Gradle: com.android.support:cardview-v7-28.0.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/cardview-v7-28.0.0.aar/1ab213ed61bebc93f4bce5694beb7e04/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/cardview-v7-28.0.0.aar/1ab213ed61bebc93f4bce5694beb7e04/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="Gradle: com.android.support:collections:28.0.0@jar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.support/collections/28.0.0/c1bcdade4d3cc2836130424a3f3e4182c666a745/collections-28.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="Gradle: com.android.support.constraint:constraint-layout-1.1.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/constraint-layout-1.1.3.aar/2c258ec118e73f60320226cbc662ad4f/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/constraint-layout-1.1.3.aar/2c258ec118e73f60320226cbc662ad4f/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.3@jar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.android.support.constraint/constraint-layout-solver/1.1.3/bde0667d7414c16ed62d3cfe993cff7f9d732373/constraint-layout-solver-1.1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Gradle: com.android.support:coordinatorlayout-28.0.0">
<ANNOTATIONS>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/coordinatorlayout-28.0.0.aar/61d9005c2a53f1effea3f3da9469b8ea/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/coordinatorlayout-28.0.0.aar/61d9005c2a53f1effea3f3da9469b8ea/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/coordinatorlayout-28.0.0.aar/61d9005c2a53f1effea3f3da9469b8ea/res" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

Some files were not shown because too many files have changed in this diff Show more