mirror of
https://github.com/m2049r/xmrwallet
synced 2025-09-06 02:27:11 +02:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ca19f32f8f | ||
![]() |
4431d74051 | ||
![]() |
f00da6ecda | ||
![]() |
1cecd0b718 | ||
![]() |
a0d6117bbb | ||
![]() |
0b0648a172 | ||
![]() |
775dcf01ae | ||
![]() |
aed4051d44 | ||
![]() |
a586c0781a | ||
![]() |
616d93cb18 | ||
![]() |
73d9cb6d58 | ||
![]() |
9846e8b5cf | ||
![]() |
aa66a12dac | ||
![]() |
65ce9b0889 | ||
![]() |
291e311b8a | ||
![]() |
41290f51fd | ||
![]() |
a11c898e2c | ||
![]() |
9c921183ab | ||
![]() |
b978396a38 | ||
![]() |
c6aa04e986 | ||
![]() |
6c17b8bd87 | ||
![]() |
835a35c6a8 | ||
![]() |
cac32f660c | ||
![]() |
8e70004bf2 | ||
![]() |
c3a466c392 | ||
![]() |
e076c19e3e | ||
![]() |
35b717756d | ||
![]() |
c14486306e | ||
![]() |
c2ef25c377 | ||
![]() |
b7164ef200 | ||
![]() |
f94a366d51 | ||
![]() |
286a04b5ef |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,3 +14,4 @@
|
|||||||
/app/prodMainnet
|
/app/prodMainnet
|
||||||
/app/alphaStagenet
|
/app/alphaStagenet
|
||||||
/app/prodStagenet
|
/app/prodStagenet
|
||||||
|
/app/.cxx
|
||||||
|
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
buildToolsVersion '28.0.3'
|
buildToolsVersion '29.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 196
|
versionCode 303
|
||||||
versionName "1.12.6 'Caerbannog'"
|
versionName "1.13.3 'ReStart'"
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
|
@@ -785,7 +785,7 @@ Java_com_m2049r_xmrwallet_model_Wallet_getDaemonBlockChainTargetHeight(JNIEnv *e
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_com_m2049r_xmrwallet_model_Wallet_isSynchronized(JNIEnv *env, jobject instance) {
|
Java_com_m2049r_xmrwallet_model_Wallet_isSynchronizedJ(JNIEnv *env, jobject instance) {
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
return static_cast<jboolean>(wallet->synchronized());
|
return static_cast<jboolean>(wallet->synchronized());
|
||||||
}
|
}
|
||||||
@@ -909,6 +909,16 @@ Java_com_m2049r_xmrwallet_model_Wallet_refreshAsync(JNIEnv *env, jobject instanc
|
|||||||
wallet->refreshAsync();
|
wallet->refreshAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO virtual bool rescanBlockchain() = 0;
|
||||||
|
|
||||||
|
//virtual void rescanBlockchainAsync() = 0;
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_m2049r_xmrwallet_model_Wallet_rescanBlockchainAsync(JNIEnv *env, jobject instance) {
|
||||||
|
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
||||||
|
wallet->rescanBlockchainAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
|
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
|
||||||
//TODO virtual int autoRefreshInterval() const = 0;
|
//TODO virtual int autoRefreshInterval() const = 0;
|
||||||
|
|
||||||
|
@@ -438,7 +438,7 @@ public class GenerateFragment extends Fragment {
|
|||||||
height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight));
|
height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight));
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
}
|
}
|
||||||
if (height <= 0)
|
if ((height <= 0) && (restoreHeight.length() == 8))
|
||||||
try {
|
try {
|
||||||
// is it a date without dashes?
|
// is it a date without dashes?
|
||||||
SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd");
|
SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
@@ -217,6 +217,20 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
releaseWakeLock();
|
releaseWakeLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onWalletRescan() {
|
||||||
|
try {
|
||||||
|
final WalletFragment walletFragment = (WalletFragment)
|
||||||
|
getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName());
|
||||||
|
getWallet().rescanBlockchainAsync();
|
||||||
|
synced = false;
|
||||||
|
walletFragment.unsync();
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
} catch (ClassCastException ex) {
|
||||||
|
Timber.d(ex.getLocalizedMessage());
|
||||||
|
// keep calm and carry on
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
Timber.d("onStop()");
|
Timber.d("onStop()");
|
||||||
@@ -243,7 +257,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
MenuItem renameItem = menu.findItem(R.id.action_rename);
|
MenuItem renameItem = menu.findItem(R.id.action_rename);
|
||||||
if (renameItem != null)
|
if (renameItem != null)
|
||||||
renameItem.setVisible(hasWallet() && getWallet().isSynchronized());
|
renameItem.setEnabled(hasWallet() && getWallet().isSynchronized());
|
||||||
MenuItem streetmodeItem = menu.findItem(R.id.action_streetmode);
|
MenuItem streetmodeItem = menu.findItem(R.id.action_streetmode);
|
||||||
if (streetmodeItem != null)
|
if (streetmodeItem != null)
|
||||||
if (isStreetMode()) {
|
if (isStreetMode()) {
|
||||||
@@ -251,12 +265,18 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
} else {
|
} else {
|
||||||
streetmodeItem.setIcon(R.drawable.gunther_24dp);
|
streetmodeItem.setIcon(R.drawable.gunther_24dp);
|
||||||
}
|
}
|
||||||
|
final MenuItem rescanItem = menu.findItem(R.id.action_rescan);
|
||||||
|
if (rescanItem != null)
|
||||||
|
rescanItem.setEnabled(isSynced());
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_rescan:
|
||||||
|
onWalletRescan();
|
||||||
|
return true;
|
||||||
case R.id.action_info:
|
case R.id.action_info:
|
||||||
onWalletDetails();
|
onWalletDetails();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -50,6 +50,7 @@ import com.m2049r.xmrwallet.widget.Toolbar;
|
|||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
@@ -112,9 +113,12 @@ public class WalletFragment extends Fragment
|
|||||||
ivSynced = view.findViewById(R.id.ivSynced);
|
ivSynced = view.findViewById(R.id.ivSynced);
|
||||||
|
|
||||||
sCurrency = view.findViewById(R.id.sCurrency);
|
sCurrency = view.findViewById(R.id.sCurrency);
|
||||||
ArrayAdapter currencyAdapter = ArrayAdapter.createFromResource(getContext(), R.array.currency, R.layout.item_spinner_balance);
|
List<String> currencies = new ArrayList<>();
|
||||||
currencyAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown_item);
|
currencies.add(Helper.BASE_CRYPTO);
|
||||||
sCurrency.setAdapter(currencyAdapter);
|
currencies.addAll(Arrays.asList(getResources().getStringArray(R.array.currency)));
|
||||||
|
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_balance, currencies);
|
||||||
|
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
sCurrency.setAdapter(spinnerAdapter);
|
||||||
|
|
||||||
bSend = view.findViewById(R.id.bSend);
|
bSend = view.findViewById(R.id.bSend);
|
||||||
bReceive = view.findViewById(R.id.bReceive);
|
bReceive = view.findViewById(R.id.bReceive);
|
||||||
@@ -352,6 +356,15 @@ public class WalletFragment extends Fragment
|
|||||||
if (isVisible()) enableAccountsList(true); //otherwise it is enabled in onResume()
|
if (isVisible()) enableAccountsList(true); //otherwise it is enabled in onResume()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unsync() {
|
||||||
|
if (!activityCallback.isWatchOnly()) {
|
||||||
|
bSend.setVisibility(View.INVISIBLE);
|
||||||
|
bSend.setEnabled(false);
|
||||||
|
}
|
||||||
|
if (isVisible()) enableAccountsList(false); //otherwise it is enabled in onResume()
|
||||||
|
firstBlock = 0;
|
||||||
|
}
|
||||||
|
|
||||||
boolean walletLoaded = false;
|
boolean walletLoaded = false;
|
||||||
|
|
||||||
public void onLoaded() {
|
public void onLoaded() {
|
||||||
|
@@ -59,42 +59,36 @@ public class BarcodeData {
|
|||||||
final public Asset asset;
|
final public Asset asset;
|
||||||
final public String address;
|
final public String address;
|
||||||
final public String addressName;
|
final public String addressName;
|
||||||
final public String paymentId;
|
|
||||||
final public String amount;
|
final public String amount;
|
||||||
final public String description;
|
final public String description;
|
||||||
final public Security security;
|
final public Security security;
|
||||||
final public String bip70;
|
final public String bip70;
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address) {
|
public BarcodeData(Asset asset, String address) {
|
||||||
this(asset, address, null, null, null, null, Security.NORMAL);
|
this(asset, address, null, null, null, Security.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String amount) {
|
public BarcodeData(Asset asset, String address, String amount) {
|
||||||
this(asset, address, null, null, null, amount, Security.NORMAL);
|
this(asset, address, null, null, amount, Security.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String amount, String description, Security security) {
|
public BarcodeData(Asset asset, String address, String amount, String description, Security security) {
|
||||||
this(asset, address, null, null, description, amount, security);
|
this(asset, address, null, description, amount, security);
|
||||||
}
|
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String paymentId, String amount) {
|
|
||||||
this(asset, address, null, paymentId, null, amount, Security.NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String paymentId, String description, String amount) {
|
public BarcodeData(Asset asset, String address, String paymentId, String description, String amount) {
|
||||||
this(asset, address, null, paymentId, description, amount, Security.NORMAL);
|
this(asset, address, null, description, amount, Security.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String addressName, String paymentId, String description, String amount, Security security) {
|
public BarcodeData(Asset asset, String address, String addressName, String description, String amount, Security security) {
|
||||||
this(asset, address, addressName, null, paymentId, description, amount, security);
|
this(asset, address, addressName, null, description, amount, security);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String addressName, String bip70, String paymentId, String description, String amount, Security security) {
|
public BarcodeData(Asset asset, String address, String addressName, String bip70, String description, String amount, Security security) {
|
||||||
this.asset = asset;
|
this.asset = asset;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.bip70 = bip70;
|
this.bip70 = bip70;
|
||||||
this.addressName = addressName;
|
this.addressName = addressName;
|
||||||
this.paymentId = paymentId;
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.security = security;
|
this.security = security;
|
||||||
@@ -110,11 +104,6 @@ public class BarcodeData {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(BarcodeData.XMR_SCHEME).append(address);
|
sb.append(BarcodeData.XMR_SCHEME).append(address);
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
if ((paymentId != null) && !paymentId.isEmpty()) {
|
|
||||||
sb.append("?");
|
|
||||||
first = false;
|
|
||||||
sb.append(BarcodeData.XMR_PAYMENTID).append('=').append(paymentId);
|
|
||||||
}
|
|
||||||
if ((description != null) && !description.isEmpty()) {
|
if ((description != null) && !description.isEmpty()) {
|
||||||
sb.append(first ? "?" : "&");
|
sb.append(first ? "?" : "&");
|
||||||
first = false;
|
first = false;
|
||||||
@@ -185,8 +174,11 @@ public class BarcodeData {
|
|||||||
String address = monero.getPath();
|
String address = monero.getPath();
|
||||||
|
|
||||||
String paymentId = parms.get(XMR_PAYMENTID);
|
String paymentId = parms.get(XMR_PAYMENTID);
|
||||||
// deal with empty payment_id created by non-spec-conforming apps
|
// no support for payment ids!
|
||||||
if ((paymentId != null) && paymentId.isEmpty()) paymentId = null;
|
if (paymentId != null) {
|
||||||
|
Timber.e("no support for payment ids!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String description = parms.get(XMR_DESCRIPTION);
|
String description = parms.get(XMR_DESCRIPTION);
|
||||||
String amount = parms.get(XMR_AMOUNT);
|
String amount = parms.get(XMR_AMOUNT);
|
||||||
@@ -198,10 +190,6 @@ public class BarcodeData {
|
|||||||
return null; // we have an amount but its not a number!
|
return null; // we have an amount but its not a number!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((paymentId != null) && !Wallet.isPaymentIdValid(paymentId)) {
|
|
||||||
Timber.d("paymentId invalid");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Wallet.isAddressValid(address)) {
|
if (!Wallet.isAddressValid(address)) {
|
||||||
Timber.d("address invalid");
|
Timber.d("address invalid");
|
||||||
@@ -267,7 +255,7 @@ public class BarcodeData {
|
|||||||
Timber.d("[%s] is not http url", bip70);
|
Timber.d("[%s] is not http url", bip70);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new BarcodeData(BarcodeData.Asset.BTC, null, null, bip70, null, description, null, Security.NORMAL);
|
return new BarcodeData(BarcodeData.Asset.BTC, null, null, bip70, description, null, Security.NORMAL);
|
||||||
}
|
}
|
||||||
if (!BitcoinAddressValidator.validate(address)) {
|
if (!BitcoinAddressValidator.validate(address)) {
|
||||||
Timber.d("BTC address (%s) invalid", address);
|
Timber.d("BTC address (%s) invalid", address);
|
||||||
|
@@ -29,19 +29,16 @@ public class TxData implements Parcelable {
|
|||||||
|
|
||||||
public TxData(TxData txData) {
|
public TxData(TxData txData) {
|
||||||
this.dstAddr = txData.dstAddr;
|
this.dstAddr = txData.dstAddr;
|
||||||
this.paymentId = txData.paymentId;
|
|
||||||
this.amount = txData.amount;
|
this.amount = txData.amount;
|
||||||
this.mixin = txData.mixin;
|
this.mixin = txData.mixin;
|
||||||
this.priority = txData.priority;
|
this.priority = txData.priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TxData(String dstAddr,
|
public TxData(String dstAddr,
|
||||||
String paymentId,
|
|
||||||
long amount,
|
long amount,
|
||||||
int mixin,
|
int mixin,
|
||||||
PendingTransaction.Priority priority) {
|
PendingTransaction.Priority priority) {
|
||||||
this.dstAddr = dstAddr;
|
this.dstAddr = dstAddr;
|
||||||
this.paymentId = paymentId;
|
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.mixin = mixin;
|
this.mixin = mixin;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
@@ -51,10 +48,6 @@ public class TxData implements Parcelable {
|
|||||||
return dstAddr;
|
return dstAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPaymentId() {
|
|
||||||
return paymentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getAmount() {
|
public long getAmount() {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
@@ -71,10 +64,6 @@ public class TxData implements Parcelable {
|
|||||||
this.dstAddr = dstAddr;
|
this.dstAddr = dstAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPaymentId(String paymentId) {
|
|
||||||
this.paymentId = paymentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAmount(long amount) {
|
public void setAmount(long amount) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
@@ -96,7 +85,6 @@ public class TxData implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String dstAddr;
|
private String dstAddr;
|
||||||
private String paymentId;
|
|
||||||
private long amount;
|
private long amount;
|
||||||
private int mixin;
|
private int mixin;
|
||||||
private PendingTransaction.Priority priority;
|
private PendingTransaction.Priority priority;
|
||||||
@@ -106,7 +94,6 @@ public class TxData implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel out, int flags) {
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
out.writeString(dstAddr);
|
out.writeString(dstAddr);
|
||||||
out.writeString(paymentId);
|
|
||||||
out.writeLong(amount);
|
out.writeLong(amount);
|
||||||
out.writeInt(mixin);
|
out.writeInt(mixin);
|
||||||
out.writeInt(priority.getValue());
|
out.writeInt(priority.getValue());
|
||||||
@@ -125,7 +112,6 @@ public class TxData implements Parcelable {
|
|||||||
|
|
||||||
protected TxData(Parcel in) {
|
protected TxData(Parcel in) {
|
||||||
dstAddr = in.readString();
|
dstAddr = in.readString();
|
||||||
paymentId = in.readString();
|
|
||||||
amount = in.readLong();
|
amount = in.readLong();
|
||||||
mixin = in.readInt();
|
mixin = in.readInt();
|
||||||
priority = PendingTransaction.Priority.fromInteger(in.readInt());
|
priority = PendingTransaction.Priority.fromInteger(in.readInt());
|
||||||
@@ -142,14 +128,12 @@ public class TxData implements Parcelable {
|
|||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("dstAddr:");
|
sb.append("dstAddr:");
|
||||||
sb.append(dstAddr);
|
sb.append(dstAddr);
|
||||||
sb.append(",paymentId:");
|
|
||||||
sb.append(paymentId);
|
|
||||||
sb.append(",amount:");
|
sb.append(",amount:");
|
||||||
sb.append(amount);
|
sb.append(amount);
|
||||||
sb.append(",mixin:");
|
sb.append(",mixin:");
|
||||||
sb.append(mixin);
|
sb.append(mixin);
|
||||||
sb.append(",priority:");
|
sb.append(",priority:");
|
||||||
sb.append(String.valueOf(priority));
|
sb.append(priority);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -86,12 +85,9 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
|
|
||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
private TextInputLayout etAddress;
|
private TextInputLayout etAddress;
|
||||||
private TextInputLayout etPaymentId;
|
|
||||||
private TextInputLayout etNotes;
|
private TextInputLayout etNotes;
|
||||||
private Button bPaymentId;
|
|
||||||
private CardView cvScan;
|
private CardView cvScan;
|
||||||
private View tvPaymentIdIntegrated;
|
private View tvPaymentIdIntegrated;
|
||||||
private View llPaymentId;
|
|
||||||
private TextView tvXmrTo;
|
private TextView tvXmrTo;
|
||||||
private View llXmrTo;
|
private View llXmrTo;
|
||||||
private ImageButton bPasteAddress;
|
private ImageButton bPasteAddress;
|
||||||
@@ -114,7 +110,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
View view = inflater.inflate(R.layout.fragment_send_address, container, false);
|
View view = inflater.inflate(R.layout.fragment_send_address, container, false);
|
||||||
|
|
||||||
tvPaymentIdIntegrated = view.findViewById(R.id.tvPaymentIdIntegrated);
|
tvPaymentIdIntegrated = view.findViewById(R.id.tvPaymentIdIntegrated);
|
||||||
llPaymentId = view.findViewById(R.id.llPaymentId);
|
|
||||||
llXmrTo = view.findViewById(R.id.llXmrTo);
|
llXmrTo = view.findViewById(R.id.llXmrTo);
|
||||||
tvXmrTo = view.findViewById(R.id.tvXmrTo);
|
tvXmrTo = view.findViewById(R.id.tvXmrTo);
|
||||||
tvXmrTo.setText(Html.fromHtml(getString(R.string.info_xmrto)));
|
tvXmrTo.setText(Html.fromHtml(getString(R.string.info_xmrto)));
|
||||||
@@ -158,8 +153,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
etAddress.setError(null);
|
etAddress.setError(null);
|
||||||
if (isIntegratedAddress()) {
|
if (isIntegratedAddress()) {
|
||||||
Timber.d("isIntegratedAddress");
|
Timber.d("isIntegratedAddress");
|
||||||
etPaymentId.getEditText().getText().clear();
|
|
||||||
llPaymentId.setVisibility(View.INVISIBLE);
|
|
||||||
etAddress.setError(getString(R.string.info_paymentid_integrated));
|
etAddress.setError(getString(R.string.info_paymentid_integrated));
|
||||||
tvPaymentIdIntegrated.setVisibility(View.VISIBLE);
|
tvPaymentIdIntegrated.setVisibility(View.VISIBLE);
|
||||||
llXmrTo.setVisibility(View.INVISIBLE);
|
llXmrTo.setVisibility(View.INVISIBLE);
|
||||||
@@ -169,7 +162,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
setBtcMode();
|
setBtcMode();
|
||||||
} else {
|
} else {
|
||||||
Timber.d("isStandardAddress or other");
|
Timber.d("isStandardAddress or other");
|
||||||
llPaymentId.setVisibility(View.VISIBLE);
|
|
||||||
tvPaymentIdIntegrated.setVisibility(View.INVISIBLE);
|
tvPaymentIdIntegrated.setVisibility(View.INVISIBLE);
|
||||||
llXmrTo.setVisibility(View.INVISIBLE);
|
llXmrTo.setVisibility(View.INVISIBLE);
|
||||||
sendListener.setMode(SendFragment.Mode.XMR);
|
sendListener.setMode(SendFragment.Mode.XMR);
|
||||||
@@ -211,46 +203,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
etPaymentId = view.findViewById(R.id.etPaymentId);
|
|
||||||
etPaymentId.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
|
||||||
etPaymentId.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
|
||||||
|| (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
|
||||||
if (checkPaymentId()) {
|
|
||||||
etNotes.requestFocus();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
etPaymentId.getEditText().addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable editable) {
|
|
||||||
etPaymentId.setError(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bPaymentId = view.findViewById(R.id.bPaymentId);
|
|
||||||
bPaymentId.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
final EditText et = etPaymentId.getEditText();
|
|
||||||
et.setText((Wallet.generatePaymentId()));
|
|
||||||
et.setSelection(et.getText().length());
|
|
||||||
etPaymentId.requestFocus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
etNotes = view.findViewById(R.id.etNotes);
|
etNotes = view.findViewById(R.id.etNotes);
|
||||||
etNotes.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT);
|
etNotes.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT);
|
||||||
etNotes.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
etNotes.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
@@ -286,8 +238,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
|
|
||||||
private void setBtcMode() {
|
private void setBtcMode() {
|
||||||
Timber.d("setBtcMode");
|
Timber.d("setBtcMode");
|
||||||
etPaymentId.getEditText().getText().clear();
|
|
||||||
llPaymentId.setVisibility(View.INVISIBLE);
|
|
||||||
tvPaymentIdIntegrated.setVisibility(View.INVISIBLE);
|
tvPaymentIdIntegrated.setVisibility(View.INVISIBLE);
|
||||||
llXmrTo.setVisibility(View.VISIBLE);
|
llXmrTo.setVisibility(View.VISIBLE);
|
||||||
sendListener.setMode(SendFragment.Mode.BTC);
|
sendListener.setMode(SendFragment.Mode.BTC);
|
||||||
@@ -342,7 +292,7 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
|
|
||||||
final BarcodeData barcodeData =
|
final BarcodeData barcodeData =
|
||||||
new BarcodeData(BarcodeData.Asset.BTC, address, null,
|
new BarcodeData(BarcodeData.Asset.BTC, address, null,
|
||||||
resolvedBip70, null, null, String.valueOf(amount),
|
resolvedBip70, null, String.valueOf(amount),
|
||||||
BarcodeData.Security.BIP70);
|
BarcodeData.Security.BIP70);
|
||||||
etNotes.post(new Runnable() {
|
etNotes.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -403,22 +353,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
return BitcoinAddressValidator.validate(address);
|
return BitcoinAddressValidator.validate(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkPaymentId() {
|
|
||||||
String paymentId = etPaymentId.getEditText().getText().toString();
|
|
||||||
boolean ok = paymentId.isEmpty() || Wallet.isPaymentIdValid(paymentId);
|
|
||||||
if (!ok) {
|
|
||||||
etPaymentId.setError(getString(R.string.receive_paymentid_invalid));
|
|
||||||
} else {
|
|
||||||
if (!paymentId.isEmpty() && isIntegratedAddress()) {
|
|
||||||
ok = false;
|
|
||||||
etPaymentId.setError(getString(R.string.receive_integrated_paymentid_invalid));
|
|
||||||
} else {
|
|
||||||
etPaymentId.setError(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void shakeAddress() {
|
private void shakeAddress() {
|
||||||
etAddress.startAnimation(Helper.getShakeAnimation(getContext()));
|
etAddress.startAnimation(Helper.getShakeAnimation(getContext()));
|
||||||
}
|
}
|
||||||
@@ -441,11 +375,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkPaymentId()) {
|
|
||||||
etPaymentId.startAnimation(Helper.getShakeAnimation(getContext()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sendListener != null) {
|
if (sendListener != null) {
|
||||||
TxData txData = sendListener.getTxData();
|
TxData txData = sendListener.getTxData();
|
||||||
if (txData instanceof TxDataBtc) {
|
if (txData instanceof TxDataBtc) {
|
||||||
@@ -459,10 +388,8 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
((TxDataBtc) txData).setBip70(null);
|
((TxDataBtc) txData).setBip70(null);
|
||||||
}
|
}
|
||||||
txData.setDestinationAddress(null);
|
txData.setDestinationAddress(null);
|
||||||
txData.setPaymentId("");
|
|
||||||
} else {
|
} else {
|
||||||
txData.setDestinationAddress(etAddress.getEditText().getText().toString());
|
txData.setDestinationAddress(etAddress.getEditText().getText().toString());
|
||||||
txData.setPaymentId(etPaymentId.getEditText().getText().toString());
|
|
||||||
}
|
}
|
||||||
txData.setUserNotes(new UserNotes(etNotes.getEditText().getText().toString()));
|
txData.setUserNotes(new UserNotes(etNotes.getEditText().getText().toString()));
|
||||||
txData.setPriority(PendingTransaction.Priority.Priority_Default);
|
txData.setPriority(PendingTransaction.Priority.Priority_Default);
|
||||||
@@ -525,14 +452,6 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
etAddress.setError(null);
|
etAddress.setError(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
String scannedPaymentId = barcodeData.paymentId;
|
|
||||||
if (scannedPaymentId != null) {
|
|
||||||
etPaymentId.getEditText().setText(scannedPaymentId);
|
|
||||||
checkPaymentId();
|
|
||||||
} else {
|
|
||||||
etPaymentId.getEditText().getText().clear();
|
|
||||||
etPaymentId.setError(null);
|
|
||||||
}
|
|
||||||
String scannedNotes = barcodeData.description;
|
String scannedNotes = barcodeData.description;
|
||||||
if (scannedNotes != null) {
|
if (scannedNotes != null) {
|
||||||
etNotes.getEditText().setText(scannedNotes);
|
etNotes.getEditText().setText(scannedNotes);
|
||||||
|
@@ -457,8 +457,8 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||||||
}
|
}
|
||||||
showProgress(3, getString(R.string.label_send_progress_create_tx));
|
showProgress(3, getString(R.string.label_send_progress_create_tx));
|
||||||
TxData txData = sendListener.getTxData();
|
TxData txData = sendListener.getTxData();
|
||||||
txData.setDestinationAddress(xmrtoStatus.getXmrReceivingSubaddress());
|
txData.setDestinationAddress(xmrtoStatus.getReceivingSubaddress());
|
||||||
txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getXmrAmountTotal()));
|
txData.setAmount(Wallet.getAmountFromDouble(xmrtoStatus.getIncomingAmountTotal()));
|
||||||
getActivityCallback().onPrepareSend(xmrtoStatus.getUuid(), txData);
|
getActivityCallback().onPrepareSend(xmrtoStatus.getUuid(), txData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,22 +572,22 @@ public class SendBtcConfirmWizardFragment extends SendWizardFragment implements
|
|||||||
NumberFormat df = NumberFormat.getInstance(Locale.US);
|
NumberFormat df = NumberFormat.getInstance(Locale.US);
|
||||||
df.setMaximumFractionDigits(12);
|
df.setMaximumFractionDigits(12);
|
||||||
String btcAmount = df.format(status.getBtcAmount());
|
String btcAmount = df.format(status.getBtcAmount());
|
||||||
String xmrAmountTotal = df.format(status.getXmrAmountTotal());
|
String xmrAmountTotal = df.format(status.getIncomingAmountTotal());
|
||||||
tvTxBtcAmount.setText(getString(R.string.text_send_btc_amount, btcAmount, xmrAmountTotal));
|
tvTxBtcAmount.setText(getString(R.string.text_send_btc_amount, btcAmount, xmrAmountTotal));
|
||||||
String xmrPriceBtc = df.format(status.getXmrPriceBtc());
|
String xmrPriceBtc = df.format(status.getIncomingPriceBtc());
|
||||||
tvTxBtcRate.setText(getString(R.string.text_send_btc_rate, xmrPriceBtc));
|
tvTxBtcRate.setText(getString(R.string.text_send_btc_rate, xmrPriceBtc));
|
||||||
|
|
||||||
double calcRate = status.getBtcAmount() / status.getXmrPriceBtc();
|
double calcRate = status.getBtcAmount() / status.getIncomingPriceBtc();
|
||||||
Timber.i("Rates: %f / %f", calcRate, status.getXmrPriceBtc());
|
Timber.d("Rates: %f / %f", calcRate, status.getIncomingPriceBtc());
|
||||||
|
|
||||||
tvTxBtcAddress.setText(status.getBtcDestAddress()); // TODO test if this is different?
|
tvTxBtcAddress.setText(status.getBtcDestAddress()); // TODO test if this is different?
|
||||||
|
|
||||||
Timber.i("Expires @ %s, in %s seconds", status.getExpiresAt().toString(), status.getSecondsTillTimeout());
|
Timber.d("Expires @ %s, in %s seconds", status.getExpiresAt().toString(), status.getSecondsTillTimeout());
|
||||||
|
|
||||||
Timber.i("Status = %s", status.getState().toString());
|
Timber.d("Status = %s", status.getState().toString());
|
||||||
tvTxXmrToKey.setText(status.getUuid());
|
tvTxXmrToKey.setText(status.getUuid());
|
||||||
|
|
||||||
Timber.d("AmountRemaining=%f, XmrAmountTotal=%f", status.getXmrAmountRemaining(), status.getXmrAmountTotal());
|
Timber.d("AmountRemaining=%f, XmrAmountTotal=%f", status.getRemainingAmountIncoming(), status.getIncomingAmountTotal());
|
||||||
hideProgress();
|
hideProgress();
|
||||||
startSendTimer();
|
startSendTimer();
|
||||||
prepareSend();
|
prepareSend();
|
||||||
|
@@ -138,12 +138,6 @@ public class SendBtcSuccessWizardFragment extends SendWizardFragment {
|
|||||||
|
|
||||||
btcData = (TxDataBtc) sendListener.getTxData();
|
btcData = (TxDataBtc) sendListener.getTxData();
|
||||||
tvTxAddress.setText(btcData.getDestinationAddress());
|
tvTxAddress.setText(btcData.getDestinationAddress());
|
||||||
String paymentId = btcData.getPaymentId();
|
|
||||||
if ((paymentId != null) && (!paymentId.isEmpty())) {
|
|
||||||
tvTxPaymentId.setText(btcData.getPaymentId());
|
|
||||||
} else {
|
|
||||||
tvTxPaymentId.setText("-");
|
|
||||||
}
|
|
||||||
|
|
||||||
final PendingTx committedTx = sendListener.getCommittedTx();
|
final PendingTx committedTx = sendListener.getCommittedTx();
|
||||||
if (committedTx != null) {
|
if (committedTx != null) {
|
||||||
|
@@ -70,7 +70,6 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
|||||||
}
|
}
|
||||||
|
|
||||||
private TextView tvTxAddress;
|
private TextView tvTxAddress;
|
||||||
private TextView tvTxPaymentId;
|
|
||||||
private TextView tvTxNotes;
|
private TextView tvTxNotes;
|
||||||
private TextView tvTxAmount;
|
private TextView tvTxAmount;
|
||||||
private TextView tvTxFee;
|
private TextView tvTxFee;
|
||||||
@@ -90,7 +89,6 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
|||||||
R.layout.fragment_send_confirm, container, false);
|
R.layout.fragment_send_confirm, container, false);
|
||||||
|
|
||||||
tvTxAddress = view.findViewById(R.id.tvTxAddress);
|
tvTxAddress = view.findViewById(R.id.tvTxAddress);
|
||||||
tvTxPaymentId = view.findViewById(R.id.tvTxPaymentId);
|
|
||||||
tvTxNotes = view.findViewById(R.id.tvTxNotes);
|
tvTxNotes = view.findViewById(R.id.tvTxNotes);
|
||||||
tvTxAmount = view.findViewById(R.id.tvTxAmount);
|
tvTxAmount = view.findViewById(R.id.tvTxAmount);
|
||||||
tvTxFee = view.findViewById(R.id.tvTxFee);
|
tvTxFee = view.findViewById(R.id.tvTxFee);
|
||||||
@@ -192,12 +190,6 @@ public class SendConfirmWizardFragment extends SendWizardFragment implements Sen
|
|||||||
|
|
||||||
final TxData txData = sendListener.getTxData();
|
final TxData txData = sendListener.getTxData();
|
||||||
tvTxAddress.setText(txData.getDestinationAddress());
|
tvTxAddress.setText(txData.getDestinationAddress());
|
||||||
String paymentId = txData.getPaymentId();
|
|
||||||
if ((paymentId != null) && (!paymentId.isEmpty())) {
|
|
||||||
tvTxPaymentId.setText(txData.getPaymentId());
|
|
||||||
} else {
|
|
||||||
tvTxPaymentId.setText("-");
|
|
||||||
}
|
|
||||||
UserNotes notes = sendListener.getTxData().getUserNotes();
|
UserNotes notes = sendListener.getTxData().getUserNotes();
|
||||||
if ((notes != null) && (!notes.note.isEmpty())) {
|
if ((notes != null) && (!notes.note.isEmpty())) {
|
||||||
tvTxNotes.setText(notes.note);
|
tvTxNotes.setText(notes.note);
|
||||||
|
@@ -111,12 +111,6 @@ public class SendSuccessWizardFragment extends SendWizardFragment {
|
|||||||
|
|
||||||
final TxData txData = sendListener.getTxData();
|
final TxData txData = sendListener.getTxData();
|
||||||
tvTxAddress.setText(txData.getDestinationAddress());
|
tvTxAddress.setText(txData.getDestinationAddress());
|
||||||
String paymentId = txData.getPaymentId();
|
|
||||||
if ((paymentId != null) && (!paymentId.isEmpty())) {
|
|
||||||
tvTxPaymentId.setText(txData.getPaymentId());
|
|
||||||
} else {
|
|
||||||
tvTxPaymentId.setText("-");
|
|
||||||
}
|
|
||||||
|
|
||||||
final PendingTx committedTx = sendListener.getCommittedTx();
|
final PendingTx committedTx = sendListener.getCommittedTx();
|
||||||
if (committedTx != null) {
|
if (committedTx != null) {
|
||||||
|
@@ -130,9 +130,9 @@ public class NodeInfoAdapter extends RecyclerView.Adapter<NodeInfoAdapter.ViewHo
|
|||||||
|
|
||||||
private void showStar() {
|
private void showStar() {
|
||||||
if (nodeItem.isFavourite()) {
|
if (nodeItem.isFavourite()) {
|
||||||
ibBookmark.setImageResource(R.drawable.ic_bookmark_24dp);
|
ibBookmark.setImageResource(R.drawable.ic_favorite_24dp);
|
||||||
} else {
|
} else {
|
||||||
ibBookmark.setImageResource(R.drawable.ic_bookmark_border_24dp);
|
ibBookmark.setImageResource(R.drawable.ic_favorite_border_24dp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,12 +17,15 @@
|
|||||||
package com.m2049r.xmrwallet.ledger;
|
package com.m2049r.xmrwallet.ledger;
|
||||||
|
|
||||||
public enum Instruction {
|
public enum Instruction {
|
||||||
|
|
||||||
INS_NONE(0x00),
|
INS_NONE(0x00),
|
||||||
INS_RESET(0x02),
|
INS_RESET(0x02),
|
||||||
INS_GET_KEY(0x20),
|
INS_GET_KEY(0x20),
|
||||||
|
INS_DISPLAY_ADDRESS(0x21),
|
||||||
INS_PUT_KEY(0x22),
|
INS_PUT_KEY(0x22),
|
||||||
INS_GET_CHACHA8_PREKEY(0x24),
|
INS_GET_CHACHA8_PREKEY(0x24),
|
||||||
INS_VERIFY_KEY(0x26),
|
INS_VERIFY_KEY(0x26),
|
||||||
|
INS_MANAGE_SEEDWORDS(0x28),
|
||||||
|
|
||||||
INS_SECRET_KEY_TO_PUBLIC_KEY(0x30),
|
INS_SECRET_KEY_TO_PUBLIC_KEY(0x30),
|
||||||
INS_GEN_KEY_DERIVATION(0x32),
|
INS_GEN_KEY_DERIVATION(0x32),
|
||||||
@@ -30,6 +33,7 @@ public enum Instruction {
|
|||||||
INS_DERIVE_PUBLIC_KEY(0x36),
|
INS_DERIVE_PUBLIC_KEY(0x36),
|
||||||
INS_DERIVE_SECRET_KEY(0x38),
|
INS_DERIVE_SECRET_KEY(0x38),
|
||||||
INS_GEN_KEY_IMAGE(0x3A),
|
INS_GEN_KEY_IMAGE(0x3A),
|
||||||
|
|
||||||
INS_SECRET_KEY_ADD(0x3C),
|
INS_SECRET_KEY_ADD(0x3C),
|
||||||
INS_SECRET_KEY_SUB(0x3E),
|
INS_SECRET_KEY_SUB(0x3E),
|
||||||
INS_GENERATE_KEYPAIR(0x40),
|
INS_GENERATE_KEYPAIR(0x40),
|
||||||
@@ -45,15 +49,20 @@ public enum Instruction {
|
|||||||
INS_SET_SIGNATURE_MODE(0x72),
|
INS_SET_SIGNATURE_MODE(0x72),
|
||||||
INS_GET_ADDITIONAL_KEY(0x74),
|
INS_GET_ADDITIONAL_KEY(0x74),
|
||||||
INS_STEALTH(0x76),
|
INS_STEALTH(0x76),
|
||||||
|
INS_GEN_COMMITMENT_MASK(0x77),
|
||||||
INS_BLIND(0x78),
|
INS_BLIND(0x78),
|
||||||
INS_UNBLIND(0x7A),
|
INS_UNBLIND(0x7A),
|
||||||
|
INS_GEN_TXOUT_KEYS(0x7B),
|
||||||
INS_VALIDATE(0x7C),
|
INS_VALIDATE(0x7C),
|
||||||
|
INS_PREFIX_HASH(0x7D),
|
||||||
INS_MLSAG(0x7E),
|
INS_MLSAG(0x7E),
|
||||||
INS_CLOSE_TX(0x80),
|
INS_CLOSE_TX(0x80),
|
||||||
|
|
||||||
INS_GET_RESPONSE(0xc0),
|
INS_GET_TX_PROOF(0xA0),
|
||||||
|
|
||||||
INS_UNDEFINED(0xff);
|
INS_GET_RESPONSE(0xC0),
|
||||||
|
|
||||||
|
INS_UNDEFINED(0xFF);
|
||||||
|
|
||||||
public static Instruction fromByte(byte n) {
|
public static Instruction fromByte(byte n) {
|
||||||
switch (n & 0xFF) {
|
switch (n & 0xFF) {
|
||||||
|
@@ -42,11 +42,11 @@ public class Ledger {
|
|||||||
static public final int LOOKAHEAD_SUBADDRESSES = 20;
|
static public final int LOOKAHEAD_SUBADDRESSES = 20;
|
||||||
static public final String SUBADDRESS_LOOKAHEAD = LOOKAHEAD_ACCOUNTS + ":" + LOOKAHEAD_SUBADDRESSES;
|
static public final String SUBADDRESS_LOOKAHEAD = LOOKAHEAD_ACCOUNTS + ":" + LOOKAHEAD_SUBADDRESSES;
|
||||||
|
|
||||||
private static final byte PROTOCOL_VERSION = 0x02;
|
private static final byte PROTOCOL_VERSION = 0x03;
|
||||||
public static final int SW_OK = 0x9000;
|
public static final int SW_OK = 0x9000;
|
||||||
public static final int SW_INS_NOT_SUPPORTED = 0x6D00;
|
public static final int SW_INS_NOT_SUPPORTED = 0x6D00;
|
||||||
public static final int OK[] = {SW_OK};
|
public static final int OK[] = {SW_OK};
|
||||||
public static final int MINIMUM_LEDGER_VERSION = (1 << 16) + (3 << 8) + (1); // 1.3.1
|
public static final int MINIMUM_LEDGER_VERSION = (1 << 16) + (6 << 8) + (0); // 1.6.0
|
||||||
|
|
||||||
public static UsbDevice findDevice(UsbManager usbManager) {
|
public static UsbDevice findDevice(UsbManager usbManager) {
|
||||||
if (!ENABLED) return null;
|
if (!ENABLED) return null;
|
||||||
|
@@ -51,6 +51,7 @@ public class LedgerProgressDialog extends ProgressDialog implements Ledger.Liste
|
|||||||
switch (ins) {
|
switch (ins) {
|
||||||
case INS_RESET: // ledger may ask for confirmation - maybe a bug?
|
case INS_RESET: // ledger may ask for confirmation - maybe a bug?
|
||||||
case INS_GET_KEY: // ledger asks for confirmation to send keys
|
case INS_GET_KEY: // ledger asks for confirmation to send keys
|
||||||
|
case INS_DISPLAY_ADDRESS:
|
||||||
setIndeterminate(true);
|
setIndeterminate(true);
|
||||||
setMessage(getContext().getString(R.string.progress_ledger_confirm));
|
setMessage(getContext().getString(R.string.progress_ledger_confirm));
|
||||||
break;
|
break;
|
||||||
@@ -102,6 +103,11 @@ public class LedgerProgressDialog extends ProgressDialog implements Ledger.Liste
|
|||||||
setMessage(getContext().getString(R.string.progress_ledger_mlsag));
|
setMessage(getContext().getString(R.string.progress_ledger_mlsag));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case INS_PREFIX_HASH:
|
||||||
|
if ((apdu[2] != 1) || (apdu[3] != 0)) break;
|
||||||
|
setIndeterminate(true);
|
||||||
|
setMessage(getContext().getString(R.string.progress_ledger_confirm));
|
||||||
|
break;
|
||||||
case INS_VALIDATE:
|
case INS_VALIDATE:
|
||||||
if ((apdu[2] != 1) || (apdu[3] != 1)) break;
|
if ((apdu[2] != 1) || (apdu[3] != 1)) break;
|
||||||
validate = true;
|
validate = true;
|
||||||
|
@@ -248,7 +248,13 @@ public class Wallet {
|
|||||||
|
|
||||||
public native long getDaemonBlockChainTargetHeight();
|
public native long getDaemonBlockChainTargetHeight();
|
||||||
|
|
||||||
public native boolean isSynchronized();
|
public native boolean isSynchronizedJ();
|
||||||
|
|
||||||
|
public boolean isSynchronized() {
|
||||||
|
final long daemonHeight = getDaemonBlockChainHeight();
|
||||||
|
if (daemonHeight == 0) return false;
|
||||||
|
return isSynchronizedJ() && (getBlockChainHeight() == daemonHeight);
|
||||||
|
}
|
||||||
|
|
||||||
public static native String getDisplayAmount(long amount);
|
public static native String getDisplayAmount(long amount);
|
||||||
|
|
||||||
@@ -278,6 +284,8 @@ public class Wallet {
|
|||||||
|
|
||||||
public native void refreshAsync();
|
public native void refreshAsync();
|
||||||
|
|
||||||
|
public native void rescanBlockchainAsync();
|
||||||
|
|
||||||
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
|
//TODO virtual void setAutoRefreshInterval(int millis) = 0;
|
||||||
//TODO virtual int autoRefreshInterval() const = 0;
|
//TODO virtual int autoRefreshInterval() const = 0;
|
||||||
|
|
||||||
@@ -298,22 +306,21 @@ public class Wallet {
|
|||||||
public PendingTransaction createTransaction(TxData txData) {
|
public PendingTransaction createTransaction(TxData txData) {
|
||||||
return createTransaction(
|
return createTransaction(
|
||||||
txData.getDestinationAddress(),
|
txData.getDestinationAddress(),
|
||||||
txData.getPaymentId(),
|
|
||||||
txData.getAmount(),
|
txData.getAmount(),
|
||||||
txData.getMixin(),
|
txData.getMixin(),
|
||||||
txData.getPriority());
|
txData.getPriority());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PendingTransaction createTransaction(String dst_addr, String payment_id,
|
public PendingTransaction createTransaction(String dst_addr,
|
||||||
long amount, int mixin_count,
|
long amount, int mixin_count,
|
||||||
PendingTransaction.Priority priority) {
|
PendingTransaction.Priority priority) {
|
||||||
disposePendingTransaction();
|
disposePendingTransaction();
|
||||||
int _priority = priority.getValue();
|
int _priority = priority.getValue();
|
||||||
long txHandle =
|
long txHandle =
|
||||||
(amount == SWEEP_ALL ?
|
(amount == SWEEP_ALL ?
|
||||||
createSweepTransaction(dst_addr, payment_id, mixin_count, _priority,
|
createSweepTransaction(dst_addr, "", mixin_count, _priority,
|
||||||
accountIndex) :
|
accountIndex) :
|
||||||
createTransactionJ(dst_addr, payment_id, amount, mixin_count, _priority,
|
createTransactionJ(dst_addr, "", amount, mixin_count, _priority,
|
||||||
accountIndex));
|
accountIndex));
|
||||||
pendingTransaction = new PendingTransaction(txHandle);
|
pendingTransaction = new PendingTransaction(txHandle);
|
||||||
return pendingTransaction;
|
return pendingTransaction;
|
||||||
|
@@ -227,6 +227,7 @@ public class Helper {
|
|||||||
return String.format(Locale.US, "%,.2f", amount);
|
return String.format(Locale.US, "%,.2f", amount);
|
||||||
else { // amount < 1
|
else { // amount < 1
|
||||||
int decimals = 1 - (int) Math.floor(Math.log10(amount));
|
int decimals = 1 - (int) Math.floor(Math.log10(amount));
|
||||||
|
if (decimals < 2) decimals = 2;
|
||||||
if (decimals > 12) decimals = 12;
|
if (decimals > 12) decimals = 12;
|
||||||
return String.format(Locale.US, "%,." + decimals + "f", amount);
|
return String.format(Locale.US, "%,." + decimals + "f", amount);
|
||||||
}
|
}
|
||||||
@@ -322,9 +323,9 @@ public class Helper {
|
|||||||
static public HttpUrl getXmrToBaseUrl() {
|
static public HttpUrl getXmrToBaseUrl() {
|
||||||
if ((WalletManager.getInstance() == null)
|
if ((WalletManager.getInstance() == null)
|
||||||
|| (WalletManager.getInstance().getNetworkType() != NetworkType.NetworkType_Mainnet)) {
|
|| (WalletManager.getInstance().getNetworkType() != NetworkType.NetworkType_Mainnet)) {
|
||||||
return HttpUrl.parse("https://test.xmr.to/api/v2/xmr2btc/");
|
return HttpUrl.parse("https://test.xmr.to/api/v3/xmr2btc/");
|
||||||
} else {
|
} else {
|
||||||
return HttpUrl.parse("https://xmr.to/api/v2/xmr2btc/");
|
return HttpUrl.parse("https://xmr.to/api/v3/xmr2btc/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,6 +109,13 @@ public class RestoreHeight {
|
|||||||
blockheight.put("2019-09-01", 1913201L);
|
blockheight.put("2019-09-01", 1913201L);
|
||||||
blockheight.put("2019-10-01", 1934732L);
|
blockheight.put("2019-10-01", 1934732L);
|
||||||
blockheight.put("2019-11-01", 1957051L);
|
blockheight.put("2019-11-01", 1957051L);
|
||||||
|
blockheight.put("2019-12-01", 1978433L);
|
||||||
|
blockheight.put("2020-01-01", 2001315L);
|
||||||
|
blockheight.put("2020-02-01", 2023656L);
|
||||||
|
blockheight.put("2020-03-01", 2044552L);
|
||||||
|
blockheight.put("2020-04-01", 2066806L);
|
||||||
|
blockheight.put("2020-05-01", 2088411L);
|
||||||
|
blockheight.put("2020-06-01", 2110702L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getHeight(String date) {
|
public long getHeight(String date) {
|
||||||
|
@@ -44,6 +44,7 @@ import com.m2049r.xmrwallet.util.Helper;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
@@ -66,9 +67,12 @@ public class ExchangeEditText extends LinearLayout {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
String enteredAmount = etAmountA.getText().toString();
|
String nativeAmount = getNativeAmount();
|
||||||
|
if (nativeAmount == null) {
|
||||||
|
ok = false;
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
double amount = Double.parseDouble(enteredAmount);
|
double amount = Double.parseDouble(nativeAmount);
|
||||||
if ((amount < min) || (amount > max)) {
|
if ((amount < min) || (amount > max)) {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
@@ -77,6 +81,7 @@ public class ExchangeEditText extends LinearLayout {
|
|||||||
Timber.e(ex.getLocalizedMessage());
|
Timber.e(ex.getLocalizedMessage());
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
shakeAmountField();
|
shakeAmountField();
|
||||||
}
|
}
|
||||||
@@ -110,7 +115,7 @@ public class ExchangeEditText extends LinearLayout {
|
|||||||
|
|
||||||
public String getNativeAmount() {
|
public String getNativeAmount() {
|
||||||
if (isExchangeInProgress()) return null;
|
if (isExchangeInProgress()) return null;
|
||||||
if (sCurrencyA.getSelectedItemPosition() == 0)
|
if (getCurrencyA() == 0)
|
||||||
return getCleanAmountString(etAmountA.getText().toString());
|
return getCleanAmountString(etAmountA.getText().toString());
|
||||||
else
|
else
|
||||||
return getCleanAmountString(tvAmountB.getText().toString());
|
return getCleanAmountString(tvAmountB.getText().toString());
|
||||||
@@ -336,7 +341,7 @@ public class ExchangeEditText extends LinearLayout {
|
|||||||
private void exchange(double rate) {
|
private void exchange(double rate) {
|
||||||
double amount = getEnteredAmount();
|
double amount = getEnteredAmount();
|
||||||
if (rate > 0) {
|
if (rate > 0) {
|
||||||
tvAmountB.setText(Helper.getFormattedAmount(rate * amount));
|
tvAmountB.setText(Helper.getFormattedAmount(rate * amount, getCurrencyB() == 0));
|
||||||
} else {
|
} else {
|
||||||
tvAmountB.setText(null);
|
tvAmountB.setText(null);
|
||||||
Timber.w("No rate!");
|
Timber.w("No rate!");
|
||||||
@@ -347,7 +352,7 @@ public class ExchangeEditText extends LinearLayout {
|
|||||||
try {
|
try {
|
||||||
double amount = Double.parseDouble(enteredAmount);
|
double amount = Double.parseDouble(enteredAmount);
|
||||||
if (amount >= 0) {
|
if (amount >= 0) {
|
||||||
return Helper.getFormattedAmount(amount);
|
return String.format(Locale.US, "%,.12f", amount);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,9 @@ import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback;
|
|||||||
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
@@ -147,6 +150,15 @@ public class ExchangeView extends LinearLayout {
|
|||||||
inflater.inflate(R.layout.view_exchange, this);
|
inflater.inflate(R.layout.view_exchange, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCurrencyAdapter(Spinner spinner) {
|
||||||
|
List<String> currencies = new ArrayList<>();
|
||||||
|
currencies.add(Helper.BASE_CRYPTO);
|
||||||
|
currencies.addAll(Arrays.asList(getResources().getStringArray(R.array.currency)));
|
||||||
|
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, currencies);
|
||||||
|
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
spinner.setAdapter(spinnerAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
@@ -161,6 +173,9 @@ public class ExchangeView extends LinearLayout {
|
|||||||
evExchange = findViewById(R.id.evExchange);
|
evExchange = findViewById(R.id.evExchange);
|
||||||
pbExchange = findViewById(R.id.pbExchange);
|
pbExchange = findViewById(R.id.pbExchange);
|
||||||
|
|
||||||
|
setCurrencyAdapter(sCurrencyA);
|
||||||
|
setCurrencyAdapter(sCurrencyB);
|
||||||
|
|
||||||
// make progress circle gray
|
// make progress circle gray
|
||||||
pbExchange.getIndeterminateDrawable().
|
pbExchange.getIndeterminateDrawable().
|
||||||
setColorFilter(getResources().getColor(R.color.trafficGray),
|
setColorFilter(getResources().getColor(R.color.trafficGray),
|
||||||
|
@@ -43,47 +43,31 @@ public interface QueryOrderStatus {
|
|||||||
|
|
||||||
boolean isError();
|
boolean isError();
|
||||||
|
|
||||||
State getState(); // "state": "<order_state_as_string>",
|
QueryOrderStatus.State getState();
|
||||||
|
|
||||||
double getBtcAmount(); // "btc_amount": <requested_amount_in_btc_as_float>,
|
double getBtcAmount();
|
||||||
|
|
||||||
String getBtcDestAddress(); // "btc_dest_address": "<requested_destination_address_as_string>",
|
String getBtcDestAddress();
|
||||||
|
|
||||||
String getUuid(); // "uuid": "<unique_order_identifier_as_12_character_string>"
|
String getUuid();
|
||||||
|
|
||||||
int getBtcNumConfirmations(); // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
|
int getBtcNumConfirmationsThreshold();
|
||||||
|
|
||||||
int getBtcNumConfirmationsBeforePurge(); // "btc_num_confirmations_before_purge": <btc_num_confirmations_before_purge_as_integer>,
|
Date getCreatedAt();
|
||||||
|
|
||||||
String getBtcTransactionId(); // "btc_transaction_id": "<btc_transaction_id_as_string>",
|
Date getExpiresAt();
|
||||||
|
|
||||||
Date getCreatedAt(); // "created_at": "<timestamp_as_string>",
|
int getSecondsTillTimeout();
|
||||||
|
|
||||||
Date getExpiresAt(); // "expires_at": "<timestamp_as_string>",
|
double getIncomingAmountTotal();
|
||||||
|
|
||||||
int getSecondsTillTimeout(); // "seconds_till_timeout": <seconds_till_timeout_as_integer>,
|
double getRemainingAmountIncoming();
|
||||||
|
|
||||||
double getXmrAmountTotal(); // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>,
|
int getIncomingNumConfirmationsRemaining();
|
||||||
|
|
||||||
double getXmrAmountRemaining(); // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>,
|
double getIncomingPriceBtc();
|
||||||
|
|
||||||
int getXmrNumConfirmationsRemaining(); // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
String getReceivingSubaddress();
|
||||||
|
|
||||||
double getXmrPriceBtc(); // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
|
||||||
|
|
||||||
String getXmrReceivingAddress(); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
|
||||||
|
|
||||||
String getXmrReceivingSubaddress(); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
|
||||||
|
|
||||||
String getXmrReceivingIntegratedAddress(); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
|
|
||||||
|
|
||||||
int getXmrRecommendedMixin(); // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
double getXmrRequiredAmount(); // "xmr_required_amount": <xmr_amount_user_needs_to_send_as_float>,
|
|
||||||
|
|
||||||
String getXmrRequiredPaymentIdLong(); // "xmr_required_payment_id_long": "xmr_payment_id_user_needs_to_include_when_using_old_stlye_address_as_string"
|
|
||||||
|
|
||||||
String getXmrRequiredPaymentIdShort(); // "xmr_required_payment_id_short": "xmr_payment_id_included_in_integrated_address_as_string"
|
|
||||||
|
|
||||||
|
int getRecommendedMixin();
|
||||||
}
|
}
|
||||||
|
@@ -113,7 +113,8 @@ class CreateOrderImpl implements CreateOrder {
|
|||||||
|
|
||||||
static JSONObject createRequest(final double amount, final String address) throws JSONException {
|
static JSONObject createRequest(final double amount, final String address) throws JSONException {
|
||||||
final JSONObject jsonObject = new JSONObject();
|
final JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("btc_amount", amount);
|
jsonObject.put("amount", amount);
|
||||||
|
jsonObject.put("amount_currency", "BTC");
|
||||||
jsonObject.put("btc_dest_address", address);
|
jsonObject.put("btc_dest_address", address);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
@@ -42,23 +42,17 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||||||
private String btcDestAddress; // "btc_dest_address": "<requested_destination_address_as_string>",
|
private String btcDestAddress; // "btc_dest_address": "<requested_destination_address_as_string>",
|
||||||
private String uuid; // "uuid": "<unique_order_identifier_as_12_character_string>"
|
private String uuid; // "uuid": "<unique_order_identifier_as_12_character_string>"
|
||||||
// the following are only returned if the state is "after" TO_BE_CREATED
|
// the following are only returned if the state is "after" TO_BE_CREATED
|
||||||
private int btcNumConfirmations; // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
|
//private int btcNumConfirmations; // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
|
||||||
private int btcNumConfirmationsBeforePurge; // "btc_num_confirmations_before_purge": <btc_num_confirmations_before_purge_as_integer>,
|
private int btcNumConfirmationsThreshold; // "btc_num_confirmations_threshold": <btc_num_confirmations_threshold_as_integer>,
|
||||||
private String btcTransactionId; // "btc_transaction_id": "<btc_transaction_id_as_string>",
|
|
||||||
private Date createdAt; // "created_at": "<timestamp_as_string>",
|
private Date createdAt; // "created_at": "<timestamp_as_string>",
|
||||||
private Date expiresAt; // "expires_at": "<timestamp_as_string>",
|
private Date expiresAt; // "expires_at": "<timestamp_as_string>",
|
||||||
private int secondsTillTimeout; // "seconds_till_timeout": <seconds_till_timeout_as_integer>,
|
private int secondsTillTimeout; // "seconds_till_timeout": <seconds_till_timeout_as_integer>,
|
||||||
private double xmrAmountTotal; // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>,
|
private double incomingAmountTotal; // "incoming_amount_total": <amount_in_incoming_currency_for_this_order_as_float>,
|
||||||
private double xmrAmountRemaining; // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>,
|
private double remainingAmountIncoming; // "remaining_amount_incoming": <amount_in_incoming_currency_that_the_user_must_still_send_as_float>,
|
||||||
private int xmrNumConfirmationsRemaining; // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
private int incomingNumConfirmationsRemaining; // "incoming_num_confirmations_remaining": <num_incoming_currency_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
||||||
private double xmrPriceBtc; // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
private double incomingPriceBtc; // "incoming_price_btc": <price_of_1_incoming_in_btc_currency_as_offered_by_service_as_float>,
|
||||||
private String xmrReceivingSubaddress; // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
private String receivingSubaddress; // "receiving_subaddress": <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
||||||
private String xmrReceivingAddress; // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
private int recommendedMixin; // "recommended_mixin": <recommended_mixin_as_integer>,
|
||||||
private String xmrReceivingIntegratedAddress; // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
|
|
||||||
private int xmrRecommendedMixin; // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
|
|
||||||
private double xmrRequiredAmount; // "xmr_required_amount": <xmr_amount_user_needs_to_send_as_float>,
|
|
||||||
private String xmrRequiredPaymentIdLong; // "xmr_required_payment_id_long": "xmr_payment_id_user_needs_to_include_when_using_old_stlye_address_as_string"
|
|
||||||
private String xmrRequiredPaymentIdShort; // "xmr_required_payment_id_short": "xmr_payment_id_included_in_integrated_address_as_string"
|
|
||||||
|
|
||||||
public QueryOrderStatus.State getState() {
|
public QueryOrderStatus.State getState() {
|
||||||
return state;
|
return state;
|
||||||
@@ -76,16 +70,8 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBtcNumConfirmations() {
|
public int getBtcNumConfirmationsThreshold() {
|
||||||
return btcNumConfirmations;
|
return btcNumConfirmationsThreshold;
|
||||||
}
|
|
||||||
|
|
||||||
public int getBtcNumConfirmationsBeforePurge() {
|
|
||||||
return btcNumConfirmationsBeforePurge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBtcTransactionId() {
|
|
||||||
return btcTransactionId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreatedAt() {
|
public Date getCreatedAt() {
|
||||||
@@ -100,48 +86,28 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||||||
return secondsTillTimeout;
|
return secondsTillTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getXmrAmountTotal() {
|
public double getIncomingAmountTotal() {
|
||||||
return xmrAmountTotal;
|
return incomingAmountTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getXmrAmountRemaining() {
|
public double getRemainingAmountIncoming() {
|
||||||
return xmrAmountRemaining;
|
return remainingAmountIncoming;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getXmrNumConfirmationsRemaining() {
|
public int getIncomingNumConfirmationsRemaining() {
|
||||||
return xmrNumConfirmationsRemaining;
|
return incomingNumConfirmationsRemaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getXmrPriceBtc() {
|
public double getIncomingPriceBtc() {
|
||||||
return xmrPriceBtc;
|
return incomingPriceBtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXmrReceivingSubaddress() {
|
public String getReceivingSubaddress() {
|
||||||
return xmrReceivingSubaddress;
|
return receivingSubaddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXmrReceivingAddress() {
|
public int getRecommendedMixin() {
|
||||||
return xmrReceivingAddress;
|
return recommendedMixin;
|
||||||
}
|
|
||||||
|
|
||||||
public String getXmrReceivingIntegratedAddress() {
|
|
||||||
return xmrReceivingIntegratedAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getXmrRecommendedMixin() {
|
|
||||||
return xmrRecommendedMixin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getXmrRequiredAmount() {
|
|
||||||
return xmrRequiredAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getXmrRequiredPaymentIdLong() {
|
|
||||||
return xmrRequiredPaymentIdLong;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getXmrRequiredPaymentIdShort() {
|
|
||||||
return xmrRequiredPaymentIdShort;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCreated() {
|
public boolean isCreated() {
|
||||||
@@ -197,29 +163,22 @@ class QueryOrderStatusImpl implements QueryOrderStatus {
|
|||||||
uuid = jsonObject.getString("uuid"); // "uuid": "<unique_order_identifier_as_12_character_string>"
|
uuid = jsonObject.getString("uuid"); // "uuid": "<unique_order_identifier_as_12_character_string>"
|
||||||
|
|
||||||
if (isCreated()) {
|
if (isCreated()) {
|
||||||
btcNumConfirmations = jsonObject.getInt("btc_num_confirmations"); // "btc_num_confirmations": <btc_num_confirmations_as_integer>,
|
btcNumConfirmationsThreshold = jsonObject.getInt("btc_num_confirmations_threshold");
|
||||||
btcNumConfirmationsBeforePurge = jsonObject.getInt("btc_num_confirmations_before_purge"); // "btc_num_confirmations_before_purge": <btc_num_confirmations_before_purge_as_integer>,
|
|
||||||
btcTransactionId = jsonObject.getString("btc_transaction_id"); // "btc_transaction_id": "<btc_transaction_id_as_string>",
|
|
||||||
try {
|
try {
|
||||||
String created = jsonObject.getString("created_at"); // "created_at": "<timestamp_as_string>",
|
String created = jsonObject.getString("created_at");
|
||||||
createdAt = parseDate(created);
|
createdAt = parseDate(created);
|
||||||
String expires = jsonObject.getString("expires_at"); // "expires_at": "<timestamp_as_string>",
|
String expires = jsonObject.getString("expires_at");
|
||||||
expiresAt = parseDate(expires);
|
expiresAt = parseDate(expires);
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
throw new JSONException(ex.getLocalizedMessage());
|
throw new JSONException(ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
secondsTillTimeout = jsonObject.getInt("seconds_till_timeout"); // "seconds_till_timeout": <seconds_till_timeout_as_integer>,
|
secondsTillTimeout = jsonObject.getInt("seconds_till_timeout");
|
||||||
xmrAmountTotal = jsonObject.getDouble("xmr_amount_total"); // "xmr_amount_total": <amount_in_xmr_for_this_order_as_float>,
|
incomingAmountTotal = jsonObject.getDouble("incoming_amount_total");
|
||||||
xmrAmountRemaining = jsonObject.getDouble("xmr_amount_remaining"); // "xmr_amount_remaining": <amount_in_xmr_that_the_user_must_still_send_as_float>,
|
remainingAmountIncoming = jsonObject.getDouble("remaining_amount_incoming");
|
||||||
xmrNumConfirmationsRemaining = jsonObject.getInt("xmr_num_confirmations_remaining"); // "xmr_num_confirmations_remaining": <num_xmr_confirmations_remaining_before_bitcoins_will_be_sent_as_integer>,
|
incomingNumConfirmationsRemaining = jsonObject.getInt("incoming_num_confirmations_remaining");
|
||||||
xmrPriceBtc = jsonObject.getDouble("xmr_price_btc"); // "xmr_price_btc": <price_of_1_btc_in_xmr_as_offered_by_service_as_float>,
|
incomingPriceBtc = jsonObject.getDouble("incoming_price_btc");
|
||||||
xmrReceivingSubaddress = jsonObject.getString("xmr_receiving_subaddress"); // <xmr_subaddress_user_needs_to_send_funds_to_as_string>,
|
receivingSubaddress = jsonObject.getString("receiving_subaddress");
|
||||||
xmrReceivingAddress = jsonObject.getString("xmr_receiving_address"); // "xmr_receiving_address": "xmr_old_style_address_user_can_send_funds_to_as_string",
|
recommendedMixin = jsonObject.getInt("recommended_mixin");
|
||||||
xmrReceivingIntegratedAddress = jsonObject.getString("xmr_receiving_integrated_address"); // "xmr_receiving_integrated_address": "xmr_integrated_address_user_needs_to_send_funds_to_as_string",
|
|
||||||
xmrRecommendedMixin = jsonObject.getInt("xmr_recommended_mixin"); // "xmr_recommended_mixin": <xmr_recommended_mixin_as_integer>,
|
|
||||||
xmrRequiredAmount = jsonObject.getDouble("xmr_required_amount"); // "xmr_required_amount": <xmr_amount_user_needs_to_send_as_float>,
|
|
||||||
xmrRequiredPaymentIdLong = jsonObject.getString("xmr_required_payment_id_long"); // "xmr_required_payment_id_long": "xmr_payment_id_user_needs_to_include_when_using_old_stlye_address_as_string"
|
|
||||||
xmrRequiredPaymentIdShort = jsonObject.getString("xmr_required_payment_id_short"); // "xmr_required_payment_id_short": "xmr_payment_id_included_in_integrated_address_as_string"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,11 +53,6 @@ public class XmrToApiImpl implements XmrToApi, XmrToApiCall {
|
|||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmrToApiImpl(@NonNull final OkHttpClient okHttpClient) {
|
|
||||||
this(okHttpClient, HttpUrl.parse("https://xmr.to/api/v2/xmr2btc/"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createOrder(final double amount, @NonNull final String address,
|
public void createOrder(final double amount, @NonNull final String address,
|
||||||
@NonNull final XmrToCallback<CreateOrder> callback) {
|
@NonNull final XmrToCallback<CreateOrder> callback) {
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/gradientPink"
|
|
||||||
android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z" />
|
|
||||||
</vector>
|
|
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/gradientPink"
|
|
||||||
android:pathData="M17,3L7,3c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z" />
|
|
||||||
</vector>
|
|
9
app/src/main/res/drawable/ic_favorite_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_favorite_24dp.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gradientPink"
|
||||||
|
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_favorite_border_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_favorite_border_24dp.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gradientPink"
|
||||||
|
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
|
||||||
|
</vector>
|
@@ -108,50 +108,6 @@
|
|||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
tools:text="@string/info_xmrto" />
|
tools:text="@string/info_xmrto" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/llPaymentId"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:visibility="visible">
|
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
|
||||||
android:id="@+id/etPaymentId"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toStartOf="@+id/bPaymentId"
|
|
||||||
app:counterEnabled="true"
|
|
||||||
app:counterMaxLength="16"
|
|
||||||
app:errorEnabled="true">
|
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
|
||||||
style="@style/MoneroEdit"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="10"
|
|
||||||
android:hint="@string/send_paymentid_hint"
|
|
||||||
android:imeOptions="actionNext"
|
|
||||||
android:inputType="textMultiLine"
|
|
||||||
android:textAlignment="textStart" />
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/bPaymentId"
|
|
||||||
style="@style/MoneroText.Button.Small"
|
|
||||||
android:layout_width="56dp"
|
|
||||||
android:layout_height="56dp"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
|
||||||
android:drawableTop="@drawable/ic_settings_orange_24dp"
|
|
||||||
android:text="@string/send_generate_paymentid_hint" />
|
|
||||||
</RelativeLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user